記錄一次9i單節點轉rac,以及一套rac儲存遷移之後的整體容災方案

rongshiyuan發表於2012-10-30

記錄一次9i單節點轉rac,以及一套rac儲存遷移之後的整體容災方案

http://www.dbaliu.com/?p=259

資料庫版本9.2.0.1 OS版本 AIX5

由於9.2.0.1的預設maxlogfiles 為5 maxinstance 為1所以需要重建controlfile 修改maxinstance為4 maxlogfiles 為 16

SQL> alter database backup controlfile to trace;

cd $ORACLE_BASE/admin/priap/udump/

檢視最新的trace檔案 priap_ora_143648.trc

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE “PRIAP” NORESETLOGS NOARCHIVELOG
— SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 5 —–>(16)
MAXLOGMEMBERS 3
MAXDATAFILES 309
MAXINSTANCES 1 ——>(4)
MAXLOGHISTORY 5445
LOGFILE
GROUP 1 ‘/dev/rredo01′ SIZE 100M,
GROUP 2 ‘/dev/rredo02′ SIZE 100M,
GROUP 3 ‘/dev/rredo03′ SIZE 100M
— STANDBY LOGFILE
DATAFILE
‘/dev/rsystem01′,
‘/dev/rundotbs01′,
‘/dev/rcwmlite01′,
‘/dev/rPRIAP_INDEX16′
‘/dev/rdksh01′,
‘/dev/rdksh02′,
‘/dev/rDOGPHOTO’,
‘/dev/rdrsys01′,
‘/dev/rindx01′,
‘/dev/rlogmnr01′,
‘/dev/rodm01′,
‘/dev/rPRIAP01′,
‘/dev/rPRIAP02′,
‘/dev/rPRIAP04′,
‘/dev/rPRIAP06′,
‘/dev/rPRIAP19′,
‘/dev/rPRIAP18′,
‘/dev/rPRIAP17′,
‘/dev/rPRIAP16′,
‘/dev/rPRIAP15′,
‘/dev/rPRIAP14′,
‘/dev/rPRIAP13′,
‘/dev/rPRIAP12′,
‘/dev/rPRIAP11′,
‘/dev/rPRIAP43′,
‘/dev/rPRIAP42′,
‘/dev/rPRIAP41′,
‘/dev/rPRIAP40′,
‘/dev/rPRIAP29′,
‘/dev/rPRIAP28′,
‘/dev/rPRIAP27′,
‘/dev/rPRIAP26′,
‘/dev/rPRIAP25′,
‘/dev/rPRIAP24′,
‘/dev/rPRIAP23′,
‘/dev/rPRIAP22′,
‘/dev/rPRIAP21′,
‘/dev/rPRIAP20′,
‘/dev/rPRIAP10′,
‘/dev/rPRIAP09′,
‘/dev/rPRIAP08′,
‘/dev/rPRIAP53′,
‘/dev/rPRIAP52′,
‘/dev/rPRIAP51′,
‘/dev/rPRIAP50′,
‘/dev/rPRIAP49′,
‘/dev/rPRIAP48′,
‘/dev/rPRIAP47′,
‘/dev/rPRIAP46′,
‘/dev/rPRIAP45′,
‘/dev/rPRIAP70′,
‘/dev/rPRIAP69′,
‘/dev/rPRIAP68′,
‘/dev/rPRIAP67′,
‘/dev/rPRIAP66′,
‘/dev/rPRIAP65′,
‘/dev/rPRIAP64′,
‘/dev/rPRIAP63′,
‘/dev/rPRIAP62′,
‘/dev/rPRIAP87′,
‘/dev/rPRIAP86′,
‘/dev/rPRIAP85′,
‘/dev/rPRIAP84′,
‘/dev/rPRIAP83′,
‘/dev/rPRIAP82′,
‘/dev/rPRIAP81′,
‘/dev/rPRIAP80′,
‘/dev/rPRIAP79′,
‘/dev/rPRIAP95′,
‘/dev/rPRIAP94′,
‘/dev/rPRIAP93′,
‘/dev/rPRIAP92′,
‘/dev/rPRIAP91′,
‘/dev/rPRIAP90′,
‘/dev/rPRIAP89′,
‘/dev/rPRIAP88′,
‘/dev/rPRIAP78′,
‘/dev/rPRIAP77′,
‘/dev/rPRIAP76′,
‘/dev/rPRIAP75′,
‘/dev/rPRIAP74′,
‘/dev/rPRIAP73′,
‘/dev/rPRIAP72′,
‘/dev/rPRIAP71′,
‘/dev/rPRIAP61′,
‘/dev/rPRIAP60′,
‘/dev/rPRIAP59′,
‘/dev/rPRIAP58′,
‘/dev/rPRIAP57′,
‘/dev/rPRIAP56′,
‘/dev/rPRIAP55′,
‘/dev/rPRIAP54′,
‘/dev/rPRIAP44′,
‘/dev/rPRIAP39′,
‘/dev/rPRIAP38′,
‘/dev/rPRIAP37′,
‘/dev/rPRIAP36′,
‘/dev/rPRIAP35′,
‘/dev/rPRIAP34′,
‘/dev/rPRIAP33′,
‘/dev/rPRIAP32′,
‘/dev/rPRIAP31′,
‘/dev/rPRIAP30′,
‘/dev/rPRIAP07′,
‘/dev/rPRIAP05′,
‘/dev/rPRIAP03′,
‘/dev/rPRIAP21-01′,
‘/dev/rpriap21-02′,
‘/dev/rPRIAP22-01′,
‘/dev/rPRIAP22-02′,
‘/dev/rPRIAP23-01′,
‘/dev/rPRIAP23-02′,
‘/dev/rPRIAP24-01′,
‘/dev/rPRIAP24-02′,
‘/dev/rPRIAP_INDEX01′,
‘/dev/rPRIAP_INDEX04′,
‘/dev/rPRIAP_INDEX31′,
‘/dev/rPRIAP_INDEX30′,
‘/dev/rPRIAP_INDEX29′,
‘/dev/rPRIAP_INDEX24′,
‘/dev/rPRIAP_INDEX23′,
‘/dev/rPRIAP_INDEX22′,
‘/dev/rPRIAP_INDEX21′,
‘/dev/rPRIAP_INDEX20′,
‘/dev/rPRIAP_INDEX18′,
‘/dev/rPRIAP_INDEX79′,
‘/dev/rPRIAP_INDEX78′,
‘/dev/rPRIAP_INDEX77′,
‘/dev/rPRIAP_INDEX76′,
‘/dev/rPRIAP_INDEX75′,
‘/dev/rPRIAP_INDEX74′,
‘/dev/rPRIAP_INDEX73′,
‘/dev/rPRIAP_INDEX72′,
‘/dev/rPRIAP_INDEX71′,
‘/dev/rPRIAP_INDEX70′,
‘/dev/rPRIAP_INDEX69′,
‘/dev/rPRIAP_INDEX68′,
‘/dev/rPRIAP_INDEX67′,
‘/dev/rPRIAP_INDEX66′,
‘/dev/rPRIAP_INDEX65′,
‘/dev/rPRIAP_INDEX64′,
‘/dev/rPRIAP_INDEX63′,
‘/dev/rPRIAP_INDEX62′,
‘/dev/rPRIAP_INDEX61′,
‘/dev/rPRIAP_INDEX60′,
‘/dev/rPRIAP_INDEX59′,
‘/dev/rPRIAP_INDEX58′,
‘/dev/rPRIAP_INDEX57′,
‘/dev/rPRIAP_INDEX56′,
‘/dev/rPRIAP_INDEX55′,
‘/dev/rPRIAP_INDEX54′,
‘/dev/rPRIAP_INDEX53′,
‘/dev/rPRIAP_INDEX52′,
‘/dev/rPRIAP_INDEX51′,
‘/dev/rPRIAP_INDEX50′,
‘/dev/rPRIAP_INDEX49′,
‘/dev/rPRIAP_INDEX48′,
‘/dev/rPRIAP_INDEX47′,
‘/dev/rPRIAP_INDEX46′,
‘/dev/rPRIAP_INDEX45′,
‘/dev/rPRIAP_INDEX44′,
‘/dev/rPRIAP_INDEX43′,
‘/dev/rPRIAP_INDEX42′,
‘/dev/rPRIAP_INDEX41′,
‘/dev/rPRIAP_INDEX40′,
‘/dev/rPRIAP_INDEX36′,
‘/dev/rPRIAP_INDEX35′,
‘/dev/rPRIAP_INDEX34′,
‘/dev/rPRIAP_INDEX33′,
‘/dev/rPRIAP_INDEX32′,
‘/dev/rPRIAP_INDEX17′,
‘/dev/rPRIAP_INDEX15′,
‘/dev/rPRIAP_INDEX14′,
‘/dev/rPRIAP_INDEX13′,
‘/dev/rPRIAP_INDEX12′,
‘/dev/rPRIAP_INDEX11′,
‘/dev/rPRIAP_INDEX10′,
‘/dev/rPRIAP_INDEX09′,
‘/dev/rPRIAP_INDEX39′,
‘/dev/rPRIAP_INDEX38′,
‘/dev/rPRIAP_INDEX37′,
‘/dev/rPRIAP_INDEX28′,
‘/dev/rPRIAP_INDEX27′,
‘/dev/rPRIAP_INDEX26′,
‘/dev/rPRIAP_INDEX25′,
‘/dev/rPRIAP_INDEX19′,
‘/dev/rPRIAP_INDEX08′,
‘/dev/rPRIAP_INDEX07′,
‘/dev/rPRIAP_INDEX06′,
‘/dev/rPRIAP_INDEX05′,
‘/dev/rPRIAP_INDEX03′,
‘/dev/rPRIAP_INDEX02′,
‘/dev/rPRIAP_LOG01′,
‘/dev/rPRIAP_LOG02′,
‘/dev/rPRIAP_LOG69′,
‘/dev/rPRIAP_LOG68′,
‘/dev/rPRIAP_LOG67′,
‘/dev/rPRIAP_LOG66′,
‘/dev/rPRIAP_LOG65′,
‘/dev/rPRIAP_LOG64′,
‘/dev/rPRIAP_LOG63′,
‘/dev/rPRIAP_LOG62′,
‘/dev/rPRIAP_LOG16′,
‘/dev/rexample01′,
‘/dev/rPRIAP_LOG72′,
‘/dev/rPRIAP_LOG71′,
‘/dev/rPRIAP_LOG70′,
‘/dev/rPRIAP_LOG15′,
‘/dev/rPRIAP_LOG14′,
‘/dev/rPRIAP_LOG13′,
‘/dev/rPRIAP_LOG12′,
‘/dev/rPRIAP_LOG11′,
‘/dev/rPRIAP_LOG10′,
‘/dev/rPRIAP_LOG09′,
‘/dev/rPRIAP_LOG08′,
‘/dev/rPRIAP_LOG61′,
‘/dev/rPRIAP_LOG60′,
‘/dev/rPRIAP_LOG59′,
‘/dev/rPRIAP_LOG58′,
‘/dev/rPRIAP_LOG57′,
‘/dev/rPRIAP_LOG56′,
‘/dev/rPRIAP_LOG55′,
‘/dev/rPRIAP_LOG54′,
‘/dev/rPRIAP_LOG53′,
‘/dev/rPRIAP_LOG52′,
‘/dev/rPRIAP_LOG51′,
‘/dev/rPRIAP_LOG50′,
‘/dev/rPRIAP_LOG49′,
‘/dev/rPRIAP_LOG47′,
‘/dev/rPRIAP_LOG46′,
‘/dev/rPRIAP_LOG45′,
‘/dev/rPRIAP_LOG44′,
‘/dev/rPRIAP_LOG43′,
‘/dev/rPRIAP_LOG42′,
‘/dev/rPRIAP_LOG41′,
‘/dev/rPRIAP_LOG40′,
‘/dev/rPRIAP_LOG33′,
‘/dev/rPRIAP_LOG48′,
‘/dev/rPRIAP_LOG32′,
‘/dev/rPRIAP_LOG31′,
‘/dev/rPRIAP_LOG30′,
‘/dev/rPRIAP_LOG29′,
‘/dev/rPRIAP_LOG28′,
‘/dev/rPRIAP_LOG27′,
‘/dev/rPRIAP_LOG26′,
‘/dev/rPRIAP_LOG25′,
‘/dev/rPRIAP_LOG39′,
‘/dev/rPRIAP_LOG38′,
‘/dev/rPRIAP_LOG37′,
‘/dev/rPRIAP_LOG36′,
‘/dev/rPRIAP_LOG35′,
‘/dev/rPRIAP_LOG34′,
‘/dev/rPRIAP_LOG24′,
‘/dev/rPRIAP_LOG23′,
‘/dev/rPRIAP_LOG22′,
‘/dev/rPRIAP_LOG21′,
‘/dev/rPRIAP_LOG20′,
‘/dev/rPRIAP_LOG19′,
‘/dev/rPRIAP_LOG18′,
‘/dev/rPRIAP_LOG17′,
‘/dev/rPRIAP_LOG07′,
‘/dev/rPRIAP_LOG06′,
‘/dev/rPRIAP_LOG05′,
‘/dev/rPRIAP_LOG04′,
‘/dev/rPRIAP_LOG03′,
‘/dev/rtools01′,
‘/dev/rtools04′,
‘/dev/rtools05′,
‘/dev/rtools03′,
‘/dev/rtools02′,
‘/dev/rTS_FZ4_DATA’,
‘/dev/rTS_DATA_APPSYS’,
‘/dev/rTS_FZ4_DEFAULT0′,
‘/dev/rTS_FZ4_DEFAULT1′,
‘/dev/rTS_FZ4_DIC’,
‘/dev/rTS_FZ4_INDEX’,
‘/dev/rTS_IND_APPSYS’,
‘/dev/rusers01′,
‘/dev/rxdb01′,
‘/dev/rxdb02′,
‘/dev/rundotbs03′,
‘/dev/rsystem02′
CHARACTER SET ZHS16GBK
;

