資料庫的匯入匯出

Ruthless發表於2013-06-21

一、匯出:
開啟CMD,輸入命令: exp
Username: test@orcl
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters and Data Mining options
Enter array fetch buffer size: 4096 > //設定快取大小,預設4096,無需修改
Export file: expdat.dmp > D:\myproject_20120927.dmp //存放匯出的檔名
(2)U(sers), or (3)T(ables): (2)U > 2 //選擇匯出的範圍,
                                     //2是匯出該使用者下所有資料,包括表、儲存過程、sequence等;
         //3是隻匯出某個表;通常備份選擇2。
Export table data (yes ): yes > //是否匯出表中的資料

二、匯入:
開啟CMD,輸入命令: imp fromuser=test touser=test ignore=y file=D:\myproject_20120927.dmp
fromuser是指你匯出的庫的使用者ID;
touser是指你匯入的庫的使用者ID;
ignore是指是否忽略已經存在的表;
file是指等待匯入的檔案。
比如你從test@orcl匯出了一個檔案放在D:\myproject_20120927.dmp,現在你要匯入本機other_test@other_orcl,那你的指令碼就是imp fromuser=test touser=other_test file=D:\myproject_20120927.dmp
然後會提示你輸入使用者名稱密碼,然後就開始導資料了。注意命令裡面的等號前後不要有空格。

相關文章