一. 創建表并插入數據
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
孤飛燕 閱讀(487)
評論(0) 編輯 收藏 所屬分類:
數據庫