遷移的話,直接導出一個庫的dmp文件,之后導入到另外一個庫里面就可以了(導出和導入數據庫版本必須一直,否則導入可能會報錯)。
遷移數據導出:
1 將數據庫TEST完全導出,用戶名system 密碼manager 導出到D:\daochu.dmp中
exp system/manager@TEST file=d:\daochu.dmp full=y
2 將數據庫中system用戶與sys用戶的表導出
exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)
3 將數據庫中的表table1 、table2導出
exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2)
4 將數據庫中的表table1中的字段filed1以"00"打頭的數據導出
exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\"
遷移數據的導入
1 將D:\daochu.dmp 中的數據導入 TEST數據庫中。
imp system/manager@TEST file=d:\daochu.dmp
上面可能有點問題,因為有的表已經存在,然后它就報錯,對該表就不進行導入。
在后面加上 ignore=y 就可以了。
2 將d:\daochu.dmp中的表table1 導入
imp system/manager@TEST file=d:\daochu.dmp tables=(table1)
本文選自金絲閣