RAC环境下的归档模式切换与单实例稍有不同,主要是共享存储所产生的差异。在这种情况下,我们可以将RAC数据库切换到非集群状态下,仅仅在一个实例上
来实施归档模式切换即可完成RAC数据库的归档模式转换问题。本文主要描述了由非归档模式切换到归档模式,而由非归档切换的归档步骤相同,不再赘述。
-
1、主要步骤:
-
备份spfile,以防止参数修改失败导致数据库无法启动
-
修改集群参数cluster_database为false
-
启动单实例到mount状态
-
将数据库置于归档模式(alter database archivelog/noarchivelog)
-
修改集群参数cluster_database为true
-
关闭单实例
-
启动集群数据库
-
-
2、环境
-
oracle@bo2dbp:~> cat /etc/issue
-
-
Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).
-
-
oracle@bo2dbp:~> sqlplus -v
-
-
SQL*Plus: Release 10.2.0.3.0 - Production
-
-
使用asm存储方式存放归档日志
-
-
3、修改集群数据库到归档模式
-
oracle@bo2dbp:~> export ORACLE_SID=ora10g1
-
oracle@bo2dbp:~> sqlplus / as sysdba
-
-
SQL*Plus: Release 10.2.0.3.0 - Production on Mon Dec 24 16:53:18 2012
-
-
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
-
-
Connected to:
-
Oracle Database 10g Release 10.2.0.3.0 - 64bit Production
-
With the Real Application Clusters option
-
-
SQL> archive log list;
-
Database log mode No Archive Mode
-
Automatic archival Disabled
-
Archive destination USE_DB_RECOVERY_FILE_DEST
-
Oldest online log sequence 59
-
Current log sequence 60
-
-
SQL> select instance_name,host_name,status from gv$instance;
-
-
INSTANCE_NAME HOST_NAME STATUS
-
-
ora10g1 bo2dbp OPEN
-
ora10g2 bo2dbs OPEN
-
-
SQL> show parameter cluster
-
-
NAME TYPE VALUE
-
-
cluster_database boolean TRUE
-
cluster_database_instances integer 2
-
cluster_interconnects string
-
-
SQL> create pfile='/u01/oracle/db/dbs/ora10g_robin.ora' from spfile;
-
-
File created.
-
-
SQL> alter system set cluster_database=false scope=spfile sid='*';
-
-
System altered.
-
-
oracle@bo2dbp:~> srvctl stop database -d ora10g
-
oracle@bo2dbp:~> srvctl start instance -d ora10g -i ora10g1 -o mount
-
oracle@bo2dbp:~> sqlplus / as sysdba
-
SQL> select instance_name,status from v$instance;
-
-
INSTANCE_NAME STATUS
-
-
MOUNTED
-
-
SQL> alter database archivelog;
-
-
Database altered.
-
alter system set log_archive_dest_1='location=/oracle/app/ora10g1' scope=spfile sid='ora10g1';
-
alter system set log_archive_dest_1='location=/oracle/app/ora10g2' scope=spfile sid='ora10g2';
-
-
SQL> alter system set cluster_database=true scope=spfile sid='*';
-
-
System altered.
-
-
SQL> ho srvctl stop instance -d ora10g -i ora10g1
-
-
SQL> ho srvctl start database -d ora10g
-
-
SQL> archive log list;
-
ORA-03135: connection lost contact
-
SQL> conn / as sysdba
-
Connected.
-
SQL> archive log list;
-
Database log mode Archive Mode
-
Automatic archival Enabled
-
Archive destination USE_DB_RECOVERY_FILE_DEST
-
Oldest online log sequence 60
-
Next log sequence to archive 61
-
Current log sequence 61
-
-
SQL> show parameter db_recovery_file
-
-
NAME TYPE VALUE
-
-
db_recovery_file_dest string +REV
-
db_recovery_file_dest_size big integer 2G
-
-
4、归档验证
-
SQL> select inst_id,name,thread#,sequence#,status from gv$archived_log;
-
-
no rows selected
-
-
SQL> alter system switch logfile;
-
-
System altered.
-
-
SQL> col name format a65
-
SQL> select inst_id,name,thread#,sequence#,status from gv$archived_log;
-
-
INST_ID NAME THREAD# SEQUENCE# S
-
-
1 +REV/ora10g/archivelog/2012_12_24/thread_1_seq_61.459.802892953 1 61
-
-
SQL> select name,thread#,sequence#,status from v$archived_log;
-
-
NAME THREAD# SEQUENCE# S
-
-
+REV/ora10g/archivelog/2012_12_24/thread_1_seq_61.459.802892953 1 61 A
-
-
SQL> conn system/oracle@ora10g2
-
Connected.
-
SQL> show parameter instance_name;
-
-
NAME TYPE VALUE
-
-
instance_name string ora10g2
-
SQL> alter system switch logfile;
-
-
System altered.
-
SQL> select inst_id,name,thread#,sequence#,status from gv$archived_log;
-
-
-
INST_ID NAME THREAD# SEQUENCE# S
-
-
1 +REV/ora10g/archivelog/2012_12_24/thread_1_seq_61.459.802892953 1 61 A
-
1 +REV/ora10g/archivelog/2012_12_24/thread_2_seq_43.458.802893283 2 43 A
-
2 +REV/ora10g/archivelog/2012_12_24/thread_1_seq_61.459.802892953 1 61 A
-
2 +REV/ora10g/archivelog/2012_12_24/thread_2_seq_43.458.802893283 2 43 A
-
-
-
-
-
SQL> select * from v$log;
-
-
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
-
-
1 1 62 52428800 2 NO CURRENT 4314741 24-DEC-12
-
2 1 61 52428800 2 YES ACTIVE 4312116 24-DEC-12
-
3 2 43 52428800 2 YES ACTIVE 4312300 24-DEC-12
-
4 2 44 52428800 2 NO CURRENT 4315097 24-DEC-12
-
-
-
-
-
-
SQL> alter system archive log current;
-
-
System altered.
-
-
-
-
SQL> select inst_id,name,thread#,sequence#,status from gv$archived_log;
-
-
INST_ID NAME THREAD# SEQUENCE# S
-
-
2 +REV/ora10g/archivelog/2012_12_24/thread_1_seq_61.459.802892953 1 61 A
-
2 +REV/ora10g/archivelog/2012_12_24/thread_2_seq_43.458.802893283 2 43 A
-
2 +REV/ora10g/archivelog/2012_12_24/thread_2_seq_44.456.802894343 2 44 A
-
2 +REV/ora10g/archivelog/2012_12_24/thread_1_seq_62.457.802894341 1 62 A
-
1 +REV/ora10g/archivelog/2012_12_24/thread_1_seq_61.459.802892953 1 61 A
-
1 +REV/ora10g/archivelog/2012_12_24/thread_2_seq_43.458.802893283 2 43 A
-
1 +REV/ora10g/archivelog/2012_12_24/thread_2_seq_44.456.802894343 2 44 A
-
1 +REV/ora10g/archivelog/2012_12_24/thread_1_seq_62.457.802894341 1 62 A
-
-
8 rows selected.
阅读(1312) | 评论(0) | 转发(0) |