Oracle11gR2 RAC環境歸檔模式的配置案例一則

kuqlan發表於2013-07-10

在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.

[@more@]


在節點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 -o mount

-- 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部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-1060705/,如需轉載,請註明出處,否則將追究法律責任。

相關文章