刚装好11GR2 RAC一般需要将数据库置于归档模式,并且enable flashback database。
这个步骤在以前是需要先设置cluster_database=false的,但11GR2已经变得非常简单,就跟我们操作单实例是一样的了。赞一下。
下面是一个例子,我将归档日志也放在了ASM上,RACTEST1的归档放在+DATA/ARC1下,RACTEST2的归档放到+DATA/ARC2下。
而Flashbask area是需要单独的一个disk group的,所以特地给他创建了个新的DG -- HAOFLASH。
1. under ASM env:
SQL> conn / as sysasm
Connected.
SQL> CREATE DISKGROUP haoflash
2 EXTERNAL REDUNDANCY
3 DISK '/dev/raw/raw3';
Diskgroup created.
SQL> ALTER DISKGROUP data add directory '+DATA/ARC1';
Diskgroup altered.
SQL> ALTER DISKGROUP data add directory '+DATA/ARC2';
Diskgroup altered.
2. under ORACLE env:
SQL> alter system set log_archive_dest_1='location=+DATA/ARC1' scope=spfile sid='RACTEST1';
System altered.
SQL> alter system set log_archive_dest_1='location=+DATA/ARC2' scope=spfile sid='RACTEST2';
System altered.
SQL> alter system set db_recovery_file_dest_size = 4G scope=both sid='*';
System altered.
SQL> alter system set db_recovery_file_dest = '+HAOFLASH' scope=both sid='*';
System altered.
SQL> alter system set db_flashback_retention_target = 1440 scope=both sid='*';
System altered.
3. shutdown all instances:
on racnode1:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@racnode1 raw]$ srvctl status database -d RACTEST
Instance RACTEST1 is not running on node racnode1
Instance RACTEST2 is running on node racnode2
on racnode2:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
这时可以看到节点2已经down了。
[oracle@racnode2 ~]$ srvctl status database -d RACTEST
Instance RACTEST1 is not running on node racnode1
Instance RACTEST2 is not running on node racnode2
[oracle@racnode2 ~]$ crs_stat -t -v|grep db
ora.ractest.db ora....se.type 0/2 0/1 OFFLINE OFFLINE
4.start mount one instance(eg, racnode1) and enable ARCHIVELOG and FLASHBACK
SQL> startup mount
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 650120784 bytes
Database Buffers 192937984 bytes
Redo Buffers 5132288 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database flashback on;
Database altered.
SQL> SELECT LOG_MODE,FLASHBACK_ON FROM V$DATABASE;
LOG_MODE FLASHBACK_ON
------------ ------------------
ARCHIVELOG YES
SQL> alter database open;
Database altered.
5.startup other instances
[oracle@racnode2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 24 16:37:52 2010
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 654315088 bytes
Database Buffers 188743680 bytes
Redo Buffers 5132288 bytes
Database mounted.
Database opened.
[oracle@racnode1 raw]$ crs_stat -t -v|grep db
ora.ractest.db ora....se.type 0/2 0/1 ONLINE ONLINE racnode1
[oracle@racnode1 raw]$ srvctl status database -d RACTEST
Instance RACTEST1 is running on node racnode1
Instance RACTEST2 is running on node racnode2
6.verify
on racnode1:
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA/arc2
Oldest online log sequence 11
Next log sequence to archive 12
Current log sequence 12
on racnode2:
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA/arc2
Oldest online log sequence 11
Next log sequence to archive 12
Current log sequence 12
SQL> alter system switch logfile;
System altered.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA/arc2
Oldest online log sequence 12
Next log sequence to archive 13
Current log sequence 13
SQL> select THREAD#,SEQUENCE#,ARCHIVED from v$archived_log;
THREAD# SEQUENCE# ARC
---------- ---------- ---
2 11 YES
2 12 YES
on racnode1:
SQL> alter system switch logfile;
System altered.
SQL> select THREAD#,SEQUENCE#,ARCHIVED from v$archived_log;
THREAD# SEQUENCE# ARC
---------- ---------- ---
2 11 YES
2 12 YES
1 13 YES