本实验有两个节点 rac01test,rac02test
oracle_sid 分别是 xedb01,xedb02




1.在节点1 rac01test 上执行


[root@rac01test bin]# su - grid
[grid@rac01test ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Oct 27 10:09:43 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> select name from v$asm_diskgroup;

NAME
------------------------------
OCR_VOTE
DATADG01
ARCH_DG

SQL> alter diskgroup ARCH_DG add directory '+ARCH_DG/ARC1';

Diskgroup altered.

2.在节点2 rac02test 上执行


[root@rac02test ~]# su - grid
[grid@rac02test ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Oct 27 10:21:39 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> select name from v$asm_diskgroup;

NAME
------------------------------
OCR_VOTE
DATADG01
ARCH_DG

SQL>  alter diskgroup ARCH_DG add directory '+ARCH_DG/ARC2';

Diskgroup altered.

执行完成后,退出ASM实例

3.在rac01test上执行


[root@rac01test bin]# su - oracle
-bash: [/bin/bash: No such file or directory
[oracle@rac01test ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Oct 27 10:23:31 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
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

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
xedb1

SQL> archive log list;
Database log mode        No Archive Mode
Automatic archival        Disabled
Archive destination        /u01/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence     66
Current log sequence        67

SQL>  alter system set log_archive_dest_1='LOCATION=+ARCH_DG/ARC1' scope=spfile sid='xedb1';
System altered.

SQL>  alter system set log_archive_dest_1='LOCATION=+ARCH_DG/ARC1' scope=spfile sid='xedb2';
System altered.

4.关掉所有节点实例 xedb01,xedb01 数据库


节点 xedb01 上执行

SQL> shutdown immediate

节点 xedb02 上执行

SQL> shutdown immediate

5.更改归档模式


节点 xedb01 上执行

SQL> startup mount
SQL> alter database archivelog;  
Database altered.

节点tip02上执行

SQL> startup mount
SQL> alter database archivelog;  
Database altered.


6.重启数据库


节点xedb01,xedb02上分别执行

SQL> shutdown immediate;
SQL> startup

节点1
SQL> archive log list
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        +ARCH_DG/arc1
Oldest online log sequence     68
Next log sequence to archive   69
Current log sequence        69

节点2
SQL> archive log list;
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        +ARCH_DG/arc2
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence        2


7.验证归档文件


在两个节点上执行

SQL> alter system switch logfile;

System altered.

[root@rac01test bin]# su - grid
[grid@rac01test ~]$ asmcmd

ASMCMD> ls
ARCH_DG/
DATADG01/
OCR_VOTE/
ASMCMD> cd arch_dg
ASMCMD> ls
ARC1/
ARC2/
XEDB/
ASMCMD> cd arc1
1_69_894187568.dbf
ASMCMD> cd arc2
ASMCMD> ls
2_2_894187568.dbf

可以看到两个节点的归档都产生了!