数据库版本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 ……