select status from v$instance; STATUS ..."/>
溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

備庫DUPLICATE后啟用同步,開啟ADG打開數(shù)據(jù)庫時(shí)報(bào)錯(cuò):ORA-10458

發(fā)布時(shí)間:2020-08-09 14:42:34 來源:ITPUB博客 閱讀:164 作者:Root__Liu 欄目:關(guān)系型數(shù)據(jù)庫

    備庫DUPLICATE后啟用同步,開啟ADG打開數(shù)據(jù)庫時(shí)報(bào)錯(cuò):ORA-10458

SQL> select status from v$instance;
STATUS
------------
MOUNTED
SQL> recover managed standby database using current logfile disconnect;
Media recovery complete.
SQL> 
SQL> recover managed standby database cancel;
Media recovery complete.
SQL> 
SQL> alter database open ;
alter database open
*
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '+SDE_DATA/sdedg/datafile/system.283.984230107'
SQL>

     查看日志,發(fā)現(xiàn)所有主庫的歸檔日志都沒有被應(yīng)用,手動(dòng)恢復(fù)日志

SQL> recover managed standby database

     查看告警日志,發(fā)現(xiàn)錯(cuò)誤

[oracle@sde1 trace]$ tail -f alert_sde1.log 
FAL[client]: Failed to request gap sequence
 GAP - SCN range: 0x0e57.4d6ec257 - 0x0e57.4d6ec257
 DBID 2155281896 branch 984123832
FAL[client]: All defined FAL servers have been attempted.
------------------------------------------------------------
Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that's sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.
------------------------------------------------------------
Wed Aug 15 14:47:10 2018
Recovery interrupted!
Media Recovery failed with error 448
Errors in file /u01/app/oracle/diag/rdbms/sdedg/sde1/trace/sde1_pr00_29797.trc:
ORA-00283: recovery session canceled due to errors
ORA-00448: normal completion of background process
Slave exiting with ORA-283 exception

    查看錯(cuò)誤文件;

[oracle@sde1 ~]$ tail -fn200 /u01/app/oracle/diag/rdbms/sdedg/sde1/trace/sde1_pr00_29797.trc

    里邊有錯(cuò)誤指示:

*** 2018-08-15 14:34:10.634
Media Recovery add redo thread 2
*** 2018-08-15 14:34:10.721 4320 krsh.c
Media Recovery Waiting for thread 1 sequence 129
Redo shipping client performing standby login

    是日志文件沒有被應(yīng)用,查看備庫的日志組文件,發(fā)現(xiàn)日志組過多,先刪除過多的備庫日志組,然后重建備庫日志組

