Oracle10g RAC下啟用歸檔模式

kuqlan發表於2012-06-21

環境:兩個節點的Oracle10g RAC 環境,資料庫建立在獨立的磁碟陣列上的裸裝置上,資料庫在非歸檔模式中,現在需要改為歸檔模式,具體步驟如下:

在節點1

-bash-3.2$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Wed Jun 20 21:26:57 2012

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 /oracle/product/10.2.0/db/dbs/arch

Oldest online log sequence 94

Current log sequence 96

SQL> alter system set cluster_database=false scope=spfile sid='*';

System altered.

SQL> alter system set log_archive_dest_1='location=/databak/archivelog' scope=spfile sid='*';

System altered.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

[@more@]

在節點2

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

在節點1

SQL> startup mount;

ORACLE instance started.

Total System Global Area 1610612736 bytes

Fixed Size 2096632 bytes

Variable Size 1023410696 bytes

Database Buffers 570425344 bytes

Redo Buffers 14680064 bytes

Database mounted.

SQL> alter database archivelog;

Database altered.

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /databak/archivelog

Oldest online log sequence 94

Next log sequence to archive 96

Current log sequence 96

SQL> alter database open;

Database altered.

SQL> alter system set cluster_database=true scope=spfile sid='*';

System altered.

節點2

SQL> startup mount;

ORACLE instance started.

Total System Global Area 1610612736 bytes

Fixed Size 2096632 bytes

Variable Size 1124073992 bytes

Database Buffers 469762048 bytes

Redo Buffers 14680064 bytes

ORA-01183: cannot mount database in SHARED mode

該提示說明資料庫的cluster_database=true引數因scope=spfile原因只會影響到spfile上,而現有記憶體上的實際狀態為cluster_database=false,因此節點2的例項無法啟動。要讓該引數最新值的生效,需要重啟節點1的例項...

節點1:

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 1610612736 bytes

Fixed Size 2096632 bytes

Variable Size 1040187912 bytes

Database Buffers 553648128 bytes

Redo Buffers 14680064 bytes

Database mounted.

Database opened.

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /databak/archivelog

Oldest online log sequence 94

Next log sequence to archive 96

Current log sequence 96

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

節點2現在可以mount並開啟資料庫:

SQL> shutdown immediate;

ORA-01507: database not mounted

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

Total System Global Area 1610612736 bytes

Fixed Size 2096632 bytes

Variable Size 1124073992 bytes

Database Buffers 469762048 bytes

Redo Buffers 14680064 bytes

Database mounted.

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /databak/archivelog

Oldest online log sequence 44

Next log sequence to archive 46

Current log sequence 46

SQL> alter database archivelog;

alter database archivelog

*

ERROR at line 1:

ORA-01126: database must be mounted in this instance and not open in any

instance

為什麼會提示這個呢?是因為spfile在共享儲存上,而每個節點相應initSID.ora檔案中做了連結,這個有助於兩個例項引數內容不一致導致的一些異常情況的避免。

-bash-3.2$ cd product/10.2.0/db/dbs/

-bash-3.2$ ls

hc_gderp1.dat init.ora initdw.ora inittest1.ora orapwtest1

-bash-3.2$ more inittest1.ora

SPFILE='/dev/raw/raw14'

-bash-3.2$

SQL> alter database open;

Database altered.

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /databak/archivelog

Oldest online log sequence 44

Next log sequence to archive 46

Current log sequence 46

最後分別在連個節點多做幾次alter system switch logfile alter system archive log current操作檢視歸檔是否成功並歸檔到正確位置。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-1058607/,如需轉載,請註明出處,否則將追究法律責任。

相關文章