[转帖]DG BROKER 之 REINSTATE DATABASE (把旧主库恢复到备用库)_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
2
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 2311 | 回复: 1   主题: [转帖]DG BROKER 之 REINSTATE DATABASE (把旧主库恢复到备用库)        上一篇   下一篇 
414644352
注册用户
等级:新兵
经验:66
发帖:1
精华:0
注册:2016-11-8
状态:离线
发送短消息息给414644352 加好友    发送短消息息给414644352 发消息
发表于: IP:您无权察看 2019-9-19 10:36:45 | [全部帖] [楼主帖] 楼主

DGMGRL> connect sys/oracle@dbsalve;


已连接。

DGMGRL> show configuration;


配置 - DG_BROKER_SALVE

  保护模式:    MaxAvailability

  数据库:

   DBSALVE - 主数据库

     错误: ORA-16825: 检测到数据库的多个错误或警告, 包括与快速启动故障转移相关的错误或警告

   DBMAST  - (*) 物理备用数据库 (禁用)

     ORA-16661: 需要恢复备用数据库

快速启动故障转移: ENABLED

配置状态:

ERROR
DGMGRL> show configuration verbose;


配置 - DG_BROKER_SALVE

  保护模式:    MaxAvailability

  数据库:

   DBSALVE - 主数据库

     错误: ORA-16825: 检测到数据库的多个错误或警告, 包括与快速启动故障转移相关的错误或警告

   DBMAST  - (*) 物理备用数据库 (禁用)

     ORA-16661: 需要恢复备用数据库

  (*)快速启动故障转移目标

  属性:

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


快速启动故障转移: ENABLED

  阈值:             120 秒

  目标:             DBMAST

  观察程序:       DB-Salve

  滞后限制:       30 秒 (未使用)

  关闭主数据库: TRUE

  自动恢复:       TRUE

  观察程序重新连接: (无)

  观察程序覆盖: FALSE

配置状态:

ERROR


启动备用库

SQL> startup mount;


ORACLE 例程已经启动。

SQL> set linesize 1000
col name format a10;
col db_unique_name format a10;
col open_mode format a20;
col protection_mode format a20;
col database_role format a20;
col switchover_status format a20;
SQL> SELECTNAME,OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS,DB_UNIQUE_NAMEFROM V$DATABASE;
NAME          OPEN_MODE                   PROTECTION_MODE      DATABASE_ROLE   SWITCHOVER_STATUS    DB_UNIQUE_
------------------------------ -------------------- ---------------------------------------- ----------
DBMAST      MOUNTED              MAXIMUMAVAILABILITY PRIMARY                    NOT ALLOWED                DBMAST


郁闷还是主库角色

连接上备用库看看情况

DGMGRL> connect sys/oracle@DBMAST;


已连接。

DGMGRL> show configuration verbose;


配置 - DG_BROKER_SALVE

  保护模式:    MaxAvailability

  数据库:

   DBSALVE - 主数据库

   DBMAST  - (*) 物理备用数据库

  (*)快速启动故障转移目标

  属性:

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


快速启动故障转移: ENABLED

  阈值:             120 秒

  目标:             DBMAST

  观察程序:       DB-Salve

  滞后限制:       30 秒 (未使用)

  关闭主数据库: TRUE

  自动恢复:       TRUE

  观察程序重新连接: (无)

  观察程序覆盖: FALSE

配置状态:

ORA-16665: 从数据库等待结果时超时

DGM-17017: 无法确定配置状态

情况依旧

看看原来主库的DG信息

[oracle@DB-MASTERtrace]pwd
/u01/app/software/oracle/diag/rdbms/dbmast/DBMAST/trace
[oracle@DB-MASTER trace]ll drcDBMAST.log
-rw-r----- 1 oracle oinstall 2.1M 4月  25 15:25 drcDBMAST.log
04/25/2016 14:33:23
>> Starting Data Guard Brokerbootstrap <<
Broker Configuration File Locations:
dg_broker_config_file1 ="/u01/app/software/oracle/product/11.2.0/db_1/dbs/dr1DBMAST.dat"
dg_broker_config_file2 ="/u01/app/software/oracle/product/11.2.0/db_1/dbs/dr2DBMAST.dat"
04/25/2016 14:33:27
DMON Registering serviceDBMAST_DGB with listener(s)
Broker Configuration:       "DG_BROKER_SALVE"
Protection Mode:           Maximum Availability
Fast-Start Failover (FSFO): Enabled, flags=0x40051, version=2
Primary Database:          DBSALVE (0x01010000)
Standby Database:          DBMAST, Enabled Physical Standby (FSFO target) (0x02010000)
04/25/2016 14:33:31
Failed to connect to remote databaseDBSALVE. Error is ORA-12541
Failed to send message to site DBSALVE.Error code is ORA-12541.
database DBMAST unable to contact primarydatabase for version check; status ORA-12541
completing bootstrap of this database
Creating process RSM0
04/25/2016 14:33:34
SQL Execution error=604, sql=[ALTERDATABASE MOUNT]. See error stack below.


 ORA-00604: 递归 SQL 级别 1 出现错误

 ORA-01100: 数据库已装载

