国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

19C?DG?Broker配置和測試

IT那活兒 / 3814人閱讀
19C?DG?Broker配置和測試
一. DG Broker配置

1. DG當前測試環境配置

select name, database_role db_role, controlfile_type cf_type, open_mode, protection_mode, dataguard_broker dg_broker, guard_status, force_logging from v$database;

主庫:

備庫:


2. DG Broker主備庫配置

DB_BROKER_CONFIG_FILEn參數用于指定DataGuard配置文件的路徑,存在默認路徑。

DG_BROKER_START參數設置實例啟動的時候是否自動啟動Broker,需要開啟。

alter system set dg_broker_start=true;

數據庫的archive_dest_n 參數會由DG BROKER自動進行管理,無需人工干預。


3. 創建DataGuard Broker配置

[oracle@db1 /home/oracle]$ dgmgrl sys/oracle@prod
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Thu May 13 20:16:43 2021
Version 19.6.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "prod"
Connected as SYSDBA.
DGMGRL>
create configuration dg_prod as primary database is prod connect identifier is prod;
Configuration "dg_prod" created with primary database "prod"
DGMGRL> add database pstdby as connect identifier is pstdby maintained as physical;
Error: ORA-16698: member has a LOG_ARCHIVE_DEST_n parameter with SERVICE attribute set

Failed.
配置備庫報錯,使用dg broker需要手動清除主備庫的LOG_ARCHIVE_DEST_n參數配置。重啟主庫和備庫即可添加。
DGMGRL>
add database pstdby as connect identifier is pstdby maintained as physical;
Database "pstdby" added

DGMGRL>
enable configuration
Enabled.
DGMGRL>
show configuration;

Configuration - dg_prod

  Protection Mode: MaxPerformance
  Members:
  pstdby - Primary database
    prod - Physical standby database

Fast-Start Failover: Disabled

Configuration Status:
SUCCESS (status updated 46 second ago)

4. Listener和Tnsnames 配置

##主庫listener
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = prod)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = prod)
    )
   (SID_DESC =
      (GLOBAL_DBNAME = prod_DGMGRL)
      (ORACLE_HOME = /database/oracle/product/rdbms/19.3.0)
      (SID_NAME = prod)
    )
  )

#
##備庫listener.ora配置
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = pstdby)
      (ORACLE_HOME = /database/oracle/product/rdbms/19.3.0)
      (SID_NAME = pstdby)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = pstdby_DGMGRL)
      (ORACLE_HOME = /database/oracle/product/rdbms/19.3.0)
      (SID_NAME = pstdby)
    )
  )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = pstdby)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )


###主備庫tnsnames.ora
prod =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.199.71)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = prod)
    )
  )
  
pstdby =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.199.72)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pstdby)
    )
  )


二. switchover及failover

1. switchover

DGMGRL> switchover to pstdby
Performing switchover NOW, please wait...
Operation requires a connection to database "pstdby"
Connecting ...
Connected to "pstdby"
Connected as SYSDBA.
New primary database "pstdby" is opening...
Operation requires start up of instance "prod" on database "prod"
Starting instance "prod"...
Connected to an idle instance.
ORACLE instance started.
Connected to "prod"
Database mounted.
Database opened.
Connected to "prod"
Switchover succeeded, new primary is "pstdby"
 DGMGRL> show configuration

Configuration - dg_prod

  Protection Mode: MaxPerformance
  Members:
  pstdby - Primary database
    prod - Physical standby database

Fast-Start Failover: Disabled

Configuration Status:
SUCCESS (status updated 50 seconds ago)

2. failover

failover命令:
failover to database-name [immediate];

dgmgrl sys/oracle@pstdby
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Thu May 13 23:12:19 2021
Version 19.6.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "pstdby"
Connected as SYSDBA.
DGMGRL>
failover to pstdby
Performing failover NOW, please wait...
Failover succeeded, new primary is "pstdby"
DGMGRL>
show configuration

Configuration - dg_prod

  Protection Mode: MaxPerformance
  Members:
  pstdby - Primary database
    prod - Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated

