[20151022]dataguard備庫與修改RMAN的配置

lfree發表於2015-10-25
[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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章