ITPub博客

首页 > 数据库 > Oracle > Oracle10g RAC下启用归档模式

Oracle10g RAC下启用归档模式

原创 Oracle 作者:kuqlan 时间:2012-06-21 05:09:52 0 删除 编辑

环境:两个节点的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博客 ” ,链接:https://blog.itpub.net/18841027/viewspace-1058607/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle技术爱好者,Oracle10g OCM,网名 KUQLAN ,具有7的年Oracle数据库管理实践,曾经参加过BOSS、ERP、云计算(OpenStack+kvm)等项目的一线工作。以前写博客是为了自己,而现在是为了自己和别人。因为领会了帮助别人和分享、沉淀和积累会创造快乐和价值...

注册时间:2009-01-26

  • 博文量
    183
  • 访问量
    1681002