孤燈野火
          暢想的天空
          posts - 2,comments - 4,trackbacks - 0

          一. 創建表并插入數據

          SQL> create table t1 as select * from scott.dept;

          Table created.

          SQL> select * from t1;

              DEPTNO DNAME          LOC                                                   
          ---------- -------------- -------------                                         
                  10 ACCOUNTING     NEW YORK                                              
                  20 RESEARCH       DALLAS                                                
                  30 SALES          CHICAGO                                               
                  40 OPERATIONS     BOSTON   

          二. 導出

          SQL> exp  -- 找不到該命令
          SP2-0042: unknown command "exp" - rest of line ignored.
          SQL> host exp  -- 在exp命令前加上host 

          提示輸入
          username:  
          scott/tiger@orcl   --如果是管理員則加上 as sysdba

          Enter array fetch buffer size: 4096 > 回車

          Export file: Expdat.dmp > e:\testexp.dmp  -- 導出文件存放位置

          (2)U(sers), or (3)(ables): (2)U > 回車 -- 導出方式, 這里只列出用戶方式和表方式, 如果是以管理員身份, 則有三種方式, 即整個數據庫.

          Export grants (yes/no): yes > 回車 --是否導出權限

          Export table data (yes/no): yes >回車 -- 是否導出表中數據

          compress extents (yes/no): yes >回車 -- 是否用壓縮區

          ...  這樣就把scott的所有對象導出了.



          三. 導入

          SQL> imp  -- 找不到該命令
          SP2-0042: unknown command "imp" - rest of line ignored.
          SQL> host imp -- 在imp命令前加上host 

          提示輸入
          username:  
          scott/tiger@orcl   --如果是管理員則加上 as sysdba

          Import file: EXPDAT.DMP > e:\testexp.dmp  -- 導入文件存放位置

          Enter insert buffer size (minimum is 8192) 30720) >回車

          List contents of import file only(yes/no): no >回車

          ignore create error due to object existence (yes/no): no > yes -- 如果對象已經存在, 則忽略

          import grants (yes/no): yes >回車 -- 是否導入權限

          import table data (yes/no): yes >回車 -- 是否導入表中數據

          import entire export file (yes/no): no >no

          username: scott -- 從哪個用戶導入.

          Enter table(T) or partition(T:P) names. Null list means all tales for user

          Enter table(T) or partition(T:P) name or . if done: t1 -- T 表示普通表, T:P 表示表空間.

          posted on 2011-11-02 19:42 孤飛燕 閱讀(491) 評論(0)  編輯  收藏 所屬分類: 數據庫
          主站蜘蛛池模板: 涪陵区| 苏尼特右旗| 黄山市| 白河县| 永和县| 通渭县| 兖州市| 台南县| 平湖市| 城固县| 抚州市| 梁平县| 夏河县| 尚义县| 遂平县| 钦州市| 合作市| 喜德县| 阿荣旗| 高邮市| 恩施市| 衡山县| 博罗县| 宁化县| 曲麻莱县| 虹口区| 奈曼旗| 称多县| 漯河市| 承德县| 京山县| 镇沅| 仁化县| 枣强县| 新龙县| 黄浦区| 崇阳县| 韶山市| 汨罗市| 聊城市| 革吉县|