[20201110]How to get the Data Guard broker configuration from a SQL query.txt

lfree發表於2020-11-10

[20201110]How to get the Data Guard broker configuration from a SQL query.txt

--//連結:
--//介紹一種方法如果設定dg broker的情況下,可以透過sql語句查詢,做一個記錄:

SYS@xxxx1> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SELECT piv.*, obj.status
  FROM (SELECT object_id, attribute, VALUE
          FROM x$drc
         WHERE object_id IN (SELECT object_id
                               FROM x$drc
                              WHERE attribute = 'DATABASE')) drc PIVOT (MAX
                                                                        (
                                                                           VALUE
                                                                        )
                                                                    FOR attribute
                                                                    IN ('DATABASE' DATABASE
                                                                      ,'intended_state' intended_state
                                                                      ,'connect_string' connect_string
                                                                      ,'RAC' RAC
                                                                      ,'enabled' enabled
                                                                      ,'role' role
                                                                      ,'receive_from' receive_from
                                                                      ,'ship_to' ship_to
                                                                      ,'dgb_connect' dgb_connect
                                                                      ,-- 'static_connect_identifier'    static_connect_identifier    ,
                                                                       'FSFOTargetValidity' FSFOTargetValidity)) piv
       JOIN x$drc obj
          ON (obj.object_id = piv.object_id AND obj.attribute = 'DATABASE');

SYS@xxxx1> @ &r/prxx
==============================
OBJECT_ID                     : 16842752
DATABASE                      : xxxx
INTENDED_STATE                : READ-WRITE-XPTON
CONNECT_STRING                : xxxx
RAC                           : YES
ENABLED                       : YES
ROLE                          : PRIMARY
RECEIVE_FROM                  :
SHIP_TO                       :
DGB_CONNECT                   :
FSFOTARGETVALIDITY            :
STATUS                        : SUCCESS
==============================
OBJECT_ID                     : 33619968
DATABASE                      : xxxxdg
INTENDED_STATE                : PHYSICAL-APPLY-ON
CONNECT_STRING                : xxxxdg
RAC                           : NO
ENABLED                       : YES
ROLE                          : PHYSICAL
RECEIVE_FROM                  :
SHIP_TO                       :
DGB_CONNECT                   :
FSFOTARGETVALIDITY            :
STATUS                        : SUCCESS
==============================
OBJECT_ID                     : 50397184
DATABASE                      : xxxxdg2
INTENDED_STATE                : OFFLINE
CONNECT_STRING                : xxxxdg2
RAC                           : NO
ENABLED                       : NO
ROLE                          : PHYSICAL
RECEIVE_FROM                  :
SHIP_TO                       :
DGB_CONNECT                   :
FSFOTARGETVALIDITY            :
STATUS                        : SHUTDOWN
PL/SQL procedure successfully completed.

--//有一臺機器offline,馬上檢檢視看。
         

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

相關文章