Oracle RAC 归档 与 非归档 切换
Oracle 的生产库都是启动在归档模式下,RAC下归档非归档的切换和单实例也是一样的,都是在MOUNT模式下执行ALTER DATABASE ARCHIVELOG/NOARCHIVELOG;命令。 不同的是:RAC环境下所有实例都必须处于非OPEN状态,然后在任意一个处于MOUNT状态的实例执行ALTER DATABASE命令,操作成功后,再正常启动其它实例即可。
注意:RAC数据库由于拥有多个实例,要注意每个实例相关初始化参数:LOG_ARCHIVE_DEST_n的设置,务必需要确保该参数设置的路径合法有效,归档也能顺利进行。
切换示例:
[oracle@raw1 dbs]$ export ORACLE_SID=raw1
[oracle@raw1 dbs]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Apr 19 16:17:43 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 21
Current log sequence 22
SQL>
SQL> select inst_id,instance_name,version,archiver,status from gv$instance;
INST_ID INSTANCE_NAME VERSION ARCHIVE STATUS
---------- ---------------- ----------------- -------------- ------------
1 raw1 10.2.0.1.0 STOPPED OPEN
2 raw2 10.2.0.1.0 STOPPED OPEN
修改归档的默认路径:
SQL> alter system set log_archive_dest_1='location=/u01/raw1arch' sid='raw1';
System altered.
SQL> alter system set log_archive_dest_1='location=/u01/raw2arch' sid='raw2';
System altered.
SQL> show parameter log_archive
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_config string
log_archive_dest string
log_archive_dest_1 string location=/u01/raw2arch
... ....
log_archive_dest_state_1 string enable
... ....
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_duplex_dest string
log_archive_format string %t_%s_%r.dbf
log_archive_local_first boolean TRUE
log_archive_max_processes integer 2
log_archive_min_succeed_dest integer 1
log_archive_start boolean FALSE
log_archive_trace integer 0
切换归档模式:
注意事项: 所有节点都必须处于mount状态。 在其中一个节点修改模式,然后在其他节点正常启动即可。
SQL> startup mount;
ORACLE instance started.
Total System Global Area 184549376 bytes
Fixed Size 1218412 bytes
Variable Size 113248404 bytes
Database Buffers 67108864 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/raw2arch
Oldest online log sequence 14
Next log sequence to archive 15
Current log sequence 15
启动另一个节点,查看状态:
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/raw1arch
Oldest online log sequence 21
Next log sequence to archive 22
Current log sequence 22
SQL>
至此,现在RAC 已经切换到归档模式了。
二. 切换成非归档
在一台主机上执行:
SQL>ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=SPFILE;
在两台主机上执行:
SQL>shutdown immediate;
在一台主机上执行:
SQL>startup mount;
SQL>alter database noarchivelog;
SQL>ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE;
SQL>shutdown immediate;
在两台主机上执行:
SQL>STARTUP
转:http://blog.csdn.net/tianlesoftware/article/details/5501184