SQL> select group#,member,type from v$logfile;
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
 6 +SDE_FRA/redo06.log                                          ONLINE
 5 +SDE_FRA/redo05.log                                          ONLINE
 2 +SDE_FRA/redo02.log                                          ONLINE
 1 +SDE_FRA/redo01.log                                          ONLINE
 3 +SDE_DATA/sdedg/onlinelog/group_3.284.984232869              ONLINE
 3 +data                                                        ONLINE
 4 +SDE_DATA/sdedg/onlinelog/group_4.302.984232871              ONLINE
 4 +data                                                        ONLINE
 7 +SDE_DATA/sdedg/onlinelog/group_7.301.984232871              ONLINE
 8 +SDE_DATA/sdedg/onlinelog/group_8.281.984232871              ONLINE
 9 +SDE_DATA/sdedg/onlinelog/group_9.280.984232871              ONLINE
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
10 +SDE_DATA/sdedg/onlinelog/group_10.300.984232873             ONLINE
11 +SDE_DATA/sdedg/onlinelog/group_11.299.984232873             ONLINE
12 +SDE_DATA/sdedg/onlinelog/group_12.271.984232873             ONLINE
13 +SDE_DATA/sdedg/onlinelog/group_13.274.984232873             ONLINE
14 +SDE_DATA/sdedg/onlinelog/group_14.284.984230143             STANDBY
15 +SDE_DATA/sdedg/onlinelog/group_15.284.984230145             STANDBY
16 +SDE_DATA/sdedg/onlinelog/group_16.284.984230147             STANDBY
17 +SDE_DATA/sdedg/onlinelog/group_17.284.984230149             STANDBY
18 +SDE_DATA/sdedg/onlinelog/group_18.284.984230151             STANDBY
19 +SDE_DATA/sdedg/onlinelog/group_19.284.984230153             STANDBY
20 +SDE_DATA/sdedg/onlinelog/group_20.284.984230155             STANDBY
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
21 +SDE_DATA/sdedg/onlinelog/group_21.284.984230157             STANDBY
22 +SDE_DATA/sdedg/onlinelog/group_22.284.984230159             STANDBY
23 +SDE_DATA/sdedg/onlinelog/group_23.284.984230161             STANDBY
24 +SDE_DATA/sdedg/onlinelog/group_24.284.984230163             STANDBY
25 +SDE_DATA/sdedg/onlinelog/group_25.284.984230165             STANDBY
26 +SDE_DATA/sdedg/onlinelog/group_26.284.984230167             STANDBY
27 +SDE_DATA/sdedg/onlinelog/group_27.284.984230169             STANDBY
28 +SDE_DATA/sdedg/onlinelog/group_28.284.984230171             STANDBY
 7 +data                                                        ONLINE
 8 +data                                                        ONLINE
 9 +data                                                        ONLINE
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
10 +data                                                        ONLINE
11 +data                                                        ONLINE
12 +data                                                        ONLINE
13 +data                                                        ONLINE
14 +data                                                        STANDBY
15 +data                                                        STANDBY
16 +data                                                        STANDBY
17 +data                                                        STANDBY
18 +data                                                        STANDBY
19 +data                                                        STANDBY
20 +data                                                        STANDBY
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
21 +data                                                        STANDBY
22 +data                                                        STANDBY
23 +data                                                        STANDBY
24 +data                                                        STANDBY
25 +data                                                        STANDBY
26 +data                                                        STANDBY
27 +data                                                        STANDBY
28 +data                                                        STANDBY
52 rows selected.
SQL> alter database drop logfile group 14;
Database altered.
SQL> alter database drop logfile group 15;
Database altered.
SQL> alter database drop logfile group 16;
Database altered.
SQL> alter database drop logfile group 17;
Database altered.
SQL> alter database drop logfile group 18;
Database altered.
SQL> alter database drop logfile group 19;
Database altered.
SQL> 
SQL> alter database drop logfile group 20;
Database altered.
SQL> alter database drop logfile group 21;
Database altered.
SQL> alter database drop logfile group 22;
Database altered.
SQL> alter database drop logfile group 23;
Database altered.
SQL> alter database drop logfile group 24;
Database altered.
SQL> alter database drop logfile group 25;
Database altered.
SQL> alter database drop logfile group 26;
Database altered.
SQL> alter database drop logfile group 27;
Database altered.
SQL> alter database drop logfile group 28;
Database altered.
SQL> select group#,member,type from v$logfile;
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
 6 +SDE_FRA/redo06.log                                          ONLINE
 5 +SDE_FRA/redo05.log                                          ONLINE
 2 +SDE_FRA/redo02.log                                          ONLINE
 1 +SDE_FRA/redo01.log                                          ONLINE
 3 +SDE_DATA/sdedg/onlinelog/group_3.284.984232869              ONLINE
 3 +data                                                        ONLINE
 4 +SDE_DATA/sdedg/onlinelog/group_4.302.984232871              ONLINE
 4 +data                                                        ONLINE
 7 +SDE_DATA/sdedg/onlinelog/group_7.301.984232871              ONLINE
 8 +SDE_DATA/sdedg/onlinelog/group_8.281.984232871              ONLINE
 9 +SDE_DATA/sdedg/onlinelog/group_9.280.984232871              ONLINE
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
10 +SDE_DATA/sdedg/onlinelog/group_10.300.984232873             ONLINE
11 +SDE_DATA/sdedg/onlinelog/group_11.299.984232873             ONLINE
12 +SDE_DATA/sdedg/onlinelog/group_12.271.984232873             ONLINE
13 +SDE_DATA/sdedg/onlinelog/group_13.274.984232873             ONLINE
 7 +data                                                        ONLINE
 8 +data                                                        ONLINE
 9 +data                                                        ONLINE
