不完全恢复 - ctl - create - script

控制文件
生成create 控制文件的脚本。
  • resetlogs / noresetlogs(默认)
  • 通过脚本创建控制文件,会丢失很多信息(归档日志信息等)
  • 虽然丢失一部分信息,但是有些还是可以注册回去的:
    SQL> alter database register physical logfile '***';
-- 注明noresetlogs
SQL> alter database backup controlfile to trace noresetlogs;
数据库已更改。

-- 没有注明noresetlogs,则会生成两份脚本:一份是noresetlogs,一份是resetlogs
SQL> alter database backup controlfile to trace as 'd:\control.txt';
数据库已更改。

生成控制文件的脚本信息:
-- The following are current System-scope REDO Log Archival related
--
 parameters and can be included in the database initialization file.
--
--
 LOG_ARCHIVE_DEST=''
--
 LOG_ARCHIVE_DUPLEX_DEST=''
--
--
 LOG_ARCHIVE_FORMAT=ARC%S_%R.%T
--
--
 DB_UNIQUE_NAME="orcl"
--
--
 LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
--
 LOG_ARCHIVE_MAX_PROCESSES=4
--
 STANDBY_FILE_MANAGEMENT=MANUAL
--
 STANDBY_ARCHIVE_DEST=%ORACLE_HOME%\RDBMS
--
 FAL_CLIENT=''
--
 FAL_SERVER=''
--
--
 LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE_DEST'
--
 LOG_ARCHIVE_DEST_10='OPTIONAL REOPEN=300 NODELAY'
--
 LOG_ARCHIVE_DEST_10='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
--
 LOG_ARCHIVE_DEST_10='REGISTER NOALTERNATE NODEPENDENCY'
--
 LOG_ARCHIVE_DEST_10='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
--
 LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
--
 LOG_ARCHIVE_DEST_STATE_10=ENABLE
--
--
 LOG_ARCHIVE_DEST_1='LOCATION=D:\app\Administrator\flash_recovery_area'
--
 LOG_ARCHIVE_DEST_1='OPTIONAL REOPEN=300 NODELAY'
--
 LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
--
 LOG_ARCHIVE_DEST_1='REGISTER NOALTERNATE NODEPENDENCY'
--
 LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
--
 LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
--
 LOG_ARCHIVE_DEST_STATE_1=DEFER

--
--
 Below are two sets of SQL statements, each of which creates a new
--
 control file and uses it to open the database. The first set opens
--
 the database with the NORESETLOGS option and should be used only if
--
 the current versions of all online logs are available. The second
--
 set opens the database with the RESETLOGS option and should be used
--
 if online logs are unavailable.
--
 The appropriate set of statements can be copied from the trace into
--
 a script file, edited as necessary, and executed when there is a
--
 need to re-create the control file.
--
--
     Set #1. NORESETLOGS case
--
--
 The following commands will create a new control file and use it
--
 to open the database.
--
 Data used by Recovery Manager will be lost.
--
 Additional logs may be required for media recovery of offline
--
 Use this only if the current versions of all online logs are
--
 available.

-- After mounting the created controlfile, the following SQL
--
 statement will place the database in the appropriate
--
 protection mode:
--
  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 
16
    MAXLOGMEMBERS 
3
    MAXDATAFILES 
100
    MAXINSTANCES 
8
    MAXLOGHISTORY 
292
LOGFILE
  
GROUP 1 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG'  SIZE 50M BLOCKSIZE 512,
  
GROUP 2 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG'  SIZE 50M BLOCKSIZE 512,
  
GROUP 3 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG'  SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE

DATAFILE
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF',
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF',
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF',
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF',
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SAMPLE.DBF'
CHARACTER SET AL32UTF8
;

-- Commands to re-create incarnation table
--
 Below log names MUST be changed to existing filenames on
--
 disk. Any one log file from each branch can be used to
--
 re-create incarnation records.
--
 ALTER DATABASE REGISTER LOGFILE 'D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2012_10_15\O1_MF_1_1_%U_.ARC';
--
 ALTER DATABASE REGISTER LOGFILE 'D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2012_10_15\O1_MF_1_1_%U_.ARC';
--
 Recovery is required if any of the datafiles are restored backups,
--
 or if the last shutdown was not normal or immediate.
RECOVER DATABASE

-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;

-- Database can now be opened normally.
ALTER DATABASE OPEN;

-- Commands to add tempfiles to temporary tablespaces.
--
 Online tempfiles have complete space information.
--
 Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF'
     SIZE 
30408704  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
--
--
     Set #2. RESETLOGS case
--
--
 The following commands will create a new control file and use it
--
 to open the database.
--
 Data used by Recovery Manager will be lost.
--
 The contents of online logs will be lost and all backups will
--
 be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL
--
 statement will place the database in the appropriate
--
 protection mode:
--
  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 
16
    MAXLOGMEMBERS 
3
    MAXDATAFILES 
100
    MAXINSTANCES 
8
    MAXLOGHISTORY 
292
LOGFILE
  
GROUP 1 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG'  SIZE 50M BLOCKSIZE 512,
  
GROUP 2 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG'  SIZE 50M BLOCKSIZE 512,
  
GROUP 3 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG'  SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE

DATAFILE
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF',
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF',
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF',
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF',
  
'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SAMPLE.DBF'
CHARACTER SET AL32UTF8
;

-- Commands to re-create incarnation table
--
 Below log names MUST be changed to existing filenames on
--
 disk. Any one log file from each branch can be used to
--
 re-create incarnation records.
--
 ALTER DATABASE REGISTER LOGFILE 'D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2012_10_15\O1_MF_1_1_%U_.ARC';
--
 ALTER DATABASE REGISTER LOGFILE 'D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2012_10_15\O1_MF_1_1_%U_.ARC';
--
 Recovery is required if any of the datafiles are restored backups,
--
 or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE

-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

-- Commands to add tempfiles to temporary tablespaces.
--
 Online tempfiles have complete space information.
--
 Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF'
     SIZE 
30408704  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
--

为什么,数据库知道,控制文件的数量和位置呢?
-- 通过系统参数
SQL> show parameter control_files;
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
control_files                        string                 D:\APP\ADMINISTRATOR\ORADATA\O
                                                            RCL\CONTROL01.CTL, D:\APP\ADMI
                                                            NISTRATOR\FLASH_RECOVERY_AREA\
                                                            ORCL\CONTROL02.CTL

posted on 2012-10-15 22:39 盐城小土包 阅读(146) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 
<2012年10月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

导航

统计

常用链接

留言簿

随笔档案(14)

文章分类(18)

文章档案(18)

搜索

最新评论

阅读排行榜

评论排行榜