如何恢復在全備後新增了資料檔案的資料庫
參考
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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【資料庫資料恢復】MongoDB資料庫檔案損壞的資料恢復案例資料庫資料恢復MongoDB
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- 【資料庫資料恢復】Sql Server資料庫檔案丟失的資料恢復過程資料庫資料恢復SQLServer
- 資料庫資料恢復-SQL SERVER資料庫檔案大小變為“0”的資料恢復方案資料庫資料恢復SQLServer
- 資料庫資料恢復—MongoDB資料庫檔案丟失,啟動報錯的資料恢復案例資料庫資料恢復MongoDB
- 【資料庫資料恢復】Oracle資料庫檔案出現壞塊報錯的資料恢復案例資料庫資料恢復Oracle
- 【資料庫資料恢復】如何恢復Oracle資料庫truncate表的資料資料庫資料恢復Oracle
- Polardb資料庫掛庫後,如何恢復主備關係資料庫
- 【資料庫資料恢復】EXT3檔案系統下MYSQL資料庫恢復案例資料庫資料恢復MySql
- 資料庫備份恢復資料庫
- 【資料庫資料恢復】mdb_catalog.wt檔案丟失的MongoDB資料恢復案例資料庫資料恢復MongoDB
- 資料庫資料恢復—無備份,binlog未開啟的Mysql資料庫資料恢復案例資料庫資料恢復MySql
- SqlServer資料庫恢復備份資料的方法SQLServer資料庫
- MongoDB資料庫報錯,資料庫檔案丟失資料恢復案例MongoDB資料庫資料恢復
- 怎樣恢復Mac檔案及資料夾資料?BackupLoupe for mac(資料恢復備份助手)3.5.4Mac資料恢復
- 【資料庫資料恢復】SAP資料庫資料恢復案例資料庫資料恢復
- MSSQL資料庫資料恢復案例:ndf檔案大小變為0KB恢復資料SQL資料庫資料恢復
- 資料庫資料恢復—NTFS分割槽損壞如何恢復SqlServer資料庫資料資料庫資料恢復SQLServer
- 【資料庫資料恢復】Oracle資料庫ASM磁碟組掉線如何恢復資料?資料庫資料恢復OracleASM
- 【資料庫資料恢復】windows server下SqlServer資料庫的資料恢復資料庫資料恢復WindowsServerSQL
- 【資料庫資料恢復】Sql Server資料庫資料恢復案例資料庫資料恢復SQLServer
- mongodb資料庫備份與恢復(資料庫資料遷移)MongoDB資料庫
- 備份與恢復:polardb資料庫備份與恢復資料庫
- DG備庫手動管理 新增資料檔案
- 【北亞資料庫資料恢復】使用delete未加where子句刪除全表資料的Mysql資料庫資料恢復資料庫資料恢復deleteMySql
- SQL SEVER 缺少LOG檔案資料庫恢復SQL資料庫
- 【資料庫資料恢復】Oracle資料庫誤truncate table的資料恢復案例資料庫資料恢復Oracle
- 【資料庫資料恢復】誤truncate table的Oracle資料庫資料恢復方案資料庫資料恢復Oracle
- PostgreSql資料庫的備份和恢復SQL資料庫
- 【資料庫資料恢復】SQL server資料庫被加密怎麼辦?如何恢復?資料庫資料恢復SQLServer加密
- 伺服器資料恢復-ext3檔案系統下oracle資料庫資料恢復案例伺服器資料恢復Oracle資料庫
- 資料庫資料恢復-SQL SERVER資料庫MDF (NDF)或LDF損壞如何恢復資料?資料庫資料恢復SQLServer
- 資料庫資料恢復-oracle資料庫報錯無法開啟的如何恢復資料?資料庫資料恢復Oracle
- 【資料庫資料恢復】LINUX EXT3檔案系統下ORACLE資料庫誤操作導致資料丟失的資料恢復案例資料庫資料恢復LinuxOracle
- Oracle資料庫冷備和恢復Oracle資料庫
- Mysql資料庫備份及恢復MySql資料庫
- 達夢資料庫備份恢復資料庫
- postgresql備份與恢復資料庫SQL資料庫