Fast-Start Failover: Disabled

Configuration Status:
SUCCESS   (status updated 14 seconds ago)

DGMGRL>
reinstate database prod
Reinstating database "prod", please wait...
Oracle Clusterware is restarting database "prod" ...
Connected to "prod"
Connected to "prod"
Continuing to reinstate database "prod" ...
Reinstatement of database "prod" succeeded
DGMGRL>
enable database prod
Enabled.
DGMGRL>
show configuration

Configuration - dg_prod

  Protection Mode: MaxPerformance
  Members:
  pstdby - Primary database
    prod - Physical standby database 

Fast-Start Failover: Disabled

Configuration Status:
WARNING   (status updated 26 seconds ago)

在主庫發生故障時需要手動failover,將主庫切換到備庫。此時原主庫需要人為介入進行故障診斷和修復,修復后在DG Broker中執行reinstate database [ db_name] 命令可以重新將原主庫轉換為備庫恢復為新的主備關系,若需要還原為初始環境執行switchover即可。

reinstate database [ db_name] 啟用該功能修復,需要數據庫開啟閃回。

在原主庫極端故障無法修復的情況下,需要重新建立DG環境。此時主庫是啟用了DG broker的,修復后的備庫需要執行enable database [ db_name] 加入broker環境。


三. fast_start failover

1. fast_start failover相關配置

  • 保證主從數據庫的閃回數據庫功能以及強制歸檔都打開

SQL> select flashback_on,force_logging from v$database;

FLASHBACK_ON                FOR
------------------                        ---
YES                                      YES

  • 開啟fast-start failover

DGMGRL>  enable fast_start failover;
Enabled in Potential Data Loss Mode.

  • 觀察器(observer)設置

    可以使用后臺進程的方式啟動observer,配置如下:

1)查看當前的borker配置

DGMGRL> show database verbose prod;

Database - prod

Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
prod

Properties:
DGConnectIdentifier
= prod
ObserverConnectIdentifier =  
此處沒有設置值,默認將使用DGConnectIdentifier的值

2)配置wallet

mkstore -wrl /home/oracle/wallet/ -create  
提示輸入wallet密碼
mkstore -wrl /home/oracle/wallet/ -createCredential prod sys <password>
mkstore -wrl /home/oracle/wallet/ -createCredential pstdby sys <password>
在主庫的sqlnet.ora中添加wallet條目
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME,EZCONNECT)
WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/home/oracle/wallet/)))
SQLNET.WALLET_OVERRIDE=TRUE
將主庫的wallet和sqlnet.ora拷貝的備庫的相同位置后,重新reload監聽

3)創建后臺進程observer

dgmgrl sys/oracle@pstdby
DGMGRL> start observer ob1 in background logfile is /database/oracle/product/diag/rdbms/pstdby/prod/trace/observerlog connect identifier is pstdby;
Connected to "PSTDBY"
Submitted command "START OBSERVER" using connect identifier "pstdby"

dgmgrl sys/oracle@prod
DGMGRL> start observer ob2 in background logfile is /database/oracle/product/diag/rdbms/prod/prod/trace/observer.log connect identifier is prod;
Connected to "prod"
Submitted command "START OBSERVER" using connect identifier "prod"

此時主備節點都存在observer進程


2. 場景一、模擬主庫宕機

  • 查看fast-start failover 狀態

  • 驗證自動切換,主庫模擬異常關閉

    prod庫執行shutdown abort;

    查看pstdby狀態,自動切換為主庫。

  • 恢復DG

prod庫啟動后執行
DGMGRL> reinstate database prod
Reinstating database "prod", please wait...
Reinstatement of database "prod" succeeded
DGMGRL> enable database prod
Enabled.
DGMGRL> show configuration

Configuration - dg_prod

  Protection Mode: MaxPerformance
  Members:
  pstdby - Primary database
    prod - (*) Physical standby database

Fast-Start Failover: Enabled in Potential Data Loss Mode

Configuration Status:
SUCCESS (status updated 7 seconds ago)

