exp、imp備份還原數據

邏輯備份與恢復

導出具體的分爲:導出表,導出方案,導出數據庫
導出使用EXP命令來完成,該命令常用的選項有:
userid:用於指定執行導出操作的用戶,口令,連接字符串
tables:用於指定執行導出操作的表
ower:用於指定執行導出操作的所有者用戶名
full=y:用於指定執行導出操作的方案
inctype:用於指定執行到處操作的增量
rows:用於指定執行導出操作是否要導出表中的數據
file:用於指定導出文件名
導出表(包含表中的數據)
導出自己的表
exp userid=scott/tiger@myoral tables=(table1,table2,table3...) file=d:\e1.dmp
導出其他方案的表
如果用戶要導出其他方案的表,則需要dba的權限或是

exp_full_database的權限,比如system就可以導出scott的表
exp userid=system/manager@myoral tables=(scott.emp) 

file=D:\e2.dmp
導出表結構不包含表中的數據
exp userid=scott/tiger@myoracle tables=(emp) file=d:\e3.dmp rows=n
使用直接導出方法
exp userid=scott/tiger@accp tables=(emp) file=d:\e3.dmp direct=y
 這種方式比默認的的常規方式速度快,當數據量大時,可以考慮使用這樣的方法;(這時需要數據庫的字符集要與客戶端的字符
集完全一致,否則會報錯。。。。)

導出方案
導出自己的方案
exp scott/tiger@stylar owner=scott file=d:\scott.dmp;
導出其他方案
需要dba權限或者是exp_full_database權限
exp system/manger@stylar owner=(scott) file=d:\system.dmp;   -----導出多個方案的話用(scott1,scott2...)

導出數據庫
導出數據庫要求用戶的權限dba的權限或是exp_full_database權限
exp userid=system/manager@stylar full=y inctype=complete file=D:\stylar.dmp

導入使用import工具
imp常用的選項
userid用於指定導入操作的用戶名,口令,連接字符串
tables用於指定執行導入操作的表
fromuser  用於指定導入操作的源用戶
touser用於指定目標用戶
file 用於指定導入的文件名
full=y用於指定導入整個文件
inctype用於指定執行導入操作的增量類型
rows指定是否導入錶行(數據)
ignore如果表存在,則只導入數據
log寫日誌到指定的路徑,可以很好的查看其中的錯誤後綴爲.log

導入表
導入自己的表
imp userid=scott/tiger@stylar tables=(emp) file=d:\xx.dmp
導入表到其他用戶(要求有dba或imp_full_database)
imp userid=system/manager@stylar tables=(emp) file=d:/xx.dmp touser=scott
導入表的結構
imp userid=system/manager@stylar tables=(emp) file=d:/xx.dmp rows=n
導入數據 ----如果對象(比如表)已經存在可以只導入表的數據
imp  userid=scorr/tiger@myor tables=(emp) file=d:/xx.dmp ignore=y
導入方案
需要權限dba或者imp_full_database
導入自身的方案
imp userid=scott/tiger@stylar file=d:\xx.dmp;
導入其他方案
imp userid=system/manager@stylar file=d:\xx.dmp fromuser=system touser=scott

導入數據庫
imp userid=system/manager full=y file=d:/xx.dmp
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章