新建3個lv 用於controlfile (scontrol01 scontrol02 scontrol03)

修改initpriap.ora (將controlfile 路徑改為’/dev/rscontrol01′,’/dev/rscontrol02′,’/dev/rscontrol03′)

關閉例項 將例項啟動到mount狀態

SQL>shutdown immediate;
SQL>startup nomount;

用上面語句建立controlfile;

Control file created.

SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required

SQL> alter database open;

Database altered.

SQL>

controlfile 重建完畢

單例項轉rac

SQL>shutdown immediate;

關閉資料庫

將rac1 rac2節點原oravg varryoff 將single_inst 節點datavg import至 rac1 rac2 節點.

將datavg 加入hacmp資源組 (將datavg置於concurrent mode)

用rac1 節點開啟資料庫 (指向control01,control02,control03 變為 scontrol01,scontrol02,scontrol01)

修改db_files=500

SQL>alter system set db_files=500 scope=spfile;
SQL>shutdown immediate;
SQL>startup mount;

將資料庫置於mount狀態

新增thread 2 日誌組

SQL>alter database add logfile thread 2 group 4 (‘/dev/rredo11′) size 100M;

SQL>alter database add logfile thread 2 group 5 (‘/dev/rrdeo12′) szie 100M;

SQL>alter database add logfile thread 2 group 6 (‘/dev/rredo13′) size 100M;

