最全的Oracle資料庫備份與還原命令
阿新 • • 發佈:2021-07-13
【資料匯出】
- 匯出orcl中所有的表空間
exp system/manager@orcl file=d:\daochu.dmp full=y
- 匯出system資料庫中指定的表空間
exp system/manager@orcl file=d:\daochu.dmp owner=(system,sys)
3. 匯出資料庫中制定的表資料
exp system/manager@orcl file=d:\daochu.dmp tables=(table1,table2)
- 匯出資料庫中table1中欄位field1以“00”開頭的資料
exp system/manager@orcl file=d:\daochu.dmp tables=(table1)query=" where filed1 like '00%'"
注:如果要壓縮,則在最後面加上compress=y即可
【資料匯入】
- 將D:\daochu.dmp 中的資料匯入 orcl資料庫中。
imp system/manager@orcl file=d:\daochu.dmp
注:如果有的表已經存在,會提示報錯,這個時候,在後面加上ignore=y,即已存在的表不匯入
- 將d:\daochu.dmp中的表table1 匯入
imp system/manager@orcl file=d:\daochu.dmp tables=(table1)
注:匯入匯出時,有時候會出現許可權不足的情況
這時,需要登入plus進行授權,首先登入管理員賬號,然後:
GRANT CREATE USER,DROP USER,ALTER USER ,CREATE ANY VIEW ,
DROP ANY VIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE,
DBA,CONNECT,RESOURCE,CREATE SESSION TO 使用者名稱字