Failed to mount standby database.
Apply Instance for Database DBMAST set toDBMAST
Database Resource SetState Error (16746)
SQL Execution error=604, sql=[ALTERDATABASE RECOVER MANAGED STANDBY DATABASE THROUGH ALL SWITCHOVER DISCONNECT USING CURRENT LOGFILE]. See error stack below.


 ORA-00604: 递归 SQL 级别 1 出现错误

 ORA-01665: 控制文件不是备用控制文件

Failed to connect to remote databaseDBSALVE. Error is ORA-12541
Failed to send message to site DBSALVE.Error code is ORA-12541.
Command EDIT DATABASE DBMAST SET PROPERTYActualApplyInstance = DBMAST completed
04/25/2016 15:18:57
Site DBSALVE returned ORA-16665.
04/25/2016 15:19:12
Site DBSALVE returned ORA-16665.
04/25/2016 15:19:27
Site DBSALVE returned ORA-16665.
04/25/2016 15:19:42
Site DBSALVE returned ORA-16665.
04/25/2016 15:19:57
Site DBSALVE returned ORA-16665.
04/25/2016 15:20:12
Site DBSALVE returned ORA-16665.
04/25/2016 15:20:27
Site DBSALVE returned ORA-16665.
04/25/2016 15:20:42
Site DBSALVE returned ORA-16665.
04/25/2016 15:20:57
Site DBSALVE returned ORA-16665.
04/25/2016 15:21:12
Site DBSALVE returned ORA-16665.
04/25/2016 15:21:27
Site DBSALVE returned ORA-16665.
04/25/2016 15:21:43
Site DBSALVE returned ORA-16665.
04/25/2016 15:22:37


数据库跟踪信息

***********************************************************************
Fatal NI connect error 12514, connectingto:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.202)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=DBSALVE_DGB)(CID=(PROGRAM=oracle)(HOST=DB-MASTER)(USER=oracle))))
VERSION INFORMATION:
TNSfor Linux: Version 11.2.0.4.0 - Production
TCP/IPNT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production


 Time: 25-4月 -2016 15:18:29

Tracing not turned on.
Tnserror struct:
ns main err code: 12564


  TNS-12564:TNS: 拒绝连接

ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Mon Apr 25 15:22:37 2016
NSV0 started with pid=24, OS id=1956


这个监听报错是啥么鬼? 下面这句话好难懂, 是说DB-MASTER 原来的主库启动一个连接,去连接202新主库服务名是DBSALVE_DGB

(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.202)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=DBSALVE_DGB)(CID=(PROGRAM=oracle)(HOST=DB-MASTER)(USER=oracle))))


而上面的 DG BROKER 跟踪信息报错是红色部分说DMON 自动注册个新服务在DB-MAST上.

那好吧我们在新主库人工注册个服务去

服务摘要..

服务 "DBSALVE" 包含 1 个实例。

  实例"DBSALVE", 状态 UNKNOWN, 包含此服务的 1 个处理程序...

服务 "DBSALVE_DGB"包含 1 个实例。

  实例 "DBSALVE", 状态 UNKNOWN, 包含此服务的 1 个处理程序...

服务 "DBSALVE_DGMGRL.shark.com" 包含 1 个实例。

  实例"DBSALVE", 状态 UNKNOWN, 包含此服务的 1 个处理程序...

命令执行成功

DGMGRL> REINSTATE DATABASE 'DBMAST';


正在恢复数据库 "DBMAST", 请稍候...

警告: ORA-16575: 故障转移正在进行中, 因此请求已终止

恢复数据库 "DBMAST" 失败

SQL> SELECTNAME,OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS,DB_UNIQUE_NAMEFROM V$DATABASE;
NAME           OPEN_MODE                   PROTECTION_MODE      DATABASE_ROLE   SWITCHOVER_STATUS    DB_UNIQUE_
---------- -------------------- ---------------------------------------- -------------------- ----------
DBMAST       MOUNTED              MAXIMUMAVAILABILITY PHYSICALSTANDBY  RECOVERY NEEDED      DBMAST


角色已经改变了,可配置信息

DGMGRL> show configuration ;


错误:

ORA-16795: 需要重新创建备用数据库

配置详细信息不能由 DGMGRL 确定

DGMGRL>


好吧,先试试下归档日志同步下

