在10grac下,更改歸檔模式不像單機或主/備模式下那麼容易更改,主要是因爲cluster_database參數的緣故。通過將 cluster_database參數從true改爲false,可以順利用更改單機歸檔模式的方式來更改歸檔設置。更改完畢後,再將 cluster_database參數改回true即可。至於歸檔日誌,可以通過nfs共享來保存兩邊共有的歸檔日誌,當然也可以用rman直接各自備各個節點的歸檔日誌,當需要恢復時,再將歸檔日誌合併即可。
歸檔位置說明:
歸檔位置一(本地) | 歸檔位置二(遠程) | |
實例1 | 本地 /prod1_arch | 遠程 /prod2_arch |
實例2 | 本地 /prod2_arch | 遠程 /prod1_arch |
步驟一:配置每個實例的歸檔位置
[root@racr1 ~]# su - oracle
racr1-> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 19 21:58:59 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/app/oracle/product/10.2.0/db_1/dbs/arch
Oldest online log sequence 3
Current log sequence 4
SQL>
SQL> col instance_name format a30
SQL> col host_name format a30
SQL> col status format a30
SQL>
SQL> select instance_name,host_name,status from gv$instance;
INSTANCE_NAME HOST_NAME STATUS
------------------------------ ------------------------------ ------------------------------
PROD1 racr1 OPEN
PROD2 racr2 OPEN
SQL>
SQL> alter system set log_archive_dest_1='location=/prod2_arch' scope = spfile sid='PROD2';
System altered.
SQL>
SQL>
SQL> alter system set log_archive_dest_2='service=prod1' scope = spfile sid='PROD2';
System altered.
SQL>
SQL> alter system set log_archive_dest_1='location=/prod1_arch' scope = spfile sid='PROD1';
System altered.
SQL>
SQL> alter system set log_archive_dest_2='service=prod2' scope = spfile sid='PROD1';
System altered.
SQL>
SQL> alter system set standby_archive_dest='/prod2_arch' scope = spfile sid='PROD1';
System altered.
SQL>
SQL> alter system set standby_archive_dest='/prod1_arch' scope = spfile sid='PROD2';
System altered.
SQL> alter system set cluster_database=false scope = spfile sid='*';
System altered.
SQL>
步驟二:關閉所有實例
racr1-> srvctl stop database -d PROD
步驟三: 在單一實例上面
racr1-> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 19 22:37:24 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2098112 bytes
Variable Size 163580992 bytes
Database Buffers 427819008 bytes
Redo Buffers 6287360 bytes
Database mounted.
SQL> alter system set cluster_database=true scope = spfile sid='*';
System altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> exit
記得修改完屬性後,關閉這個節點,因爲下面我們用srvctl命令開啓數據庫
步驟四:開啓數據庫
racr1-> srvctl start database -d PROD
步驟五:驗證
在2個節點上面切換在線日誌,查看相應的歸檔目錄。
racr2-> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 19 22:33:27 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> alter system switch logfile;
System altered.
SQL> exit
Disconnected from Oracle Database
[root@racr1 prod1_arch]# cd /prod2_arch/
[root@racr1 prod2_arch]# ls
[root@racr1 prod2_arch]#
[root@racr1 prod2_arch]# ls
1_8_850242437.dbf
[root@racr1 prod2_arch]#
[root@racr1 prod2_arch]#
在節點2切換,在節點1也可以看見歸檔日誌。這樣就成功了
racr1-> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 19 22:33:10 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /prod1_arch
Oldest online log sequence 5
Next log sequence to archive 6
Current log sequence 6
SQL>
查看數據庫歸檔狀態。