Oracle在Linux上如何遷移數(shù)據(jù)

Oracle在Linux上如何遷移數(shù)據(jù)

linux系統(tǒng)中遷移oracle數(shù)據(jù)庫的數(shù)據(jù)有多種方式,常用的包括Data Pump(expdp/impdp)、RMAN(Recovery Manager)以及GoldenGate等工具。以下將詳細(xì)介紹使用Data Pump和RMAN進行遷移的具體流程:

利用Data Pump (expdp/impdp) 進行數(shù)據(jù)遷移

前提條件

  • 源與目標(biāo)數(shù)據(jù)庫均已在Linux服務(wù)器上完成安裝及配置。
  • 已知源庫與目標(biāo)庫的登錄用戶名和密碼。

操作步驟

在源服務(wù)器執(zhí)行

  1. 創(chuàng)建目錄對象

     [root@linux100] # su - oracle  [oracle@linux100] # sqlplus / as sysdba  SQL create or replace directory tmpDir as '/tempFile';
  2. 使用expdp導(dǎo)出數(shù)據(jù):

     [oracle@linux100] # expdp username/password@Ip:port/database schemas dbTest directory tmpDir dumpfile export.dmp logfile export.log;
  3. 將導(dǎo)出的dmp文件傳輸至目標(biāo)服務(wù)器:

     [oracle@linux100] # scp -P 2222 /tempFile/export.dmp name@xxx.xxx.xxx.xxx:/home/tempFile;

在目標(biāo)服務(wù)器執(zhí)行

  1. 創(chuàng)建目錄對象:

     [root@linux101] # su - oracle  [oracle@linux101] # sqlplus / as sysdba  SQL create or replace directory tmpDir as '/tempFile';
  2. 使用impdp導(dǎo)入數(shù)據(jù):

     [oracle@linux101] # impdp username/password@Ip:port/database schemas dbTest directory tmpDir dumpfile export.dmp job_namemyjob;

使用RMAN實現(xiàn)數(shù)據(jù)庫遷移

前提條件

  • 源與目標(biāo)數(shù)據(jù)庫都已部署并配置于Linux環(huán)境。
  • 用戶名和密碼信息已準(zhǔn)備就緒。

實施步驟

在源服務(wù)器執(zhí)行

  1. 登錄到RMAN:

     [oracle@linux100] # rman target /
  2. 執(zhí)行數(shù)據(jù)庫備份:

     RMAN backup database plus archivelog;
  3. 遷移數(shù)據(jù)文件:

     RMAN run {      allocate channel c1 type disk;      allocate channel c2 type disk;      restore database from tag 'backup_tag';      switch datafile all;      release channel c1;      release channel c2;  }
  4. 修改初始化參數(shù)文件:

     [oracle@linux100] # sqlplus / as sysdba  SQL ALTER SYSTEM SET DB_FILE_NAME_CONVERT '/old/path,/new/path' SCOPESPFILE;  SQL ALTER SYSTEM SET LOG_FILE_NAME_CONVERT '/old/path,/new/path' SCOPESPFILE;
  5. 停止數(shù)據(jù)庫并啟動至NOMOUNT模式:

     SQL shutdown immediate;  SQL startup nomount;

在目標(biāo)服務(wù)器執(zhí)行

  1. 創(chuàng)建目錄對象:

     [root@linux101] # su - oracle  [oracle@linux101] # sqlplus / as sysdba  SQL create or replace directory tmpDir as '/tempFile';
  2. 通過RMAN恢復(fù)數(shù)據(jù)庫:

     RMAN startup nomount;  RMAN @/target-directory/crdb.sql;

? 版權(quán)聲明
THE END
喜歡就支持一下吧
點贊11 分享