IZ0-053 Q575(控制檔案丟失)

abstractcyj發表於2016-03-10
575.You have lost all your database control files. To recover them, you are going to use the results of the
alter database backup controlfile to trace command. Your datafiles and your online redo logs are all intact.
Which of the following is true regarding your recovery?
A. You will need to open the database with the resetlogs command.
B. All you need to do is execute the trace file from SQL*Plus and it will perform the recovery for you.
C. You will use the resetlogs version of the create controlfile command.
D. You will use the noresetlogs version of the create controlfile command.
E. You will use the trace file to create a backup control file, and then you will recover the database with the
recover database using backup controlfile command
Answer: D

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> alter database backup controlfile to trace;


Database altered.


SQL> select name from v$diag_info where name = 'Default Trace File';


NAME
----------------------------------------------------------------
Default Trace File


SQL> select value from v$diag_info where name = 'Default Trace File';


VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/inst1/inst1/trace/inst1_ora_2781.trc


SQL> select name from v$controlfile;


NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/inst1/control01.ctl
/u01/app/oracle/fast_recovery_area/inst1/control02.ctl


SQL> host rm /u01/app/oracle/oradata/inst1/control01.ctl


SQL> host rm /u01/app/oracle/fast_recovery_area/inst1/control02.ctl


SQL> alter database backup controlfile to trace;


Database altered.


SQL> shutdown immediate
Database closed.
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/inst1/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3




SQL> select sysdate from scott.emp;
select sysdate from scott.emp
                          *
ERROR at line 1:
ORA-01219: database not open: queries allowed on fixed tables/views only
SQL> CREATE CONTROLFILE REUSE DATABASE "INST1" NORESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '/u01/app/oracle/oradata/inst1/redo01.log'  SIZE 50M BLOCKSIZE 512,
  9    GROUP 2 '/u01/app/oracle/oradata/inst1/redo02.log'  SIZE 50M BLOCKSIZE 512,
 10    GROUP 3 '/u01/app/oracle/oradata/inst1/redo03.log'  SIZE 50M BLOCKSIZE 512
 11  -- STANDBY LOGFILE
 12  DATAFILE
 13    '/u01/app/oracle/oradata/inst1/system01.dbf',
 14    '/u01/app/oracle/oradata/inst1/sysaux01.dbf',
 15    '/u01/app/oracle/oradata/inst1/undotbs01.dbf',
 16    '/u01/app/oracle/oradata/inst1/users01.dbf',
 17    '/u01/app/oracle/oradata/inst1/example01.dbf'
 18  CHARACTER SET UTF8;
CREATE CONTROLFILE REUSE DATABASE "INST1" NORESETLOGS  ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01100: database already mounted




SQL> alter database nomount;
alter database nomount
                     *
ERROR at line 1:
ORA-02231: missing or invalid option to ALTER DATABASE




SQL> shutdown        
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/inst1/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> CREATE CONTROLFILE REUSE DATABASE "INST1" NORESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '/u01/app/oracle/oradata/inst1/redo01.log'  SIZE 50M BLOCKSIZE 512,
  9    GROUP 2 '/u01/app/oracle/oradata/inst1/redo02.log'  SIZE 50M BLOCKSIZE 512,
 10    GROUP 3 '/u01/app/oracle/oradata/inst1/redo03.log'  SIZE 50M BLOCKSIZE 512
 11  -- STANDBY LOGFILE
 12  DATAFILE
 13    '/u01/app/oracle/oradata/inst1/system01.dbf',
 14    '/u01/app/oracle/oradata/inst1/sysaux01.dbf',
 15    '/u01/app/oracle/oradata/inst1/undotbs01.dbf',
 16    '/u01/app/oracle/oradata/inst1/users01.dbf',
 17    '/u01/app/oracle/oradata/inst1/example01.dbf'
 18  CHARACTER SET UTF8
 19  /
CREATE CONTROLFILE REUSE DATABASE "INST1" NORESETLOGS  ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01100: database already mounted




SQL> shutdown 
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/inst1/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> shutdown abort 
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.


Total System Global Area  413372416 bytes
Fixed Size                  2253784 bytes
Variable Size             314575912 bytes
Database Buffers           88080384 bytes
Redo Buffers                8462336 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "INST1" NORESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '/u01/app/oracle/oradata/inst1/redo01.log'  SIZE 50M BLOCKSIZE 512,
  9    GROUP 2 '/u01/app/oracle/oradata/inst1/redo02.log'  SIZE 50M BLOCKSIZE 512,
 10    GROUP 3 '/u01/app/oracle/oradata/inst1/redo03.log'  SIZE 50M BLOCKSIZE 512
 11  -- STANDBY LOGFILE
 12  DATAFILE
 13    '/u01/app/oracle/oradata/inst1/system01.dbf',
 14    '/u01/app/oracle/oradata/inst1/sysaux01.dbf',
 15    '/u01/app/oracle/oradata/inst1/undotbs01.dbf',
 16    '/u01/app/oracle/oradata/inst1/users01.dbf',
 17    '/u01/app/oracle/oradata/inst1/example01.dbf'
 18  CHARACTER SET UTF8
 19  /


Control file created.


SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01100: database already mounted




SQL> alter database open ^H;
alter database open 
                    *
ERROR at line 1:
ORA-00911: invalid character




SQL> alter database open;


Database altered.


SQL> 


alter database backup controlfile to trace產生的trace檔案的內容:
--     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 "INST1" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/u01/app/oracle/oradata/inst1/redo01.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 2 '/u01/app/oracle/oradata/inst1/redo02.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 3 '/u01/app/oracle/oradata/inst1/redo03.log'  SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u01/app/oracle/oradata/inst1/system01.dbf',
  '/u01/app/oracle/oradata/inst1/sysaux01.dbf',
  '/u01/app/oracle/oradata/inst1/undotbs01.dbf',
  '/u01/app/oracle/oradata/inst1/users01.dbf',
  '/u01/app/oracle/oradata/inst1/example01.dbf'
CHARACTER SET UTF8
;


從重新建立控制檔案的過程中可以看出,不需要使用resetlogs選項



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8520577/viewspace-2054509/,如需轉載,請註明出處,否則將追究法律責任。

相關文章