10 +data                                                        ONLINE
11 +data                                                        ONLINE
12 +data                                                        ONLINE
13 +data                                                        ONLINE
22 rows selected.

     然后通過添加日志組的腳本重新添加日志組

SQL> select group#,member,type from v$logfile;
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
 6 +SDE_FRA/redo06.log                                          ONLINE
 5 +SDE_FRA/redo05.log                                          ONLINE
 2 +SDE_FRA/redo02.log                                          ONLINE
 1 +SDE_FRA/redo01.log                                          ONLINE
 3 +SDE_DATA/sdedg/onlinelog/group_3.284.984232869              ONLINE
 3 +data                                                        ONLINE
 4 +SDE_DATA/sdedg/onlinelog/group_4.302.984232871              ONLINE
 4 +data                                                        ONLINE
 7 +SDE_DATA/sdedg/onlinelog/group_7.301.984232871              ONLINE
 8 +SDE_DATA/sdedg/onlinelog/group_8.281.984232871              ONLINE
 9 +SDE_DATA/sdedg/onlinelog/group_9.280.984232871              ONLINE
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
10 +SDE_DATA/sdedg/onlinelog/group_10.300.984232873             ONLINE
11 +SDE_DATA/sdedg/onlinelog/group_11.299.984232873             ONLINE
12 +SDE_DATA/sdedg/onlinelog/group_12.271.984232873             ONLINE
13 +SDE_DATA/sdedg/onlinelog/group_13.274.984232873             ONLINE
14 +SDE_FRA/sdedg/onlinelog/group_14.276.984234319              STANDBY
15 +SDE_FRA/sdedg/onlinelog/group_15.277.984234319              STANDBY
16 +SDE_FRA/sdedg/onlinelog/group_16.270.984234321              STANDBY
17 +SDE_FRA/sdedg/onlinelog/group_17.271.984234321              STANDBY
18 +SDE_FRA/sdedg/onlinelog/group_18.278.984234321              STANDBY
19 +SDE_FRA/sdedg/onlinelog/group_19.269.984234321              STANDBY
20 +SDE_FRA/sdedg/onlinelog/group_20.267.984234323              STANDBY
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
21 +SDE_FRA/sdedg/onlinelog/group_21.264.984234323              STANDBY
22 +SDE_FRA/sdedg/onlinelog/group_22.279.984234323              STANDBY
23 +SDE_FRA/sdedg/onlinelog/group_23.280.984234323              STANDBY
24 +SDE_FRA/sdedg/onlinelog/group_24.281.984234325              STANDBY
25 +SDE_FRA/sdedg/onlinelog/group_25.282.984234325              STANDBY
26 +SDE_FRA/sdedg/onlinelog/group_26.283.984234325              STANDBY
27 +SDE_FRA/sdedg/onlinelog/group_27.284.984234325              STANDBY
28 +SDE_FRA/sdedg/onlinelog/group_28.404.984234327              STANDBY
 7 +data                                                        ONLINE
 8 +data                                                        ONLINE
 9 +data                                                        ONLINE
GROUP# MEMBER                                                       TYPE
---------- ------------------------------------------------------------ -------
10 +data                                                        ONLINE
11 +data                                                        ONLINE
12 +data                                                        ONLINE
13 +data                                                        ONLINE
37 rows selected.
SQL>

    重新執(zhí)行同步

SQL> recover managed standby database using current logfile disconnect;
Media recovery complete.
SQL> 
SQL> 
SQL> recover managed standby database cancel;
Media recovery complete.
SQL> 
SQL> 
SQL> alter database open ;
alter database open
*
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '+SDE_DATA/sdedg/datafile/system.283.984230107'

    日志組的問題已經(jīng)解決,現(xiàn)在還需要恢復(fù)數(shù)據(jù)庫,考慮主備庫同步的問題,查看主備庫參數(shù)是否正常

