如何恢復在全備後新增了資料檔案的資料庫
參考
How to Recover a Database Having Added a Datafile Since Last Backup (文件 ID 29430.1)
How to Recover a Database Having Added a Datafile Since Last Backup (文件 ID 29430.1)
HOW TO RECOVER A DATABASE HAVING ADDED A DATAFILE SINCE THE LAST BACKUP
-----------------------------------------------------------------------
This bulletin outlines the steps required in performing database recovery
having added a datafile to the database since the last backup was taken.
Section A is applicable to Oracle release 7.x. Section B applies only to
Oracle releases 7.3.x and above.
PLEASE READ THROUGH ALL STEPS AND WARNINGS BEFORE ATTEMPTING TO USE THIS
BULLETIN.
A. Current controlfile, backup of datafile exists (Oracle release 7.x)
===================================================================
A valid (either hot or cold) backup of the datafiles exists, except for the
datafile created since the backup was taken. The current controlfile exists.
The database is in archivelog mode (see note (c) at bottom of page).
1. Restore ONLY the datafiles (those that have been lost or damaged) from the
last hot or cold backup. The current online redo logs and control file(s)
must be intact.
2. Mount the database
3. Create a new datafile using the 'ALTER DATABASE CREATE DATAFILE' command.
a. The datafile can be created with the same name as the original
file. For example,
SQLDBA> alter database create datafile
2> '/dev1/oracle/dbs/testtbs.dbf';
Statement processed.
b. The datafile can be created with a different filename to the original.
This option might be chosen if the original file was lost due to disk
failure and the failed disk was still unavailable; the new file would
then be created on a different device. For example,
SQLDBA> alter database create datafile
2> '/dev1/oracle/dbs/testtbs.dbf'
3> as
4> '/dev2/oracle/dbs/testtbs.dbf';
Statement processed.
The above command creates a new datafile on the dev2 device. The file
is created using information, stored in the control file, from the
original file. The command implicitly renames the filename in the
control file.
NOTE: IT IS VERY IMPORTANT TO SPECIFY THE CORRECT FILENAME WHEN
RECREATING THE LOST DATAFILE. IF YOU SPECIFY AN EXISTING
ORACLE DATAFILE, THAT DATAFILE WILL BE INITIALISED AND WILL
ITSELF REQUIRE RECOVERY.
4. Recover the database.
SQLDBA> recover database
ORA-00279: Change 6677 generated at 06/03/97 15:20:24 needed for thread 1
ORA-00289: Suggestion : /dev1/oracle/dbs/arch/arch000074.arc
ORA-00280: Change 6677 for thread 1 is in sequence #74
Specify log: {=suggested | filename | AUTO | CANCEL}
At this point the recovery procedure will wait for the user to supply the
information requested regarding the name and location of the archived log
files. For example, entering AUTO directs Oracle to apply the suggested
redo log and any others that it requires to recover the datafiles.
Applying suggested logfile...
Log applied.
:
:
:
:
Media recovery complete.
5. Open the database
SQLDBA> alter database open;
Statement processed.
B. Old controlfile, no backup of datafile (Oracle release 7.3.x and above)
=======================================================================
A valid (either hot or cold) backup of the datafiles exists, except for the
datafile created since the backup was taken. The controlfile is a backup from
before the creation of the new datafile. The database is in archivelog mode
(see note (c) at bottom of page).
NOTE : 'svrmgrl' has been replaced by SQL*Plus starting from Oracle8i
So the 'SVRMGR>' prompt is than replaced by 'SQL>'
1. Restore the datafiles (those that have been lost or damaged) from the
last hot or cold backup. Also restore the old copy of the controlfile.
The current online redo logs must be intact.
2. Mount the database
3. Start media recovery, specifying backup controlfile
SVRMGR> recover database using backup controlfile
ORA-00279: Change 6677 generated at 06/03/97 15:20:24 needed for thread 1
ORA-00289: Suggestion : /dev1/oracle/dbs/arch/arch000074.arc
ORA-00280: Change 6677 for thread 1 is in sequence #74
Specify log: {=suggested | filename | AUTO | CANCEL}
At this point, apply the archived logs as requested. Eventually Oracle
will encounter redo to be applied to the non-existent datafile. The
recovery session will exit with the following message, and will return
the user to the Server Manager prompt:
ORA-00283: Recovery session canceled due to errors
ORA-01244: unnamed datafile(s) added to controlfile by media recovery
ORA-01110: data file 5: '/dev1/oracle/dbs/testtbs.dbf'
4. Recreate the missing datafile. To do this, select the relevant filename
from v$datafile:
SVRMGR> select name from v$datafile where file#=5;
NAME
-------------------------------------------------------
UNNAMED0005
Now recreate the file:
SVRMGR> alter database create datafile
2> 'UNNAMED0005'
3> as
4> '/dev1/oracle/dbs/testtbs.dbf';
5. Restart recovery
SVRMGR> recover database using backup controlfile
ORA-00279: Change 6747 generated at 09/24/97 16:57:18 needed for thread 1
ORA-00289: Suggestion : /dev1/oracle/dbs/arch/arch000079.arc
ORA-00280: Change 6747 for thread 1 is in sequence #79
Specify log: {=suggested | filename | AUTO | CANCEL}
Apply archived logs as requested. Prior to Oracle8, recovery must apply
the complete log which was current at the time of the datafile creation
(in the above example, this would be log sequence 79). A recovery to a
point in time before the end of this log would result in errors:
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '/dev1/oracle/dbs/systbs.dbf'
If this happens, re-recover the database and ensure that the complete log
is applied (plus any further redo if required). This limitation does
not exist from Oracle 8.0+.
Eventually, Oracle will request the archived log corresponding to the
current online log. It does this because the (backup) controlfile has no
knowledge of the current log sequence. If an attempt is made to apply the
suggested log, the recovery session will exit with the following message:
ORA-00308: cannot open archived log '/dev1/oracle/dbs/arch/arch000084.arc'
ORA-07360: sfifi: stat error, unable to obtain information about file.
SVR4 Error: 2: No such file or directory
At this stage, simply restart the recovery session and apply the current
online log. The best way to do this is to try applying the online redo
logs one by one until Oracle completes media recovery:
SVRMGR> recover database using backup controlfile
ORA-00279: Change 6763 generated at 09/24/97 16:57:59 needed for thread 1
ORA-00289: Suggestion : /dev1/oracle/dbs/arch/arch000084.arc
ORA-00280: Change 6763 for thread 1 is in sequence #84
Specify log: {=suggested | filename | AUTO | CANCEL}
/dev1/oracle/dbs/log2.dbf
Log applied.
Media recovery complete.
6. Open the database
SVRMGR> alter database open resetlogs;
The resetlogs option must be chosen to resynchronize the controlfile.
NOTES:
======
a) These techniques can be used whether the database was closed either
cleanly or uncleanly (aborted).
b) If the database is recovered using an incomplete recovery technique (either
time-based, cancel-based, or change-based), and is recovered to a point in
time before the datafile was originally created, any references to that
datafile will be removed from the database when the database is opened.
Oracle handles this situation as follows:
- The 'alter database create datafile....' command creates a reference in
the controlfile for the datafile.
- Incomplete recovery terminates before applying redo that would create a
corresponding row for the datafile in the file$ dictionary table.
- When the database is opened, Oracle detects an inconsistency between file$
and the controlfile and resolves in favour of file$, deleting the entry
from the controlfile.
c) It may be possible to recover the datafile using this technique even if the
database is not in archivelog mode. However, this relies on the required
redo being available in the online redo logs.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29135257/viewspace-2153751/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SQL Server 2008資料庫新增資料檔案後Standby庫的恢復SQLServer資料庫
- 【資料庫資料恢復】MongoDB資料庫檔案損壞的資料恢復案例資料庫資料恢復MongoDB
- Oracle資料庫控制檔案在備份恢復中的作用Oracle資料庫
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- 使用備份的控制檔案恢復資料庫資料庫
- 備份與恢復--重建控制檔案後資料檔案損壞的恢復
- rman資料庫全庫備份與恢復資料庫
- 新增資料檔案與恢復cf
- ORACLE9I RMAN恢復資料庫後需要手工新增臨時資料檔案Oracle資料庫
- 【資料庫資料恢復】Sql Server資料庫檔案丟失的資料恢復過程資料庫資料恢復SQLServer
- RMAN資料庫恢復 之歸檔模式有(無)備份-丟失資料檔案的恢復資料庫模式
- rman恢復資料庫--用備份的控制檔案資料庫
- 資料庫備份與恢復(使用歸檔後滾)資料庫
- 資料庫資料恢復-SQL SERVER資料庫檔案大小變為“0”的資料恢復方案資料庫資料恢復SQLServer
- 【資料庫資料恢復】如何恢復Oracle資料庫truncate表的資料資料庫資料恢復Oracle
- 利用rman全備恢復刪除的資料庫資料庫
- 資料庫在沒有備份的情況下的資料檔案損壞的恢復資料庫
- 【資料庫資料恢復】Oracle資料庫檔案出現壞塊報錯的資料恢復案例資料庫資料恢復Oracle
- 資料庫資料恢復—MongoDB資料庫檔案丟失,啟動報錯的資料恢復案例資料庫資料恢復MongoDB
- 資料庫資料的恢復和備份資料庫
- 歸檔模式無備份丟失資料檔案後恢復模式
- 歸檔模式有備份丟失資料檔案後恢復模式
- 使用冷備份與冷備份後的資料庫歸檔日誌檔案進行資料庫不完整恢復資料庫
- Bak檔案恢復到資料庫資料庫
- 【資料庫資料恢復】EXT3檔案系統下MYSQL資料庫恢復案例資料庫資料恢復MySql
- Oracle備份與恢復【丟失資料檔案的恢復】Oracle
- Polardb資料庫掛庫後,如何恢復主備關係資料庫
- 【備份恢復】從備份恢復資料庫資料庫
- 在open狀態下恢復未備份的資料檔案
- rman備份恢復-rman恢復資料檔案測試
- 只有.dbf資料檔案進行資料庫恢復資料庫
- 資料檔案丟失如何恢復
- SqlServer資料庫恢復備份資料的方法SQLServer資料庫
- rman 全庫恢復asm資料庫ASM資料庫
- 沒有備份的資料檔案恢復(五)
- 【資料庫資料恢復】mdb_catalog.wt檔案丟失的MongoDB資料恢復案例資料庫資料恢復MongoDB
- 【資料庫資料恢復】SAP資料庫資料恢復案例資料庫資料恢復
- 歸檔模式下資料庫全恢復的過程模式資料庫