新主库

SQL> alter system set log_archive_dest_state_2=enablescope=both;


新备库

SQL> alter database recover managed standby databasedisconnect from session;
SQL> SELECTNAME,OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS,DB_UNIQUE_NAMEFROM V$DATABASE;
NAME           OPEN_MODE                   PROTECTION_MODE      DATABASE_ROLE   SWITCHOVER_STATUS    DB_UNIQUE_
---------- -------------------- ---------------------------------------- -------------------- ----------
DBMAST       MOUNTED              MAXIMUMAVAILABILITY PHYSICAL STANDBY   SWITCHOVER  PENDING   DBMAST


退出DGMGRL 重新进去

欢迎使用 DGMGRL, 要获取有关信息请键入"help"。

DGMGRL> connect sys/oracle@DBSALVE


已连接。

DGMGRL> show configuration;


配置 - DG_BROKER_SALVE

  保护模式:   MaxAvailability

  数据库:

    DBSALVE - 主数据库

      错误: ORA-16820: 快速启动故障转移观察程序不再对此数据库进行观察

    DBMAST  - (*) 物理备用数据库 (禁用)

      ORA-16661: 需要恢复备用数据库

快速启动故障转移: ENABLED

配置状态:

ERROR


发现新备库上目录里有FSFO.DAT文件 说明 观察程序已经运行中. 只是.. 算了 还是关闭它

DGMGRL> STOP OBSERVER


错误: ORA-16636: 快速启动故障转移目标备用数据库处于错误状态, 无法停止观察程序

失败。

OK 我们再来一次REINSTATE,关闭备库

SQL> select fs_failover_status from v$database;
FS_FAILOVER_STATUS
------------------------------------------------------------------
DISABLED
SQL> shutdown immediate;


数据库已经关闭。

已经卸载数据库。

ORACLE 例程已经关闭。

SQL> startup mount;


ORACLE 例程已经启动。

Total System Global Area 446775296 bytes
Fixed Size                2254104 bytes
Variable Size                  360712936 bytes
Database Buffers            79691776 bytes
Redo Buffers                    4116480 bytes


数据库装载完毕。

REINSTATE
DGMGRL> show configuration;


配置 - DG_BROKER_SALVE

  保护模式:   MaxAvailability

  数据库:

    DBSALVE - 主数据库

      错误: ORA-16820: 快速启动故障转移观察程序不再对此数据库进行观察

    DBMAST  - (*) 物理备用数据库 (禁用)

      ORA-16661: 需要恢复备用数据库

快速启动故障转移: ENABLED

配置状态:

ERROR
DGMGRL> reinstate database 'DBMAST';


正在恢复数据库 "DBMAST", 请稍候...

已成功恢复数据库 "DBMAST"

喔操 居然成功了 喜悦心情….

DGMGRL> show configuration;


配置 - DG_BROKER_SALVE

  保护模式:   MaxAvailability

  数据库:

    DBSALVE - 主数据库

      错误: ORA-16820: 快速启动故障转移观察程序不再对此数据库进行观察

    DBMAST  - (*) 物理备用数据库

快速启动故障转移: ENABLED

配置状态:

ERROR


备库看看

SQL> SELECTNAME,OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS,DB_UNIQUE_NAMEFROM V$DATABASE;
NAME           OPEN_MODE                   PROTECTION_MODE      DATABASE_ROLE   SWITCHOVER_STATUS    DB_UNIQUE_
---------- -------------------- ---------------------------------------- -------------------- ----------
DBMAST       READ ONLY WITH APPLY MAXIMUM AVAILABILITYPHYSICAL STANDBY   NOT ALLOWED                DBMAST


然后在主备上

DGMGRL> stop OBSERVER;


完成。

然后再新主库上开启 OBSERVER;

DGMGRL> show configuration;


配置 - DG_BROKER_SALVE

  保护模式:   MaxAvailability

  数据库:

    DBSALVE - 主数据库

    DBMAST  - (*) 物理备用数据库

快速启动故障转移: ENABLED

配置状态:

SUCCESS


这里我们还是把OBSERVER 放在备库好 最好后台运行.




赞(0)    操作        顶端 
联动大白
注册用户
等级:列兵
经验:91
发帖:0
精华:0
注册:2015-5-27
状态:离线
发送短消息息给联动大白 加好友    发送短消息息给联动大白 发消息
发表于: IP:您无权察看 2019-11-21 0:30:00 | [全部帖] [楼主帖] 2  楼

为了方便大家阅读,我对文章中错误号来解释一下吧!

Error Id: ORA-01100

Title: database already mounted

Description:

database already mounted

Action:

none

Cause:

A database is already mounted in this instance.


Error Id: ORA-16636