開啟資料庫

SQL>alter database open

新增undo tablespace

SQL> create undo tablespace undotbs2 datafile ‘/dev/rundotbs03′ size 25000M;

SQL> alter system set undo_tablespace=’UNDOTBS2′ scope=both sid=’priap2′;

將redo logfile 置於public

SQL> alter database enable public thread 2;

SQL>@catclust.sql 建立rac檢視

將 44 節點開啟資料庫 (control* 變為scontrol*)
同時將spfile中的undo_tablespace指定為undotbs2

SQL>startup;

SQL>select instance_name ,status from gv$instance;

INSTANCE_NAME STATUS
———— ——
priap1 open
priap2 open

開啟listener (rac1,rac2) lsnrctl start

遷移完成.

———————————————————————————————————————————-

下面我們利用9i dataguard 將另外一套rac遷移至新的儲存 (這套rac將和上面那套rac做容災)

遷移思路, 利用rman copy 做一個rac-single_instance 的DG 利用failover 將standby 置為primary 將VG加入hacmp從而利用原rac兩個節點將新庫拉起

遷移步驟:
1.配置dataguard rac3,rac4–single_inst

alter system set log_archive_dest_state_2=defer scope=both sid=’*';
alter system set log_archive_dest_2=’service=priap_dg’ scope=both sid=’*';
alter system set standby_file_management=AUTO scope=both sid=’*';
alter system set fal_client=priap_dg scope=both sid=’*';
alter system set fal_server=priap1,priap2 scope=both sid=’*';

