RAC环境下归档模式修改从10G R2以后,不再修改cluster_database参数,参考链接How To Enable/Disable Archive Logging In RAC Environment for 10.2 and higher version。步骤如下所示:
1. The following steps need to be taken to enable archive logging in a RAC database environment:
-- shutdown immediate all database instances
$ srvctl stop database -d <db_unique_name>
-- startup database in mount mode
$ srvctl start database -d <db_unique_name> -o mount
-- enable archive logging
$ sqlplus / as sysdba
sql> alter database archivelog;
sql> exit;
-- stop database
$ srvctl stop database -d <db_unique_name>
-- restart all database instances
$ srvctl start database -d <db_unique_name>
-- verify archiving is enabled/disabled by means of:
sql> archive log list;
以上是开启RAC环境下归档模式步骤,非归档模式亦然。下面是SuSE11SP3 11gR2RAC环境演示。
1、开启归档
(1)、关闭所有数据库实例
[email protected]:~> srvctl stop database -d ORACLE
[email protected]:~> crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.FRA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.LISTENER.lsnr
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.OCR.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.asm
ONLINE ONLINE jason1 Started
ONLINE ONLINE jason2 Started
ora.gsd
OFFLINE OFFLINE jason1
OFFLINE OFFLINE jason2
ora.net1.network
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.ons
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.registry.acfs
ONLINE ONLINE jason1
ONLINE ONLINE jason2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jason2
ora.cvu
1 ONLINE ONLINE jason1
ora.jason1.vip
1 ONLINE ONLINE jason1
ora.jason2.vip
1 ONLINE ONLINE jason2
ora.oc4j
1 ONLINE ONLINE jason1
ora.oracle.db
1 OFFLINE OFFLINE Instance Shutdown
2 OFFLINE OFFLINE Instance Shutdown
ora.scan1.vip
1 ONLINE ONLINE jason2
(2)、启动数据库实例到mount状态
[email protected]:~> srvctl start database -d ORACLE -o mount
[email protected]:~> crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.FRA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.LISTENER.lsnr
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.OCR.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.asm
ONLINE ONLINE jason1 Started
ONLINE ONLINE jason2 Started
ora.gsd
OFFLINE OFFLINE jason1
OFFLINE OFFLINE jason2
ora.net1.network
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.ons
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.registry.acfs
ONLINE ONLINE jason1
ONLINE ONLINE jason2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jason2
ora.cvu
1 ONLINE ONLINE jason1
ora.jason1.vip
1 ONLINE ONLINE jason1
ora.jason2.vip
1 ONLINE ONLINE jason2
ora.oc4j
1 ONLINE ONLINE jason1
ora.oracle.db
1 ONLINE INTERMEDIATE jason1 Mounted (Closed)
2 ONLINE INTERMEDIATE jason2 Mounted (Closed)
ora.scan1.vip
1 ONLINE ONLINE jason2
[email protected]:~>
(3)、开启归档模式
[email protected]:~> sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 8 19:29:47 2016
Copyright (c) 1982, 2013, 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 8
Current log sequence 9
SQL> alter database archivelog;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[email protected]:~>
(4)、再次关闭数据库实例
切换至grid用户
[email protected]:~> srvctl stop database -d ORACLE
[email protected]:~> crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.FRA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.LISTENER.lsnr
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.OCR.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.asm
ONLINE ONLINE jason1 Started
ONLINE ONLINE jason2 Started
ora.gsd
OFFLINE OFFLINE jason1
OFFLINE OFFLINE jason2
ora.net1.network
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.ons
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.registry.acfs
ONLINE ONLINE jason1
ONLINE ONLINE jason2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jason2
ora.cvu
1 ONLINE ONLINE jason1
ora.jason1.vip
1 ONLINE ONLINE jason1
ora.jason2.vip
1 ONLINE ONLINE jason2
ora.oc4j
1 ONLINE ONLINE jason1
ora.oracle.db
1 OFFLINE OFFLINE Instance Shutdown
2 OFFLINE OFFLINE Instance Shutdown
ora.scan1.vip
1 ONLINE ONLINE jason2
(5)、启动数据库实例
[email protected]:~> srvctl start database -d ORACLE
[email protected]:~> crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.FRA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.LISTENER.lsnr
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.OCR.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.asm
ONLINE ONLINE jason1 Started
ONLINE ONLINE jason2 Started
ora.gsd
OFFLINE OFFLINE jason1
OFFLINE OFFLINE jason2
ora.net1.network
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.ons
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.registry.acfs
ONLINE ONLINE jason1
ONLINE ONLINE jason2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jason2
ora.cvu
1 ONLINE ONLINE jason1
ora.jason1.vip
1 ONLINE ONLINE jason1
ora.jason2.vip
1 ONLINE ONLINE jason2
ora.oc4j
1 ONLINE ONLINE jason1
ora.oracle.db
1 ONLINE ONLINE jason1 Open
2 ONLINE ONLINE jason2 Open
ora.scan1.vip
1 ONLINE ONLINE jason2
[email protected]:~>
(6)、效验数据库归档模式
[email protected]:~> sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 8 19:40:57 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
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 8
Next log sequence to archive 9
Current log sequence 9
SQL>
2、关闭归档
(1)、关闭所有数据库实例
[email protected]:~> srvctl stop database -d ORACLE
[email protected]:~> crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.FRA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.LISTENER.lsnr
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.OCR.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.asm
ONLINE ONLINE jason1 Started
ONLINE ONLINE jason2 Started
ora.gsd
OFFLINE OFFLINE jason1
OFFLINE OFFLINE jason2
ora.net1.network
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.ons
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.registry.acfs
ONLINE ONLINE jason1
ONLINE ONLINE jason2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jason2
ora.cvu
1 ONLINE ONLINE jason1
ora.jason1.vip
1 ONLINE ONLINE jason1
ora.jason2.vip
1 ONLINE ONLINE jason2
ora.oc4j
1 ONLINE ONLINE jason1
ora.oracle.db
1 OFFLINE OFFLINE Instance Shutdown
2 OFFLINE OFFLINE Instance Shutdown
ora.scan1.vip
1 ONLINE ONLINE jason2
(2)、启动数据库到mount状态
[email protected]:~> srvctl start database -d ORACLE -o mount
[email protected]:~> crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.FRA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.LISTENER.lsnr
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.OCR.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.asm
ONLINE ONLINE jason1 Started
ONLINE ONLINE jason2 Started
ora.gsd
OFFLINE OFFLINE jason1
OFFLINE OFFLINE jason2
ora.net1.network
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.ons
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.registry.acfs
ONLINE ONLINE jason1
ONLINE ONLINE jason2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jason2
ora.cvu
1 ONLINE ONLINE jason1
ora.jason1.vip
1 ONLINE ONLINE jason1
ora.jason2.vip
1 ONLINE ONLINE jason2
ora.oc4j
1 ONLINE ONLINE jason1
ora.oracle.db
1 ONLINE INTERMEDIATE jason1 Mounted (Closed)
2 ONLINE INTERMEDIATE jason2 Mounted (Closed)
ora.scan1.vip
1 ONLINE ONLINE jason2
[email protected]:~>
(3)、设置数据库为非归档模式
切换到oracle用户
[email protected]:~> sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 8 19:24:08 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
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 6
Next log sequence to archive 7
Current log sequence 7
SQL> alter database noarchivelog;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[email protected]:~>
(4)、关闭所有数据库实例
切换到grid用户查看状态
[email protected]:~> srvctl stop database -d ORACLE
[email protected]:~> crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.FRA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.LISTENER.lsnr
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.OCR.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.asm
ONLINE ONLINE jason1 Started
ONLINE ONLINE jason2 Started
ora.gsd
OFFLINE OFFLINE jason1
OFFLINE OFFLINE jason2
ora.net1.network
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.ons
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.registry.acfs
ONLINE ONLINE jason1
ONLINE ONLINE jason2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jason2
ora.cvu
1 ONLINE ONLINE jason1
ora.jason1.vip
1 ONLINE ONLINE jason1
ora.jason2.vip
1 ONLINE ONLINE jason2
ora.oc4j
1 ONLINE ONLINE jason1
ora.oracle.db
1 OFFLINE OFFLINE Instance Shutdown
2 OFFLINE OFFLINE Instance Shutdown
ora.scan1.vip
1 ONLINE ONLINE jason2
[email protected]:~>
(5)、再次打开数据库实例
[email protected]:~> srvctl start database -d ORACLE
[email protected]:~> crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.FRA.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.LISTENER.lsnr
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.OCR.dg
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.asm
ONLINE ONLINE jason1 Started
ONLINE ONLINE jason2 Started
ora.gsd
OFFLINE OFFLINE jason1
OFFLINE OFFLINE jason2
ora.net1.network
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.ons
ONLINE ONLINE jason1
ONLINE ONLINE jason2
ora.registry.acfs
ONLINE ONLINE jason1
ONLINE ONLINE jason2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jason2
ora.cvu
1 ONLINE ONLINE jason1
ora.jason1.vip
1 ONLINE ONLINE jason1
ora.jason2.vip
1 ONLINE ONLINE jason2
ora.oc4j
1 ONLINE ONLINE jason1
ora.oracle.db
1 ONLINE ONLINE jason1 Open
2 ONLINE ONLINE jason2 Open
ora.scan1.vip
1 ONLINE ONLINE jason2
[email protected]:~>
(6)、效验归档模式
[email protected]:~> sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 8 19:29:47 2016
Copyright (c) 1982, 2013, 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 8
Current log sequence 9
SQL>
备注:本实验中,数据库归档地址使用默认地址,如需要更换可以通过修改对应日志参数实现。