Title: Fast-Start Failover target standby in error state, cannot stop observer

Description:

Fast-Start Failover target standby in error state, cannot stop observer

Action:

Additional information about this failure is recorded in the Data Guard broker log file for the primary database. This information helps you identify the reason why the target standby database was unable to participate in the STOP OBSERVER operation. You may correct the problem that is indicated by that information and retry the operation. Alternatively, you may forcibly disable Fast-Start Failover while connected to the primary database using the DISABLE FAST_START FAILOVER FORCE command in the DGMGRL CLI. You can then stop the observer regardless of the current state of the target standby database.

Cause:

A STOP OBSERVER operation could not be completed when Fast-Start Failover was enabled because the target standby database could not participate in the STOP OBSERVER operation.


Error Id: ORA-16661

Title: the standby database needs to be reinstated

Description:

the standby database needs to be reinstated

Action:

Use the DGMGRL REINSTATE DATABASE command or Enterprise Manager to reinstate the database. If the target database has flashback enabled and it has sufficient flashback logs, the database will be reinstated as a standby database for the current primary database.

Cause:

A switchover or failover operatione has caused this database to require reinstatement.


Error Id: ORA-16575

Title: request terminated at broker discretion

Description:

request terminated at broker discretion

Action:

There is no action to be taken.

Cause:

This status is returned when the broker terminates a user- initiated request. The broker will terminate all other current and pending requests when it begins processing a failover request. These other requests are terminated with this status.


Error Id: ORA-01665

Title: control file is not a standby control file

Description:

control file is not a standby control file

Action:

Create a standby control file before attempting to use the database as a standby database.

Cause:

Attempting to mount, recover or activate a standby database without a standby control file.


Error Id: ORA-16825

Title: Fast-Start Failover and other errors or warnings detected for the database

Description:

Fast-Start Failover and other errors or warnings detected for the database

Action:

Check the StatusReport monitorable property of the database specified.

Cause:

The broker has detected multiple errors or warnings for the database. At least one of the detected errors or warnings may prevent a Fast-Start Failover from occurring.


Error Id: ORA-16820

Title: Fast-Start Failover observer is no longer observing this database

Description:

Fast-Start Failover observer is no longer observing this database

Action:

Check the reason why the observer cannot contact this database. If the problem cannot be corrected, stop the current observer by connecting to the Data Guard configuration and issue the DGMGRL "STOP OBSERVER" command. Then restart the observer on another node. You may use the DGMGRL "START OBSERVER" command to start the observer on the other node.

Cause:

A previously started observer was no longer actively observing this database. A significant amount of time elapsed since this database last heard from the observer. Possible reasons were: - The node where the observer was running was not available. - The network connection between the observer and this database was not available. - Observer process was terminated unexpectedly.


Error Id: ORA-16795

Title: database resource guard detects that database re-creation is required

Description:

database resource guard detects that database re-creation is required

Action:

Re-create (or flash back) the standby database. Connect to the primary database in the broker configuration and reenable broker management of that database. At this point you may connect to that standby database and resume issuing client commands. Alternatively, many client commands that cannot be completed at the standby database when in this error state can be completed successfully when issued to the primary database. In this case, simply reconnect to the primary database and retry the command.

Cause:

In the act of failover or switchover, the database resource guard may have detected that re-creation of the database is necessary. This occurs when the database resource guard recognizes a situation in which the database in question cannot be a viable standby database for the new primary database. Until this error status is resolved for this database, information about this database and the broker configuration to which it belongs is unavailable to a broker client that is connected to this database. Therefore, all commands directed by that client to this database cannot be completed.


Error Id: ORA-12541

Title: TNS:no listener

Description:

TNS:no listener

Action:

Ensure that the supplied destination address matches one of the addresses used by the listener - compare the TNSNAMES.ORA entry with the appropriate LISTENER.ORA file (or TNSNAV.ORA if the connection is to go by way of an Interchange). Start the listener on the remote machine.

Cause:

The connection request could not be completed because the listener is not running.


Error Id: ORA-00604

Title: error occurred at recursive SQL level string

Description:

error occurred at recursive SQL level string

Action:

If the situation described in the next error on the stack can be corrected, do so; otherwise contact Oracle Support.

Cause:

An error occurred while processing a recursive SQL statement (a statement applying to internal dictionary tables).


Error Id: TNS-12564

Title: TNS:connection refused

Description:

TNS:connection refused

Action:

Not normally visible to the user. For further details, turn on tracing and reexecute the operation.

Cause:

The connect request was denied by the remote user (or TNS software).


也许你已明白,但对一个人有用也是我存在的理由!^_^ By:持之以恒的大白

-- 来自: 北京联动北方科技有限公司



赞(0)    操作        顶端 
总帖数
2
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论