dg broke配置(FSFO)

dg broke配置

alter system set dg_broker_start=true;


create configuration 'CON_DG' as primary database is 'orcl' connect identifier is 'orcl';
add database 'orclstd' as connect identifier is 'orclstd';


create configuration 'CON_TESTDG' as primary database is 'orclstd' connect identifier is 'orclstd';
add database 'orcl' as connect identifier is 'orcl';





#查看配置
SHOW CONFIGURATION
show database verbose orcl
show database verbose orclstd

#切换
switchover to orcl

EDIT DATABASE orclstd set  PROPERTY StaticConnectIdentifier='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL_DGB)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))';

EDIT DATABASE orcl set  PROPERTY StaticConnectIdentifier='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCLSTD_DGB)(INSTANCE_NAME=orclstd)(SERVER=DEDICATED)))';

#tianfanle ???
EDIT DATABASE orcl set PROPERTY StaticConnectIdentifier='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))';

EDIT DATABASE orclstd set  PROPERTY StaticConnectIdentifier='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orclstd)(INSTANCE_NAME=orclstd)(SERVER=DEDICATED)))';



转换
dgmgrl
DGMGRL> convert database 'TESTDGPHY' to snapshot standby; 
DGMGRL> CONVERT DATABASE 'TESTDGPHY' to PHYSICAL STANDBY;

FSFO

show database orcl FastStartFailoverTarget
show database orclstd FastStartFailoverTarget

EDIT DATABASE orcl SET PROPERTY FastStartFailoverTarget='orclstd';
EDIT DATABASE orclstd SET PROPERTY FastStartFailoverTarget='orcl';

show configuration verbose
DGMGRL> show configuration verbose

Configuration - CON_TESTDG

  Protection Mode: MaxPerformance
  Databases:
    orcl    - Primary database
    orclstd - Physical standby database

  Properties:
    FastStartFailoverThreshold      = '30'
    OperationTimeout                = '30'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    ObserverReconnect               = '0'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'
    ObserverOverride                = 'FALSE'
    ExternalDestination1            = ''
    ExternalDestination2            = ''
    PrimaryLostWriteAction          = 'CONTINUE'

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

#适当设置
FastStartFailoverThreshold:parmary坏了多久之后才failover,默认30s.最小6s
EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold='10';


###启动
dgmgrl sys/Oracle123 "START OBSERVER"

DGMGRL> SHOW FAST_START FAILOVER;
 Observer:           db1
 
 
###激活
DGMGRL> ENABLE FAST_START FAILOVER
Enabled.

###启动的主库上进程fsfp启动
Fast-Start Failover (FSFO) has been enabled between:
  Primary = "orcl"
  Standby = "orclstd"

ora_fsfp_orcl



###查看Fast-Start Failover: ENABLED
DGMGRL> show configuration verbose

Configuration - CON_TESTDG

  Protection Mode: MaxPerformance
  Databases:
    orcl    - Primary database
    orclstd - (*) Physical standby database

  (*) Fast-Start Failover target

  Properties:
    FastStartFailoverThreshold      = '30'
    OperationTimeout                = '30'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    ObserverReconnect               = '0'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'
    ObserverOverride                = 'FALSE'
    ExternalDestination1            = ''
    ExternalDestination2            = ''
    PrimaryLostWriteAction          = 'CONTINUE'

Fast-Start Failover: ENABLED

  Threshold:          30 seconds
  Target:             orclstd
  Observer:           db1
  Lag Limit:          30 seconds
  Shutdown Primary:   TRUE
  Auto-reinstate:     TRUE
  Observer Reconnect: (none)
  Observer Override:  FALSE

Configuration Status:
SUCCESS

fsfo测试

set line 9999 
col name format a10 
col FS_FAILOVER_OBSERVER_HOST format a20 
col DB_UNIQUE_NAME format a15 
select dbid,name, DB_UNIQUE_NAME,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from gv$database; 

SELECT d.DBID, d.DB_UNIQUE_NAME, d.FORCE_LOGGING, d.FLASHBACK_ON, d.FS_FAILOVER_STATUS, d.FS_FAILOVER_CURRENT_TARGET, d.FS_FAILOVER_THRESHOLD, d.FS_FAILOVER_OBSERVER_PRESENT,d.FS_FAILOVER_OBSERVER_HOST FROM gv$database d;



#shutdown abort主库.备库查看
DGMGRL> show configuration

Configuration - CON_TESTDG

  Protection Mode: MaxPerformance
  Databases:
    orclstd - Primary database
      Warning: ORA-16829: fast-start failover configuration is lagging

    orcl    - (*) Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated

Fast-Start Failover: ENABLED

Configuration Status:
WARNING


#主库启动到mount
startup mount
日志,自动闪回恢复备库
Initiating reinstatement for database "orcl"...
Reinstating database "orcl", please wait...
Operation requires shutdown of instance "orcl" on database "orcl"
Shutting down instance "orcl"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "orcl" on database "orcl"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Continuing to reinstate database "orcl" ...
Reinstatement of database "orcl" succeeded

##完成后查看,源主库正常恢复为standby
DGMGRL> show configuration

Configuration - CON_TESTDG

  Protection Mode: MaxPerformance
  Databases:
    orclstd - Primary database
    orcl    - (*) Physical standby database

Fast-Start Failover: ENABLED

Configuration Status:
SUCCESS



##复原
新主库shutdown abort
posted @ 2025-01-13 10:02  EverEternity  阅读(21)  评论(0)    收藏  举报