在10g及以前的数据库版本,将非归档的RAC数据库改成归档的RAC数据库,需要将cluster_database先设置为false,然后按单实例的设置归档方法。
在10gR2中和11g,不再需要将cluster_database设置为false,将非归档的RAC数据库改成归档的RAC数据库,方法与单实例设置归档模式是一样的。
如下是Linux上11g的配置过程:
先关闭节点2的实例:
[root@dbserv2 ~]# su - oracle
-bash-3.2$ sqlplus / as sysdba
SQL> show parameter db_reco
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string +FRADG
db_recovery_file_dest_size big integer 8388608
db_recovery_file_dest_size太小,需要配置大一点儿。如果db_recovery_file_dest的也没有值可以通过如下命令配置
alter system set db_recovery_file_dest='/home/oracle/flash' scope=spfile; --/home/oracle/flash看具体情况而定。
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
在节点1上开始配置操作:
[root@dbserv1 ~]# su - oracle
-bash-3.2$ sqlplus / as sysdba
SQL> alter system set db_recovery_file_dest_size=900G;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 12202
Next log sequence to archive 12203
Current log sequence 12203
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
SQL> alter system switch logfile;
System altered.
SQL> alter system archive log current;
System altered.
SQL> show parameter db_reco
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string +FRADG
db_recovery_file_dest_size big integer 900G
SQL> exit
启动节点2的实例:
SQL> startup mount
ORACLE instance started.
Database mounted.
SQL> alter system set db_recovery_file_dest_size=900G; --感觉这一步骤也是没有必要的
System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 10919
Next log sequence to archive 0
Current log sequence 10920
SQL> alter database open;
Database altered.
在操作系统层面切换grid用户后,查看是否生成归档日志;
归档的默认生成位置为 db_recovery_file_dest/instance_name/archivelog/date/下:
-bash-3.2$ su - grid
口令:
[grid@dbserv1 ~]$ asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED NORMAL N 512 4096 1048576 29299 28373 9767 9303 0 Y CRS_DG/
MOUNTED EXTERN N 512 4096 1048576 3145725 1459524 0 1459524 0 N DATADG/
MOUNTED EXTERN N 512 4096 1048576 2217980 2122735 0 2122735 0 N FRADG/
ASMCMD> cd fradg
ASMCMD> cd testdb
ASMCMD> ls
ARCHIVELOG/
CONTROLFILE/
ONLINELOG/
TEMPFILE/
ASMCMD> cd archivelog
ASMCMD> ls
2013_07_10/
ASMCMD> cd 2013_07_10
ASMCMD> ls
thread_1_seq_12203.266.820417985
thread_1_seq_12204.269.820418287
thread_2_seq_10919.264.820417835
thread_2_seq_10920.265.820417837
thread_2_seq_10921.267.820418319
thread_2_seq_10922.268.820418609
ASMCMD> cd ..
ASMCMD> cd ..
说明已有归档数据。有了归档日志后,还需要配置周期清理脚本,要不说不定那天会占满磁盘空间。
另外,如下文档也值得参考。
How To Enable Archive Logging In RAC Environment [ID 1186764.1]Applies to: Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.2.0.2 - Release: 10.1 to 11.2
Information 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
-- startup database in mount mode
$ srvctl start database -d
-- enable archvive logging
$ sqlplus / as sysdba
sql> alter database archivelog;
sql> exit;
-- stop database
$ srvctl stop database -d
-- restart all database instances
$ srvctl start database -d
-- 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).
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/18841027/viewspace-1060705/ ,如需转载,请注明出处,否则将追究法律责任。