今天为一个Rac onenode的主库搭建好一个dg库之后,一直没有传日志,在主库的alertlog中,有报错:
Thu Jun 29 14:55:34 2017
ALTER SYSTEM SET log_archive_dest_state_2='DEFER' SCOPE=BOTH;
Thu Jun 29 14:55:44 2017
ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=BOTH;
Thu Jun 29 14:55:44 2017
Errors in file /data/prd/oracle/diag/rdbms/payroll/payroll_2/trace/payroll_2_tt00_27554.trc:
ORA-16047: DGID mismatch between destination setting and target database
Thu Jun 29 14:55:44 2017
Errors in file /data/prd/oracle/diag/rdbms/payroll/payroll_2/trace/payroll_2_tt00_27554.trc:
ORA-16047: DGID mismatch between destination setting and target database
Thu Jun 29 14:55:44 2017
Errors in file /data/prd/oracle/diag/rdbms/payroll/payroll_2/trace/payroll_2_tt00_27554.trc:
ORA-16047: DGID mismatch between destination setting and target database
Thu Jun 29 14:55:45 2017
Thread 2 advanced to log sequence 632 (LGWR switch)
Current log# 7 seq# 632 mem# 0: +DATA/PAYROLL/ONLINELOG/group_7.303.946836271
Current log# 7 seq# 632 mem# 1: +FRA/PAYROLL/ONLINELOG/group_7.791.946836271
Thu Jun 29 14:55:45 2017
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
ThuJun2914:55:342017
ALTERSYSTEMSETlog_archive_dest_state_2='DEFER'SCOPE=BOTH;
ThuJun2914:55:442017
ALTERSYSTEMSETlog_archive_dest_state_2='ENABLE'SCOPE=BOTH;
ThuJun2914:55:442017
Errorsinfile/data/prd/oracle/diag/rdbms/payroll/payroll_2/trace/payroll_2_tt00_27554.trc:
ORA-16047:DGIDmismatchbetweendestinationsettingandtargetdatabase
ThuJun2914:55:442017
Errorsinfile/data/prd/oracle/diag/rdbms/payroll/payroll_2/trace/payroll_2_tt00_27554.trc:
ORA-16047:DGIDmismatchbetweendestinationsettingandtargetdatabase
ThuJun2914:55:442017
Errorsinfile/data/prd/oracle/diag/rdbms/payroll/payroll_2/trace/payroll_2_tt00_27554.trc:
ORA-16047:DGIDmismatchbetweendestinationsettingandtargetdatabase
ThuJun2914:55:452017
Thread2advancedtologsequence632(LGWRswitch)
Currentlog# 7 seq# 632 mem# 0: +DATA/PAYROLL/ONLINELOG/group_7.303.946836271
Currentlog# 7 seq# 632 mem# 1: +FRA/PAYROLL/ONLINELOG/group_7.791.946836271
ThuJun2914:55:452017
根据oerr的报错信息:
SQL> !oerr ora 16047
16047, 00000, "DGID mismatch between destination setting and target database"
// *Cause: The DB_UNIQUE_NAME specified for the destination did not match
// the DB_UNIQUE_NAME at the target database.
// *Action: Make sure the DB_UNIQUE_NAME specified in the LOG_ARCHIVE_DEST_n
// parameter matches the DB_UNIQUE_NAME parameter defined at the
// destination.
SQL>
1
2
3
4
5
6
7
8
9
SQL>!oerrora16047
16047,00000,"DGID mismatch between destination setting and target database"
// *Cause: The DB_UNIQUE_NAME specified for the destination did not match
// the DB_UNIQUE_NAME at the target database.
// *Action: Make sure the DB_UNIQUE_NAME specified in the LOG_ARCHIVE_DEST_n
// parameter matches the DB_UNIQUE_NAME parameter defined at the
// destination.
SQL>
检查了主库和备库的db_unique_name,发现都没有问题。
进一步检查v$dataguard_status发现:
可以看到有个16062的报错。我们看看ora-16062报错的含义:
SQL> !oerr ora 16062
16062, 00000, "standby database not in Data Guard configuration"
// *Cause: The standby database was not found in the Data Guard configuration
// of the server.
// *Action: Add the database unique name of the standby database to the
// DG_CONFIG attribute of the LOG_ARCHIVE_CONFIG database
// initialization parameter.
SQL>
1
2
3
4
5
6
7
8
9
SQL>!oerrora16062
16062,00000,"standby database not in Data Guard configuration"
// *Cause: The standby database was not found in the Data Guard configuration
// of the server.
// *Action: Add the database unique name of the standby database to the
// DG_CONFIG attribute of the LOG_ARCHIVE_CONFIG database
// initialization parameter.
SQL>
检查主备库的LOG_ARCHIVE_CONFIG,发现主库已经配置,但是备库的LOG_ARCHIVE_CONFIG没有配置。所以ORA-16047的报错只是表象,造成日志不同步的真正的原因是ora-16062。
加上备库的LOG_ARCHIVE_CONFIG=DG_CONFIG,并且在主库重新defer+enable log_archive_dest_state_2之后,故障解决。