DGMGRL> show observer

Configuration - dg_prod

  Primary: pstdby
  Active Target:      prod

Observer "ob1" - Master

  Host Name: pstdby
  Last Ping to Primary: 1 second ago
  Last Ping to Target:          1 second ago

Observer "ob2" - Backup

  Host Name: prod
  Last Ping to Primary: 2 seconds ago
  Last Ping to Target:          0 seconds ago


3. 場景二、模擬網絡故障

  • 當前borker狀態

  • 禁用主庫1521端口

[root@pstdby onlinelog]# firewall-cmd --zone=public --remove-port=1521/tcp --permanent
Warning: NOT_ENABLED: 1521:tcp
Success

[oracle@prod /home/oracle]$ tnsping pstdby

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 17-MAY-2021 13:52:01

Copyright (c) 1997, 2019, Oracle. All rights reserved.

Used parameter files:
/database/oracle/product/rdbms/19.3.0/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.199.72)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pstdby)))
TNS-12543: TNS:destination host unreachable
[oracle@pstdby /home/oracle]$ tnsping prod

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 17-MAY-2021 13:53:20

Copyright (c) 1997, 2019, Oracle. All rights reserved.

Used parameter files:
/database/oracle/product/rdbms/19.3.0/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.199.71)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = prod)))
OK (20 msec)
  • 此時borker狀態未發生變化

prod庫的Observer.log中有告警提示

  • 打開pstdb的1521端口,禁用prod的1521端口

[oracle@pstdby /home/oracle]$ tnsping prod

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 17-MAY-2021 14:02:40

Copyright (c) 1997, 2019, Oracle. All rights reserved.

Used parameter files:
/database/oracle/product/rdbms/19.3.0/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.199.71)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = prod)))
TNS-12543: TNS:destination host unreachable

[oracle@prod /home/oracle]$ tnsping pstdby

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 17-MAY-2021 14:02:09

Copyright (c) 1997, 2019, Oracle. All rights reserved.

Used parameter files:
/database/oracle/product/rdbms/19.3.0/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.199.72)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pstdby)))
OK (10 msec)

此時borker狀態未發生變化

  • 同時禁用主備庫的1521端口

[oracle@prod /home/oracle]$ tnsping pstdby

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 17-MAY-2021 14:10:31

Copyright (c) 1997, 2019, Oracle. All rights reserved.

Used parameter files:
/database/oracle/product/rdbms/19.3.0/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.199.72)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pstdby)))
TNS-12543: TNS:destination host unreachable
[oracle@pstdby /home/oracle]$ tnsping prod

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 17-MAY-2021 14:11:23

Copyright (c) 1997, 2019, Oracle. All rights reserved.

Used parameter files:
/database/oracle/product/rdbms/19.3.0/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.199.71)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = prod)))
TNS-12543: TNS:destination host unreachable

DGMGRL> show configuration

Configuration - dg_prod

  Protection Mode: MaxPerformance
  Members:
  pstdby - Primary database
    prod - (*) Physical standby database
      Error: ORA-16664: unable to receive the result from a member

Fast-Start Failover: Enabled in Potential Data Loss Mode

Configuration Status:
ERROR (status updated 55 seconds ago)

DGMGRL> show observer

Configuration - dg_prod

  Primary: pstdby
  Active Target:      prod

Observer "ob1" - Master

  Host Name: pstdby
  Last Ping to Primary: 1 second ago
  Last Ping to Target:          1 second ago

Observer "ob2" - Backup

  Host Name: prod
  Last Ping to Primary: 0 seconds ago
  Last Ping to Target:          1 second ago


結論:在網絡故障時,borker可能會產生一些錯誤的提示,主備庫不會發生角色切換。

在網絡恢復時,錯誤提示會自動清除。


END


更多精彩干貨分享

點擊下方名片關注

IT那活兒

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/129826.html

相關文章

  • DG備庫讀寫測試方案

    DG備庫讀寫測試方案 img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; margin:0...

    IT那活兒 評論0 收藏856

發表評論

0條評論

IT那活兒

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<