控制檔案的恢復方法(四)
控制檔案的通常恢復方法有:
1、從控制檔案自動或二進位制備份中恢復
2、從控制檔案快照備份中恢復
3、控制檔案trace檔案備份中恢復
4、Oracle自動生成的控制檔案指令碼恢復
如下對相關的步驟及語法進行介紹:
4、Oracle自動生成的控制檔案指令碼恢復
在搭建Oracle Data Guard環境時,primary在SWITCHOVER TO PHYSICAL STANDBY時會自動在udump目錄中產生一份trace,其中有重新建立控制檔案的指令碼。
如果單節點的(不是RAC)的災備系統則,關閉備庫後,按前面介紹的方法恢復即可;
[@more@]如果主庫為RAC環境,則按如下步驟進行:
1.將另一個節點叢集服務停止。
$ srvctl stop nodeapps -n testdb2
2.修改cluster_database 引數(否則會報 ORA-12720 錯誤)。
SQL> alter system set cluster_database=FALSE scope=spfile sid='test2';
3.停庫。
SQL> shutdown immediate
4.nomount資料庫。
SQL> startup nomount
5.使用norestlog 版SQL重建控制檔案。
SQL>@createctlf.sql
6.恢復資料庫(如確實需要執行恢復操作)後開啟主庫。
SQL> recover database;
SQL> alter database open;
另外在官方文件也提到了手工建立新的控制方法及說明,如下摘取了關鍵內容:
The CREATE CONTROLFILE Statement
You can create a new control file for a database using the CREATE CONTROLFILE statement. The following statement creates a new control file for the prod database (a database that formerly used a different database name):
CREATE
CONTROLFILE
SET DATABASE prod
LOGFILE GROUP 1
('/u01/oracle/prod/redo01_01.log',
'/u01/oracle/prod/redo01_02.log'),
GROUP 2
('/u01/oracle/prod/redo02_01.log',
'/u01/oracle/prod/redo02_02.log'),
GROUP 3
('/u01/oracle/prod/redo03_01.log',
'/u01/oracle/prod/redo03_02.log')
RESETLOGS
DATAFILE
'/u01/oracle/prod/system01.dbf' SIZE 3M,
'/u01/oracle/prod/rbs01.dbs'
SIZE 5M,
'/u01/oracle/prod/users01.dbs'
SIZE 5M,
'/u01/oracle/prod/temp01.dbs'
SIZE 5M
MAXLOGFILES 50
MAXLOGMEMBERS 3
MAXLOGHISTORY 400
MAXDATAFILES 200
MAXINSTANCES 6
ARCHIVELOG;
Cautions:
- The CREATE CONTROLFILE statement can potentially damage specified datafiles and redo log files. Omitting a filename can cause loss of the data in that file, or loss of access to the entire database. Use caution when issuing this statement and be sure to follow the instructions in .
- If the database had forced logging enabled before creating the new control file, and you want it to continue to be enabled, then you must specify the FORCE LOGGING clause in the CREATE CONTROLFILE statement. See .
See Also:
describes the complete syntax of the CREATE CONTROLFILE statement
Steps for Creating New Control Files
Complete the following steps to create a new control file.
- Make
a list of all datafiles and redo log files of the database.
If you follow recommendations for control file backups as discussed in , you will already have a list of datafiles and redo log files that reflect the current structure of the database. However, if you have no such list, executing the following statements will produce one.
SELECT MEMBER FROM V$LOGFILE;
SELECT NAME FROM V$DATAFILE;
SELECT VALUE FROM V$PARAMETER WHERE NAME = 'control_files';
If you have no such lists and your control file has been damaged so that the database cannot be opened, try to locate all of the datafiles and redo log files that constitute the database. Any files not specified in step are not recoverable once a new control file has been created. Moreover, if you omit any of the files that make up the SYSTEM tablespace, you might not be able to recover the database. - Shut down the database.
If the database is open, shut down the database normally if possible. Use the IMMEDIATE or ABORT clauses only as a last resort. - Back up all datafiles and redo log files of the database.
- Start up a new instance, but
do not mount or open the database:
STARTUP NOMOUNT - Create a new
control file for the database using the CREATE CONTROLFILE
statement.
When creating a new control file, specify the RESETLOGS clause if you have lost any redo log groups in addition to control files. In this case, you will need to recover from the loss of the redo logs (step ). You must specify the RESETLOGS clause if you have renamed the database. Otherwise, select the NORESETLOGS clause. - Store a backup of the new control file on an offline storage device. See for instructions for creating a backup.
- Edit the CONTROL_FILES initialization parameter for the database to indicate all of the control files now part of your database as created in step (not including the backup control file). If you are renaming the database, edit the DB_NAME parameter in your instance parameter file to specify the new name.
- Recover the
database if necessary. If you are not recovering the database, skip to
step .
If you are creating the control file as part of recovery, recover the database. If the new control file was created using the NORESETLOGS clause (step ), you can recover the database with complete, closed database recovery.
If the new control file was created using the RESETLOGS clause, you must specify USING BACKUP CONTROL FILE. If you have lost online or archived redo logs or datafiles, use the procedures for recovering those files.
See Also:
and for information about recovering your database and methods of recovering a lost control file - Open the database using one of the following methods:
- If you did not
perform recovery, or you performed complete, closed database recovery in
step , open the
database normally.
ALTER DATABASE OPEN;
- If you specified RESETLOGS
when creating the control file, use the ALTER DATABASE statement,
indicating RESETLOGS.
ALTER DATABASE OPEN RESETLOGS;
The database is now open and available for use.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-1058557/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 控制檔案的恢復方法(一)
- 控制檔案的恢復方法(二)
- 控制檔案的恢復方法(三)
- 損壞控制檔案的恢復方法
- 控制檔案恢復—從trace檔案中恢復
- rman恢復--丟失控制檔案的恢復
- RMAN恢復控制檔案
- 手工恢復控制檔案
- 【備份恢復】利用 備份控制檔案到指定目錄下的控制檔案 恢復控制檔案
- 控制檔案恢復—從快照中恢復
- 恢復丟失的控制檔案
- 誤刪除資料檔案、控制檔案的非RMAN恢復方法
- 【備份與恢復】控制檔案的恢復(不完全恢復)
- 使用舊的控制檔案備份來恢復控制檔案
- cp方式恢復控制檔案
- 控制檔案恢復測試
- 控制檔案丟失恢復
- 【控制檔案丟失恢復】
- 使用rman恢復控制檔案
- RMAN備份恢復之控制檔案的恢復(三)
- RMAN備份恢復之控制檔案的恢復(二)
- RMAN備份恢復之控制檔案的恢復(一)
- 控制檔案被破壞的資料庫恢復方法資料庫
- 與控制檔案有關的恢復
- RMAN - "丟失控制檔案的恢復"
- 利用備份的控制檔案恢復
- 控制檔案全部丟失的恢復
- 控制檔案部分丟失的恢復
- 控制檔案的備份和恢復
- 重建控制檔案的恢復(noresetlogs)
- 控制檔案丟失的RMAN恢復
- 恢復之利用備份在所有控制檔案丟失情況下恢復(四)
- 備份與恢復--利用備份的控制檔案恢復
- Oracle備份與恢復【丟失控制檔案的恢復】Oracle
- 控制檔案丟失恢復(二)
- 控制檔案全部丟失恢復
- 引數檔案的恢復方法
- 備份與恢復--重建控制檔案後資料檔案損壞的恢復