利用Oracle Data Guard完成跨平臺的資料庫遷移案例
客戶原本是一套單機版的Oracle 11.2.0.3.0 Database for Windows的資料庫系統,客戶的需求是將單機版的Oracle Database遷移到3節點的Oracle RAC Database中,並且平臺變成Linux,但資料庫版本不變化。客戶希望儘可能短的停機時間。
通常對於不跨版本的Oracle Database遷移常使用DG(Data Guard),配置好DG之後做一次switchover即可完成資料庫的快速遷移,後續再進行修改IP地址等工作。
雖然這個案例需要跨平臺,但從11g開始Oracle Database支援有限制的跨平臺配置DG,下面是配置異構平臺DG的相容性列表(物理Standby):
從上面的相容性列表可以看出,Microsoft Windows (x86_64)(12)和Linux x86_64(13)能夠相容構建異構平臺的DG,但需要注意的是Oracle Database 需要是11g,並且需要應用Patch 13104881,該Patch只存在於Linux平臺,並且只在Windows(主庫)向Linux(備庫)同步時,需要在Linux平臺應用此補丁(反向不會遇到相應的bug),更多內容請參考Patch 13104881說明。
有關在異構平臺搭建ADG的詳細內容請參考文章:《在物理 Data Guard 中對異構主備系統的支援 (Doc ID 1602437.1)》
確認現有的平臺和新平臺之間能夠搭建DG之後,那麼剩下的問題就是如何將單機Database轉換成RAC Database,這步實際需要在將Linux平臺的備庫轉換成主庫之後進行的,下面描述的是整個遷移大致的步驟:
1.在新環境下安裝Oracle Grid Infrastructure叢集件。
2.在新環境下安裝Oracle RAC Database軟體。
3.建立ASM磁碟組,配置好監聽程式。
4.在RAC的第一個節點建立Windows到Linux的ADG(使用第一個節點的VIP地址,配置成實時同步模式),並直接將控制檔案、資料檔案、日誌檔案等存放到共享的ASM磁碟組。
<<<< 由於是配置Windows到Linux的DG,肯定涉及到DB_FILE_NAME_CONVERT和LOG_FILE_NAME_CONVERT引數的設定,這兩個引數需要重啟資料庫例項才能生效,需要注意的是,從主庫到備庫的duplicate操作,對目錄的轉換實際是由備庫中的這兩個引數設定來控制的,所以在前期配置階段可以不為主庫設定這兩個引數,這就意味著即使在跨平臺的環境中主庫也可以在不重啟的情況下完成DG的配置(除了這兩個引數外的其他大部分DG引數都不需要重啟便可生效)。
<<<< LOG_FILE_NAME_CONVERT引數的值一定要包含所有線上Redo日誌,standby Redo日誌的目錄的轉換。DB_FILE_NAME_CONVERT引數的值一定要包含所有資料檔案和臨時檔案目錄的轉換。例如:
LOG_FILE_NAME_CONVERT='+DATA01/dbm/onlinelog/','+DATA_DM01/dbm/onlinelog/','+FRA01/dbm/onlinelog/','+DBFS_DG/dbm/onlinelog/'
DB_FILE_NAME_CONVERT='+DATA01/dbm/datafile/','+DATA_DM01/dbm/datafile/','+DATA01/dbm/tempfile/','+DATA_DM01/dbm/tempfile/'
LOG_FILE_NAME_CONVERT和DB_FILE_NAME_CONVERT兩個引數的值的最後都要加上/斜槓。
對DB_FILE_NAME_CONVERT的引數設定除了考慮到資料檔案外,還需要考慮到臨時檔案的位置,特別是ASM的時候,OMF管理設定資料檔案為datafile目錄,臨時檔案為tempfile,不能只指定磁碟組的名字,一定要指定到具體的絕對路徑。
<<<< 另外還需要注意著兩個引數值的配置,假設有A庫(主庫)和B庫(備庫),在A庫配置的這兩個引數的值應該='B庫位置','A庫位置',在B庫配置的這兩個引數的值應該='A庫位置','B庫位置',切不可搞反了。
<<<< 如果DG配置完成後,日誌傳輸服務沒有正常工作,可以考慮執行alter system set log_archive_dest_state_2=defer;alter system set log_archive_dest_state_2=enable;的方式禁用再啟用遠端目錄傳輸。
<<<< 再做單機版主庫到備庫的的DG的時候,最好將ORACLE_SID環境變數,instance_name和db_unique_name配置為相同的值,之後再進行調整。
5.將備庫轉換為主庫(可以做Switchover操作,也可以在確保主備庫實時同步的前提下直接關閉主庫,將備庫啟用成為可讀可寫的資料庫)。
6.執行下面的步驟將單機版的資料庫轉換為RAC資料庫:
4) Take a backup of original single-instance pfile to e.g. /tmp/initorcl.ora and Add the following entry in pfile, e.g. for a two node RAC cluster
*.cluster_database_instances = 2
*.undo_management=AUTO
.undo_tablespace=undotbs (undo tablespace which already exists)
.instance_name=
.instance_number=1
.thread=1
.local_listener=_
.instance_name=
.instance_number=2
.local_listener=_
.thread=2
.undo_tablespace=UNDOTBS2
.cluster_database = TRUE
.cluster_database_instances = 2
is equal to "1". is equal to "2", e.g. ORCL1, ORCL2.
5) change the location of control file in parameter file
local drive to shared cluster file system location
ie control_files='/control01.ctl'
to ie control_files='/control01.ctl'
6) create spfile from pfile( spfile should be stored in shared device)
export ORACLE_SID=ORCL1
sqlplus "/ as sysdba"
create spfile='/spfileORCL.ora' from pfile='/tmp/initORCL.ora';
exit
7) Create the $ORACLE_HOME/dbs/init.ora e.g. initORCL1.ora file that contains the following entry
spfile='spfile_path_name'
spfile_path_name is the complete path name of the SPFILE.
example :-
spfile='/cfs/spfile/spfileORCL1.ora'
8) create new password file for ORCL1 instance.
orapwd file=orapwORCL1 password=oracle
9) start the database in mount stage
10) Rename the datafile,redo logs to new shared device
alter database rename file '' to '<new shared="" location="" path';=""
11) Add second instance redo logs (or more when multiple instances will be started)
alter database
add logfile thread 2
group 3 ('<shared location="" redo2_01_100.dbf')="" size="" 100m,="" group 4 ('<shared location="" redo2_02_100.dbf')="" size="" 100m;=""
alter database enable public thread 2;
12) create the second (or more) instance undo tablespace from existing instance
Path and file name will different for your environment
CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE
'/dev/RAC/undotbs_02_210.dbf' SIZE 200M ;
13)
Open your database (i.e. alter database open;) and run
$ORACLE_HOME/rdbms/admin/catclust.sql to create cluster database
specific views within the existing instance
2. On the second node and other nodes
14) Set ORACLE_SID and ORACLE_HOME environment variables on the second node
15) Create the $ORACLE_HOME/dbs/init.ora e.g. initORCL2.ora file for the second node the same way as with point 7.
16) create new password file for second instance ORCL2 instance as in point 8
orapwd file=orapwORCL2 password=oracle
17) Start the second Instance
3. on one of the nodes
18) After configuring the listener,you have to add the database in cluster as below
srvctl add instance -d -i -n
srvctl add instance -d -i -n
19) in case ASM is used, add the rdbms instance / asm dependency, e.g.
整個單機到RAC的轉換過程時間並不長,提前測試和準備好初始化引數檔案、執行指令碼將進一步縮短這部分時間。
更多單機Database轉換為RAC Database的內容請參考文章《How to Convert 10g Single-Instance database to 10g RAC using Manual Conversion procedure (Doc ID 747457.1)》,該文章適用於10g+的資料庫。
完成單機到RAC的轉換後,後續完成調整DG引數,調整IP地址等工作即完成了資料庫的跨平臺遷移和從單機到RAC的轉換工作。
--end--
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26870952/viewspace-2146369/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 利用RMAN跨平臺遷移資料庫資料庫
- 跨平臺遷移oracle資料庫指南Oracle資料庫
- 使用RMAN完成跨平臺資料遷移
- Oracle 利用RMAN 完成資料遷移Oracle
- 大型資料庫跨平臺遷移總結資料庫
- ORACLE 跨平臺遷移方法Oracle
- 資料庫中跨平臺遷移方法介紹資料庫
- RMAN同位元組序跨平臺跨版本遷移資料庫資料庫
- 跨 OS 平臺遷移 Oracle DBOracle
- 利用RMAN Convert database特性進行跨平臺遷移資料Database
- Oracle 11gR2 Database和Active Data Guard遷移案例OracleDatabase
- rman進行跨平臺資料遷移
- RMAN同位元組序跨平臺跨版本遷移資料庫(一)資料庫
- RMAN同位元組序跨平臺跨版本遷移資料庫(二)資料庫
- hp-ux利用rman將資料庫跨平臺遷移到aix平臺上UX資料庫AI
- 12c跨平臺完成PDB的備份遷移
- zt 跨平臺 跨版本 大規模資料遷移
- DATA GUARD 跨平臺支援(Redo Apply)APP
- 資料庫跨平臺遷移方法彙總 (for EBS, Oracle10.2, 11.2)資料庫Oracle
- 應用RMAN Transportable Database進行資料庫跨平臺遷移Database資料庫
- Oracle跨平臺遷移的簡單總結Oracle
- 一個跨平臺資料遷移的方案優化優化
- RMAN備份恢復典型案例——跨平臺遷移pdb
- 利用CONVERT實現跨平臺表空間遷移
- 同位元組序跨平臺資料庫遷移和升級的測試資料庫
- 用傳輸表空間跨平臺遷移資料
- 利用RMAN建立10GRAC資料庫的DATA GUARD資料庫
- sqlldr 完成mysql到oracle的資料遷移MySqlOracle
- 跨平臺遷移支援檢視
- 利用拷貝data目錄檔案的方式遷移mysql資料庫MySql資料庫
- ORACLE資料庫遷移Oracle資料庫
- Oracle Data Guard 支援的異構平臺 說明Oracle
- 利用可傳輸表空間跨平臺遷移 -RMAN CONVERT
- 9i 克隆+data guard 實現資料庫搬遷資料庫
- 亞馬遜宣佈永久關閉 Oracle 資料庫:已完成遷移亞馬遜Oracle資料庫
- 資料庫-oracle-資料庫遷移資料庫Oracle
- datapump跨平臺升級遷移的總結
- Oracle資料庫資料遷移流程Oracle資料庫