alter system set log_archive_dest_state_2=defer scope=both;
alter system set log_archive_dest_2=’service=priap’ scope=both;
alter system set standby_file_management=AUTO scope=both;
alter system set fal_client=’priap1,priap2′ scope=both;
alter system set fal_server=priap_dg scope=both;

rac3,rac4,single_inst 節點TNS以及listener

rac3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.39)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = priap)
(INSTANCE_NAME = priap2)
)
)

rac4 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.34)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = priap)
(INSTANCE_NAME = priap1)
)
)

single_inst =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.77)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = priap)
)
)

single_inst listener.ora

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = zaxxrkback)(PORT = 1521))
)
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(PROGRAM = extproc)
)
(SID_DESC =
(ORACLE_HOME = /oracle/app/oracle/product/920)
(SID_NAME = priap)
)
)

rac3 listener.ora

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.39)(PORT = 1521))
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = priap)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(SID_NAME = priap2)
)
)

rac4 listener.ora

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.34)(PORT = 1521))
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = priap)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(SID_NAME = priap1)
)
)

2.檢查兩端資料一致性:archive log list (兩端)

3.failover database
(1).檢查歸檔檔案是否連續,是否有gap

在standby庫執行

SQL> select THREAD#,LOW_SEQUENCE#,HIGH_SEQUENCE# from v$archive_gap;

