日期:2014-05-16 浏览次数:20566 次
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 -->查看集群的参数,cluster_database为true表示为集群数据库,否则,非集群数据库 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; -->先备份spfile File created. SQL> alter system set cluster_database=false scope=spfile sid='*'; -->修改为非集群数据库,该参数为静态参数,需要使用scope=spfile System altered. oracle@bo2dbp:~> srvctl stop database -d ora10g -->关闭数据库 oracle@bo2dbp:~> srvctl start instance -d ora10g -i ora10g1 -o mount -->启动单个实例到mount状态 oracle@bo2dbp:~> sqlplus / as sysdba SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ ora10g1 MOUNTED SQL> alter database archivelog; -->改变数据库到归档模式 Database altered. 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 -->归档位置为参数DB_RECOVERY_FILE_DEST的值 Oldest online log sequence 60 -->下面是sequence相关信息 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; -->当前无任何归档日志