SQL> show parameter log_archive_config
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string      
SQL> show parameter log_archive_dest_2
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_17                  string
log_archive_dest_18                  string
log_archive_dest_19                  string
log_archive_dest_2                   string

        發(fā)現(xiàn)主庫的轉(zhuǎn)換參數(shù)都沒有設(shè)置,重新設(shè)置這兩個(gè)參數(shù)

SQL> alter system set log_archive_config='dg_config=(sde,sdedg)';
SQL> alter system set log_archive_dest_2='service=sde_new lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=sdedg';	
SQL> show parameter log_archive_
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string      dg_config=(sde,sdedg)
log_archive_dest                     string
log_archive_dest_1                   string      location=use_db_recovery_file_
 dest
log_archive_dest_10                  string
log_archive_dest_11                  string
log_archive_dest_12                  string
log_archive_dest_13                  string
log_archive_dest_14                  string
log_archive_dest_15                  string
log_archive_dest_16                  string
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_17                  string
log_archive_dest_18                  string
log_archive_dest_19                  string
log_archive_dest_2                   string      service=sde_new lgwr async val
 id_for=(online_logfiles,primar
 y_role) db_unique_name=sdedg

    參數(shù)設(shè)置正常了,備庫重新開同步看能否正常

SQL> recover managed standby database using current logfile disconnect;
Media recovery complete.

     備庫查看日志應(yīng)用進(jìn)度,在主庫查看已經(jīng)歸檔的sequence號(hào)

SQL> SELECT al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied" 
         FROM (select thread# thrd, MAX(sequence#) almax 
               FROM v$archived_log WHERE resetlogs_change#=(SELECT resetlogs_change# FROM v$database) GROUP BY thread#) al, 
              (SELECT thread# thrd, MAX(sequence#) lhmax 
                FROM v$log_history WHERE resetlogs_change#=(SELECT resetlogs_change# FROM v$database) GROUP BY thread#) lh 
         WHERE al.thrd = lh.thrd;
Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
 1               143              143
 2               138              138
SQL> archive log list 
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     138
Next log sequence to archive   144
Current log sequence           144

    等同步完成,開啟ADG

SQL> recover managed standby database cancel;
Media recovery complete.
SQL> 
SQL> alter database open ;
Database altered.
SQL> 
SQL> recover managed standby database using current logfile disconnect;
Media recovery complete.
SQL> 
SQL> set lines 1000
SQL> select PROCESS,PID,STATUS, GROUP# , RESETLOG_ID,THREAD#,SEQUENCE# from v$managed_standby;
PROCESS          PID STATUS       GROUP#                                   RESETLOG_ID    THREAD#  SEQUENCE#
--------- ---------- ------------ ---------------------------------------- ----------- ---------- ----------
ARCH           22841 CONNECTED    N/A                                                0          0          0
ARCH           22843 CONNECTED    N/A                                                0          0          0
ARCH           22845 CLOSING      15                                         984123832          1        143
ARCH           22847 CLOSING      22                                         984123832          2        138
MRP0            3116 APPLYING_LOG N/A                                        984123832          2        139
RFS             2722 IDLE         N/A                                                0          0          0
RFS             2892 IDLE         N/A                                                0          0          0
RFS             2894 IDLE         6                                          984123832          1        144
RFS             2896 IDLE         N/A                                                0          0          0
RFS             2928 IDLE         N/A                                                0          0          0
RFS             2930 IDLE         N/A                                                0          0          0
PROCESS          PID STATUS       GROUP#                                   RESETLOG_ID    THREAD#  SEQUENCE#
--------- ---------- ------------ ---------------------------------------- ----------- ---------- ----------
RFS             2932 IDLE         N/A                                                0          0          0
RFS             2948 IDLE         3                                          984123832          2        139
13 rows selected.

     現(xiàn)在DG同步正常了。


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI