11g R2 RAC 环境下开启归档模式的方法

来源:互联网 发布:linux软件 编辑:程序博客网 时间:2024/04/28 13:27

方法一

首先来看一下官方的文档:

How To Enable Archive Logging In RAC Environment [ID 1186764.1]转到底部修改时间:2011-6-2类型:HOWTO状态:PUBLISHED优先级:3注释 (0)In this Document  Goal  Solution  ReferencesApplies to:Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.2.0.2 - Release: 10.1 to 11.2Information in this document applies to any platform.GoalHow to enable database archivelog in RAC configuration?SolutionThe 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 archvive logging$ sqlplus / as sysdbasql> 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 by means of:sql> archive log list; You might need to set your log_archive_dest(_n) parameters to a shared location in each spfile, but the log_archive_start parameter does not need to be set anymore as of 10g (see Note 274302.1).To disable archive logging, follow the same steps but use the NOARCHIVELOG clause of the ALTER DATABASE statement.--这儿如果从归档切换回非归档,按照同样的步骤设置为NOARCHIVELOG即可ReferencesNOTE:235158.1 - How To Enable/Disable Archive Log Mode in Real Application Cluster EnvironmentNOTE:274302.1 - ARCHIVELOG mode in Oracle 10g and 11g

归结为如下步骤(包括部分参数的设置,官方文档采用了启动全部实例到mount,这儿只启用一个实例到mount):

$srvctl stop database -d RACDB--节点1sql>startup mountsql>alter system set log_archive_dest_1='LOCATION=/oracleapp/arch' scope=spfile sid='RACDB1';sql>alter system set log_archive_dest_1='LOCATION=/oracleapp/arch' scope=spfile sid='RACDB2';sql>alter system set cluster_database=false scope=spfile;--sql>shutdown immediatesql>startup mountsql>alter database archivelogsql>alter database opensql>alter system set cluster_database=true scope=spfile;--sql>shutdown immediate$srvctl start database -d RACDB

对参数cluster_database的说明:

这个参数的取值是TRUE和FALSE。对于所有实例,这个参数的取值应当设置为TRUE。TRUE值将指引实例在启动期间以共享模式挂载控制文件。
如果一个首先启动的实例将该参数设置为FALSE,那么它将能够以独占模式挂载控制文件。但是这样会禁止所有后台实例启动,如果试图去启动别的实例,

则会收到以下错误:

SQL> startup
ORA-01102: cannot mount database in EXCLUSIVE mode

在以下维护操作期间,必须使用cluster_database=FALSE启动实例:

  • 从无存档日志模式转换为存档日志模式及反向转换。
  • 启用闪回数据库功能。
  • 升级期间。
  • 对系统表空间执行介质恢复。
  • 从Oracle RAC 数据库转换为单实例数据库及反向转换。
这个参数的默认值是FALSE,为了在Oracle RAC环境中启动实例,这个参数必须设置为TRUE。



方法二

这种方法收集来自网络,没有试过,其实本质都一样:

节点1SQL> alter system set log_archive_dest_1='location=/oracleapp/arch' sid='RACDB1';SQL> alter system set log_archive_dest_1='location=/oracleapp/arch' sid='RACDB2';关闭两个节点shutdown immediate然后分别将两个节点开启到mount模式SQL> startup mount节点1SQL> alter database archivelog;SQL> alter database open;节点2SQL> alter database open;

下面是我的实验记录(包括启用归档和关闭归档,操作都在一个节点进行):

SQL> archive log listDatabase log mode              No Archive ModeAutomatic archival             DisabledArchive destination            USE_DB_RECOVERY_FILE_DESTOldest online log sequence     337Current log sequence           338SQL> alter system  set cluster_database=false scope=spfile;System altered.SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing options[oracle@rac121 ~]$ srvctl stop database -d racdb[oracle@rac121 ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.3.0 Production on 星期五 8月 31 15:16:23 2012Copyright (c) 1982, 2011, Oracle.  All rights reserved.Connected to an idle instance.SQL> startup mountORACLE instance started.Total System Global Area 1.3462E+10 bytesFixed Size                  2241104 bytesVariable Size            7281315248 bytesDatabase Buffers         6174015488 bytesRedo Buffers                4485120 bytesDatabase mounted.SQL> alter database archivelog;Database altered.SQL> alter system set cluster_database=true scope=spfile;System altered.SQL> shutdown immediateORA-01109: 数据库未打开Database dismounted.ORACLE instance shut down.SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing options[oracle@rac121 ~]$ srvctl  start database -d racdb[oracle@rac121 ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.3.0 Production on 星期五 8月 31 15:18:42 2012Copyright (c) 1982, 2011, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing optionsSQL> archive log listDatabase log mode              Archive ModeAutomatic archival             EnabledArchive destination            USE_DB_RECOVERY_FILE_DESTOldest online log sequence     337Next log sequence to archive   338Current log sequence           338SQL> alter system set cluster_database=false scope=spfile;System altered.SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing options[oracle@rac121 ~]$ srvctl stop database -d racdb[oracle@rac121 ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.3.0 Production on 星期五 8月 31 15:19:45 2012Copyright (c) 1982, 2011, Oracle.  All rights reserved.Connected to an idle instance.SQL> startup mountORACLE instance started.Total System Global Area 1.3462E+10 bytesFixed Size                  2241104 bytesVariable Size            7281315248 bytesDatabase Buffers         6174015488 bytesRedo Buffers                4485120 bytesDatabase mounted.SQL> alter database noarchivelog ;Database altered.SQL> alter  system set cluster_database=true scope=spfile;System altered.SQL> shutdown immediateORA-01109: 数据库未打开Database dismounted.ORACLE instance shut down.SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing options[oracle@rac121 ~]$ srvctl start database -d racdb[oracle@rac121 ~]$ sqlplus / as  sysdbaSQL*Plus: Release 11.2.0.3.0 Production on 星期五 8月 31 15:21:40 2012Copyright (c) 1982, 2011, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing optionsSQL> archive log listDatabase log mode              No Archive ModeAutomatic archival             DisabledArchive destination            USE_DB_RECOVERY_FILE_DESTOldest online log sequence     338Current log sequence           339SQL> 



原创粉丝点击