backup incremental level=0 database format '/home/oracle/rman/%U'; SYS@prod>create table test as  select * from dba_objects..."/>
溫馨提示×

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

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

Oracle 無(wú)關(guān)緊要的RMAN-06054

發(fā)布時(shí)間:2020-08-11 12:39:08 來(lái)源:ITPUB博客 閱讀:445 作者:DBhanG 欄目:關(guān)系型數(shù)據(jù)庫(kù)

RMAN>  backup incremental level=0 database format '/home/oracle/rman/%U';

SYS@prod>create table test as  select * from dba_objects;

Table created.

SYS@prod>insert into test select * from test;

86959 rows created.

SYS@prod>/

173918 rows created.

SYS@prod>/

347836 rows created.

SYS@prod>insert into test select * from test;

695672 rows created.

SYS@prod>commit;

Commit complete

SYS@prod>select count(*) from test;

  COUNT(*)

----------

   1391344

SYS@prod>select group#,status from v$log;

    GROUP# STATUS

---------- ----------------

 1 ACTIVE

 2 ACTIVE

 3 CURRENT

查看當(dāng)前控制文件頭部和數(shù)據(jù)文件頭部 SCN號(hào):

SYS@prod>select checkpoint_change# from v$datafile;

CHECKPOINT_CHANGE#

------------------

   1198910

   1198910

   1198910

   1198910

   1198910

SYS@prod>select checkpoint_change# from v$datafile_header;

CHECKPOINT_CHANGE#

------------------

   1198984

   1198984

   1198984

   1198984

   1198984

進(jìn)行一次增量備份:

RMAN> backup incremental level=1 database format '/home/oracle/rman/%U';

然后再次查看SCN:

SYS@prod>select checkpoint_change# from v$datafile;

CHECKPOINT_CHANGE#

------------------

   1199201

   1199201

   1199201

   1199201

   1199201

SYS@prod>select checkpoint_change# from v$datafile;

CHECKPOINT_CHANGE#

------------------

   1199201

   1199201

   1199201

   1199201

   1199201

SYS@prod>select group#,status from v$log;

    GROUP# STATUS

---------- ----------------

 1 INACTIVE

 2 INACTIVE

 3 CURRENT

可以看出:SCN 號(hào)同步刷新,日志組狀態(tài)改變, RMAN 備份與熱備份性質(zhì)一樣,都會(huì)在備份前做一個(gè)完全檢查點(diǎn),將臟塊刷新回?cái)?shù)據(jù)文件。

此時(shí)刪除全部的文件進(jìn)行恢復(fù):

[oracle@service1 prod]$ ls

control01.ctl  redo01.log  redo03.log    system01.dbf  undotbs01.dbf

example01.dbf  redo02.log  sysaux01.dbf  temp01.dbf    users01.dbf

[oracle@service1 prod]$ rm -rf  *

[oracle@service1 ~]$ sqlplus / as sysdba

SYS@prod>shutdown abort;

SYS@prod>startup nomount;

[oracle@service1 ~]$ rman target /

RMAN> restore controlfile from '/home/oracle/rman/1mv1thi1_1_1';

RMAN> sql ' alter database mount';

RMAN> restore database;

RMAN> recover database

Starting recover at 04-JUN-20

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=125 device type=DISK

channel ORA_DISK_1: starting incremental datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

destination for restore of datafile 00001: /u01/app/oracle/oradata/prod/system01.dbf

destination for restore of datafile 00002: /u01/app/oracle/oradata/prod/sysaux01.dbf

destination for restore of datafile 00003: /u01/app/oracle/oradata/prod/undotbs01.dbf

destination for restore of datafile 00004: /u01/app/oracle/oradata/prod/users01.dbf

destination for restore of datafile 00005: /u01/app/oracle/oradata/prod/example01.dbf

channel ORA_DISK_1: reading from backup piece /home/oracle/rman/1lv1thgk_1_1

channel ORA_DISK_1: piece handle=/home/oracle/rman/1lv1thgk_1_1 tag=TAG20200604T130939

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:07

starting media recovery

unable to find archived log

archived log thread=1 sequence=6

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 06/04/2020 13:17:35

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 6 and starting SCN of 1199201

這個(gè)錯(cuò)誤是什么原因呢:

redo 日志不可用,控制文件找不到 redo 日志作為結(jié)尾,所以會(huì)一直讀歸檔,直至找不到,無(wú)關(guān)緊要的報(bào)錯(cuò),可以查看 SCN 來(lái)確定是否一致)

RMAN恢復(fù)過(guò)程中,如果redo日志是可用的,那么RMAN可以找到他們并應(yīng)用這些日志。如果redo日志不可用,此時(shí)就需要until子句指定修復(fù)的目標(biāo)時(shí)間,SCN或日志序列號(hào),他們是在聯(lián)機(jī)重做日志的第一個(gè)SCN之前,否則RMAN會(huì)出現(xiàn)RMAN-6054錯(cuò)誤。

如果最后創(chuàng)建的歸檔日志具有序列號(hào)n,那么指定until sequence n+1進(jìn)行恢復(fù)就不會(huì)出現(xiàn)錯(cuò)誤。

解決辦法:

Run{

Restore database

Set until sequence 6

Recover database

}

SYS@prod>select checkpoint_change# from v$datafile;

CHECKPOINT_CHANGE#

------------------

   1199201

   1199201

   1199201

   1199201

   1199201

SYS@prod>select checkpoint_change# from v$datafile_header;

CHECKPOINT_CHANGE#

------------------

   1199201

   1199201

   1199201

   1199201

   1199201

SYS@prod>alter database open resetlogs;

Database altered.

SYS@prod>select count(*) from test;

  COUNT(*)

----------

   1391344

數(shù)據(jù)無(wú)丟失。

向AI問(wèn)一下細(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