Recovery without backup under Oracle - control file / data file

13.3 No backup restore control file

No backup restore control file is in fact nomount state, the Create Control to create a new control file.

dba must know the 4 Messages to create the right: the database name , the online log path and size , line read / write data file path , the database character set

Which specifies the database character set is to be executed before opening the database recover tablespace .. or restore tablespace can be resolved correctly when the table space name

- Before dsi series introduced the use bbed view the data file header way to determine the character set, the database name and other methods.

- MAXLOGFILES online redo initial value of the maximum number of log group, can automatically increase 
- the initial value of the upper limit of the number of online journals in the maxlogmembers log group, can automatically increase 
- MAXLOGHISTORY record the initial value of the upper limit of the number of recently generated log history, can automatic growth 
- the initial value of the maximum number of maxdatafiles data files can grow automatically, but can not exceed the value of data_files. 
- MaxInstances number of instances can be open at the same database, for RAC environment must ensure that the value is greater than or equal to the number of nodes in the cluster

- Reconstructing the online log without damage

SQL > STARTUP NOMOUNT
 the CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG 
SQL > Recover Database ; 
SQL >  the ALTER  Database  Open ; 
SQL >  the SELECT  *  from v $ tempfile; 
add temporary table space 
## add temporary table space 
SQL >  the ALTER TABLESPACE the TEMP  the ADD TEMPFILE ' /u01/app/oracle/oradata/orcl/temp01.dbf ' SIZE 61,865,984   the REUSE AUTOEXTEND the ON  the NEXT  655360  MAXSIZE 32767M; 
if no catalog, control file after reconstruction, originally preserved in a backup control file, archived log information are lost 
RMAN > List Backup, a capability; 
RMAN > catalog db_recovery_file_des; ## catalog ordering them to be recovered using 
RMAN > Report need Backup ;
SQL>CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log'  SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u01/app/oracle/oradata/orcl/system01.dbf',
  '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
  '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
  '/u01/app/oracle/oradata/orcl/users01.dbf',
  '/u01/app/oracle/oradata/orcl/test01.dbf'
CHARACTER SET AL32UTF8
;
View Code

- Reconstructing the online journal damage

The control file is damaged and there is no backup, as well as damage to the online journal ( Current ), were used to reconstruct the control file and incomplete recovery solution

SQL> STARTUP NOMOUNT

CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS  ARCHIVELOG

Since the control file is new, this time v $ log \ v $ log_history not provide any information about the progress of the checkpoint.

We know that is not fully recovered, but lets rman first attempt to fully recover, and see how far it can go, without the use of catalog in the case of using the catalog backup and archive logs re-entry in the new control file

The RMAN > Catalog DB_RECOVERY_FILE_DEST; 
the RMAN > RUN {
 Restore  Database ; 
Recover Database ; 
} 
... 
the RMAN - 06 054 : Requesting Media Recovery Unknown Archived log  for thead . 1  with Sequence 22  and Starting the SCN of  1.08204 million 
will see the log 22 can not be , and may not fully recover debut 
RMAN > recover Database an until Sequence 22 ; 
RMAN >  the ALTER  Database  Openresetlogs; 
Finally, add temporary table space

- has a reconstruction under the read-only data files case

" The Create Database " command datafile clause can not declare the read-only table space data file, it must be "absent", otherwise the control file will be read-only data files as read / write processing of online data file

Because the read-only data files without any updates, the head of the SCN may be low, as low inventories of archived log is not enough and can not recover the file, so before rebuilding the control file, there is no need to confirm the database read-only data files, if there must be special treatment

- 1 Start to nomount 
- 2 controlfile the Create to create a new control file, datafile clause which does not contain read-only data file 
- 3 mount execution recover database to recover the database. If RMAN-06504 error to continue the SQLPLUS recover database using backup controlfile command, enter the correct path to the log in prompt appears after the Specify log 
- 4 Try to open the database with noresetlogs, if not open with RESETLOGS 
- 5 amendments read-only data files path 
- 6 executes alter tablespace ... online on the read-only tablespaces lines 
- 7 Add the temporary table space
--SQL> create controlfile
--RMAN> catalog db_recovery_file_dest
--RMAN> recover database(rman-06054)
--SQL> select sequence# from v$archived_Log order by 1;
--SQL>v$Log,v$logfile
--SQL> recover database using backup controfile;
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
--SQL> alter database open resetlogs;
--SQL> alter tablespace test1 online;
--SQL> alter tablepsace temp add tempfile ‘’;

- Use Snapshots control file recovery

In fact, the control file may also have a "hidden" backup that is a snapshot control file ( Control File Snapshot ), which is equivalent to a mirror copy of the control file, the default path

[oracle@DSI trace]$ cd $ORACLE_HOME/dbs

-rw-r----- 1 oracle oinstall 10043392 Jul 29 09:57 snapcf_orcl.f

As long as ever backed up control file or catalog synchronization occurred, there Snapshot

Use snapshots to restore general steps and use the mirror copy of control file recovery is consistent

- 1 cp to the snapshot control file path 
- 2 Start to Mount 
- recover database using the using Backup controlfile. 3 RMAN recover database or a database restore sqlplus 
- 4 Open Database

Or use the snapshot generation create controlfile command

SQL> alter database backup controlfile to trace;

 

13.4 restore data files

No backup, data files can be restored with the help of redo log files and control data dictionary, of course, not all of the data files can be restored without a backup situation, if there is no backup, ordinary data files can control files and data by the help of the recovery redo log dictionary.

No major steps to restore the backup data file

- 1 Use alter database create datafile create a new blank data files 
- 2 Use recover datafile advantage of all the redo log files created since the blank data restore the file

Scene : test data files test01.dbf lost, the database starts to mount state error, but the test since its inception no backup

SQL> startup
ORA-01157 : cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6 ...
SQL> alter database datafile 6 offline;
SQL> alter database open;
SQL> alter database create datafile 6;
RMAN> recover datafile 6;
SQL> alter database datafile 6 online;

Guess you like

Origin www.cnblogs.com/yhq1314/p/11270807.html