[20151022]dataguard备库与修改RMAN的配置

[20151022]为什么dataguard的备库上面无法修改RMAN的配置.txt

--昨天有人问这个问题,链接如下:
http://www.itpub.net/thread-1940567-1-1.html

--我自己也测试看看:

1.测试环境:

SCOTT@test> @ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.3.0     Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

DGMGRL> show configuration  verbose
Configuration - study
  Protection Mode: MaxPerformance
  Databases:
    test   - Primary database
    testdg - Physical standby database
  Properties:
    FastStartFailoverThreshold      = '30'
    OperationTimeout                = '30'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

DGMGRL> show database  testdg
Database - testdg
  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds
  Apply Lag:       0 seconds
  Real Time Query: ON
  Instance(s):
    testdg
Database Status:
SUCCESS
--备库应用日志正常。

--备用机器:
RMAN> show RETENTION POLICY;
RMAN configuration parameters for database with db_unique_name TESTDG are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

RMAN> CONFIGURE RETENTION POLICY TO recovery window of 10 days ;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 10/22/2015 09:30:45
RMAN-05021: this configuration cannot be changed for a BACKUP or STANDBY control file

--很明显这个命令不能在dg的rman下执行。

2.不过zergduan指出直接在primary端修改就可以,会自动同步到standby端的.
--关于这点我感觉有点奇怪,这个修改的是控制文件,理论讲不会传递过来的,我在链接下也测试过,不再贴上来。
--但是zergduan的笔记指示是成功,唯一的不同他使用catalog数据库。好奇我自己也建立了catalog数据库测试看看。
--说明1点:我的catalog是建立在主库上,这个不是很好,仅仅是测试(这样数据库坏了,catalog也无法访问),正常应该选择单独的硬
--件。

--在主库上执行:
$ rlwrap rman catalog=rman/rman target=sys/btbtms
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Oct 22 09:22:27 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: TEST (DBID=2071943378)
connected to recovery catalog database

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

--在备库下执行:

$ rlwrap rman  target /
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Oct 22 09:36:29 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: TEST (DBID=2071943378)

RMAN> show RETENTION POLICY;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name TESTDG are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

--可以发现并没有修改备库的rman配置参数。
--如果改成加入catalog数据库登录:

$ rlwrap rman  target / catalog=rman/rman@test
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Oct 22 09:40:15 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: TEST (DBID=2071943378)
connected to recovery catalog database

RMAN> show RETENTION POLICY;
RMAN configuration parameters for database with db_unique_name TESTDG are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

--可以发现这个RETENTION POLICY TO REDUNDANCY 2;

$ rlwrap rman  target /
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Oct 22 09:41:41 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: TEST (DBID=2071943378)
RMAN> show RETENTION POLICY;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name TESTDG are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

--从这些可以看出实际上参数并没有"传递"过来,而是使用catalog记录的rman参数:
SCOTT@test> column VALUE format a30
SCOTT@test> column DB_UNIQUE_NAME format a30
SCOTT@test> select * from rman.CONF where name='RETENTION POLICY';
    DB_KEY      CONF# NAME                 VALUE                          DB_UNIQUE_NAME                   SITE_KEY CLE
---------- ---------- -------------------- ------------------------------ ------------------------------ ---------- ---
         1          5 RETENTION POLICY     TO REDUNDANCY 2                                                        0 NO

3.继续测试:

--在主库下执行(连上catalog数据库):
RMAN>  CONFIGURE RETENTION POLICY TO REDUNDANCY 3 for  db_unique_name "TEST";

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 10/22/2015 09:55:40
RMAN-05036: FOR DB_UNIQUE_NAME option cannot be used for this configuration
--只能说明这个参数不支持FOR DB_UNIQUE_NAME选项。

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP Off for db_unique_name "TEST";
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

--说明1点:test对于rman是关键字,必须加"引号".

--在备库下观察(连上catalog数据库):
RMAN> show CONTROLFILE AUTOBACKUP;
RMAN configuration parameters for database with db_unique_name TESTDG are:
CONFIGURE CONTROLFILE AUTOBACKUP ON;

--可以发现这个参数并没有修改。因为我在主库上是针对"TEST"进行修改。

--在备库下观察(连上catalog数据库):
RMAN> show CONTROLFILE AUTOBACKUP for db_unique_name "test";
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;


SCOTT@test> colum name format a30
SCOTT@test> select * from rman.CONF where name='CONTROLFILE AUTOBACKUP';
    DB_KEY      CONF# NAME                           VALUE                          DB_UNIQUE_NAME                   SITE_KEY CLE
---------- ---------- ------------------------------ ------------------------------ ------------------------------ ---------- ---
         1          5 CONTROLFILE AUTOBACKUP         OFF                            TEST                                    3 NO
         1          4 CONTROLFILE AUTOBACKUP         ON                             TESTDG                                832 NO


--可以发现在使用rman+catalog数据库时参数是从catalog读取的。

4.在主库上执行(没连上catalog数据库)::

$ rlwrap rman  target=sys/btbtms
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Oct 22 10:07:10 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: TEST (DBID=2071943378)

RMAN> show CONTROLFILE AUTOBACKUP;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP On;
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

--现在主库与catalog记录的不一致:

--在主库上执行(连上catalog数据库)::
$ rlwrap rman catalog=rman/rman target=sys/btbtms
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Oct 22 10:48:43 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: TEST (DBID=2071943378)
connected to recovery catalog database

RMAN> show CONTROLFILE AUTOBACKUP;

starting full resync of recovery catalog
full resync complete
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE CONTROLFILE AUTOBACKUP ON;

--注意看提示,会同步更新catalog数据库中配置。
--可以发现在使用rman+catalog数据库时参数不一致,会同步更新catalog数据库中配置。

$ rlwrap rman  target=sys/btbtms
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Oct 22 10:50:03 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: TEST (DBID=2071943378)

RMAN> show CONTROLFILE AUTOBACKUP;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE CONTROLFILE AUTOBACKUP ON;

SCOTT@test> select * from rman.CONF where name='CONTROLFILE AUTOBACKUP';
    DB_KEY      CONF# NAME                           VALUE                          DB_UNIQUE_NAME                   SITE_KEY CLE
---------- ---------- ------------------------------ ------------------------------ ------------------------------ ---------- ---
         1          5 CONTROLFILE AUTOBACKUP         ON                             TEST                                    3 NO
         1          4 CONTROLFILE AUTOBACKUP         ON                             TESTDG                                832 NO

--实际上在这种情况下 参数从catalog数据中来,如果不一致,catalog会同步数据库的配置参数。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-1816213/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/267265/viewspace-1816213/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值