不完全恢復 - 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 鹽城小土包 閱讀(157) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2012年10月>
          30123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案(14)

          文章分類(18)

          文章檔案(18)

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 大余县| 昌吉市| 嘉荫县| 体育| 庆元县| 太和县| 阿拉尔市| 大港区| 蕉岭县| 竹北市| 淅川县| 波密县| 内丘县| 长岭县| 潢川县| 靖边县| 建宁县| 太和县| 蛟河市| 昌图县| 菏泽市| 民丰县| 青海省| 饶平县| 乃东县| 郓城县| 江华| 德惠市| 子洲县| 浮梁县| 麻阳| 禹城市| 酉阳| 桦南县| 鲁山县| 镇赉县| 东台市| 绵阳市| 大港区| 原平市| 龙海市|