孤燈野火
          暢想的天空
          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 孤飛燕 閱讀(492) 評論(0)  編輯  收藏 所屬分類: 數據庫
          主站蜘蛛池模板: 荆门市| 南汇区| 普宁市| 巨鹿县| 中西区| 铜鼓县| 清水县| 龙海市| 揭阳市| 南宫市| 彰武县| 金华市| 清镇市| 琼海市| 吐鲁番市| 中阳县| 巴彦县| 福鼎市| 菏泽市| 泰州市| 延边| 屏东县| 永善县| 郓城县| 泗水县| 牡丹江市| 阳高县| 宜宾市| 五大连池市| 进贤县| 迭部县| 海宁市| 嘉黎县| 霍林郭勒市| 绥德县| 汾西县| 诏安县| 樟树市| 贵州省| 镇康县| 剑川县|