(2).如果步驟1查詢出來紀錄,則在primary庫上執行,否則跳過此步驟

在主庫上執行語句,按步驟1查詢出來的紀錄找出歸檔檔案

SQL> SELECT NAME FROM V$ARCHIVED_LOG WHERE THREAD#=1 AND DEST_ID=1 AND SEQUENCE# BETWEEN XX AND XX;

–如果primary存在,拷貝相應的歸檔到STANDBY資料庫,並註冊.

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE ‘xxx’;

(3).檢查歸檔檔案是否完整

分別在primary/standby執行下列語句:

SQL> select distinct thread#,max(sequence#) over(partition by thread#) a from v$archived_log;

把相差的歸檔複製到待轉換的standby伺服器,並手工register

4.開始做failover

察看standby程式狀態

SQL> select process,client_process,sequence#,status from v$managed_standby;

SQL> alter database recover managed standby database finish force ;

FORCE關鍵字將會停止當前活動的RFS程式,以便立刻執行failover。

SQL> alter database recover managed standby database finish skip standby logfile;

SQL> alter database commit to switchover to primary;

SQL> shutdown immediate

5.將single_inst 節點的datavg掛到rac3,rac4 同時將datavg掛到hacmp中,用rac3節點的initpriap1.ora 開啟資料庫

SQL> create spfile from pfile;
SQL> startup;

rac4節點同時開啟資料庫

SQL> startup;

6.檢視資料庫狀態
SQL> select database_role from v$database;

Failover切換成功

7. 將single_inst 節點掛到rac1,rac2節點 原庫所在儲存,將oravg,oravg2剔除concurrent vg;

8. 啟動priap database ;(rac->單例項)

9. 切換完成

現在我們完成了單節點轉rac 以及另外一套rac的遷移工作,現在需要的工作就是兩套rac之間的容災工作。為了不影響兩套rac之間獨立應用,我們採取ogg單表重做的方式,使用exp的方法指定
SCN載入trail檔案,過程略

以後會推出9i單節點轉10g RAC的文件。

continuing ……

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-747931/,如需轉載,請註明出處,否則將追究法律責任。

相關文章