oracle expdp impdp 資料移轉 備份恢複某個使用者資料

來源:互聯網
上載者:User

作業系統都是centos     原始伺服器名稱:A      目標伺服器名稱:B

 在A伺服器操作

su  - oracle

1、在Linux目錄建立目錄,用來儲存匯出的資料檔案

mkdir -p /home/oracle/expdp_dir //一台伺服器只要建立一次

sqlplus / as sysdba

2、建立邏輯目錄,該命令不會在作業系統建立真正的目錄 

SQL> create directory expdp_dir as '/home/oracle/expdp_dir';  //一台伺服器只要建立一次
3、賦予匯出的使用者權限
SQL> grant read,write on directory expdp_dirto username;//實際情況可以根據使用者需要進行授權,有些使用者具有DBA許可權的就不需要了。

exit
4、匯出整個使用者資料庫

$ expdp username/userpassword@asid 
DIRECTORY=expdp_dir DUMPFILE=fe.dmp //每次都要操作
 

在B伺服器中操作:

su - oracle

5、在Linux目錄建立目錄,用來儲存匯出的資料檔案

mkdir -p /home/oracle/impdp_dir //一台伺服器只要建立一次

在impdp_dir目錄下必須有讀寫權限

chmod 777 impdp_dir

6、檔案傳輸

可以通過SCP命令直接從A伺服器中用oracle使用者將資料庫檔案傳到B伺服器impdp_dir

或者是通過winscp,先將A伺服器上面的檔案傳到客戶電腦,然後在傳客戶電腦在開啟一個WINSCP會話有oracle登入,複製到impdp_dir目錄下面 

sqlplus / as sysdba

建立邏輯目錄,該命令不會在作業系統建立真正的目錄 

SQL> create directory impdp_dir as '/home/oracle/impdp_dir';//一台伺服器只要建立一次

SQL> grant read,write on directory impdp_dir to username;//實際情況可以根據使用者需要進行授權,有些使用者具有DBA許可權的就不需要了。
exit
8、匯入整個使用者資料庫

$ impdp  username/password@bsid DIRECTORY=impdp_dir
DUMPFILE=fe.dmp

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.