Here it is: one will see, it is a waste to do series
Database demo version is 19.3 ( 12.2.0.3 )
The series involves the recovery process using the 5 statement:
1. recover database
2. recover database until cancel
3. recover database using backup controlfile
4. recover database until cancel using backup controlfile
5. recover database using backup controlfile until cancel
Before you continue, you have to know what is the reduction ? What recovery ? Base and backup and recovery point I see Yi Hai fresh series
A total of three levels of recovery: recover database> recover tablespace> recover datafile purpose of this series is to demonstrate the differences and relations between the above five commands, so do not discuss the level of recovery and database recovery state level corresponding to the use of the problem. The highest level database already contains a tablespace and datafile two levels.
Copyright : blog Garden AskScuti Copyright, without permission is prohibited reproduced!
table of Contents
1. Explain the concept
2. note
3. Experimental procedure
CDB Backup 3.1
3.2 PDB1 create test data
3.3 Delete CDB control file
3.4 CDB restore the control file
3.5 CDB control file recovery
3.6 open CDB
1. Explain the concept
First you have to know, recover database command is used to restore all data files, but is fully restored .
There is attention to detail, the command is divided into two types, one with the SQL command line , for use in RMAN :
SQL> recover database data files only for all fully restored, provided that the control file to the current date , can not be a reduction over the old version or a manual rebuild , or SQL command line returns an error .
RMAN> recover database full recovery of all data files and control files
In the present embodiment of the presentation control file to recover the ( data file case, archive logs online log intact )
2. note
The current system, data files, archive logs, online logs are intact, delete CDB level of all control files , and use RMAN to restore the control file separately, using recover database full recovery.
3. Experimental procedure
CDB Backup 3.1
Slightly, Part reference
3.2 PDB1 create test data
View PDB1 current table space and the corresponding data files
RMAN> report schema; Report of database schema for database with db_unique_name CDB1 List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- ----------- ------- --------------------------------------------- 9 280 SYSTEM NO /u01/app/oracle/oradata/CDB1/pdb1/system01.dbf 10 350 SYSAUX NO /u01/app/oracle/oradata/CDB1/pdb1/sysaux01.dbf 11 100 UNDOTBS1 NO /u01/app/oracle/oradata/CDB1/pdb1/undotbs01.dbf 12 5 USERS NO /u01/app/oracle/oradata/CDB1/pdb1/users01.dbf 13 5 HENRY NO /u01/app/oracle/oradata/CDB1/pdb1/henry01.dbf List of Temporary Files ======================= File Size(MB) Tablespace Maxsize(MB) Tempfile Name ---- -------- ----------- ----------- ------------------------------------------- 3 36 TEMP 32767 /u01/app/oracle/oradata/CDB1/pdb1/temp01.dbf
Create a new table space recover_rman
SQL> create tablespace recover_rman datafile '/u01/app/oracle/oradata/CDB1/pdb1/recover_rman01.dbf' size 5m; Tablespace created.
Note: The spatial structure of the new table, there is no data in the backup files and control files inside.
3.3 Delete CDB control file
SQL> conn / as sysdba Connected. SQL> select name from v$controlfile; NAME -------------------------------------------------- /u01/app/oracle/oradata/CDB1/control01.ctl /u01/app/oracle/oradata/CDB1/control02.ctl SQL> !rm -rf /u01/app/oracle/oradata/CDB1/control*
Restart CDB, error
SQL> startup force; ORACLE instance started. Total System Global Area 1241510120 bytes Fixed Size 9134312 bytes Variable Size 889192448 bytes Database Buffers 335544320 bytes Redo Buffers 7639040 bytes ORA-00205: error in identifying control file, check alert log for more info
3.4 CDB restore the control file
[oracle@henry ~]$ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Sat Jun 8 18:14:49 2019 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: CDB1 (not mounted) RMAN> restore controlfile from '/u02/backup/c-983951798-20190608-02.CTL'; Starting restore at 08-JUN-19 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=390 device type=DISK channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 output file name=/u01/app/oracle/oradata/CDB1/control01.ctl output file name=/u01/app/oracle/oradata/CDB1/control02.ctl Finished restore at 08-JUN-19
The database start to MOUNT
RMAN> alter database mount; released channel: ORA_DISK_1 Statement processed
In this case check the control data file recorded in the file ( V $ dynamic performance views datafile data from the control files )
SQL> set pagesize 50 SQL> select name from v$datafile; NAME -------------------------------------------------- /u01/app/oracle/oradata/CDB1/system01.dbf /u01/app/oracle/oradata/CDB1/sysaux01.dbf /u01/app/oracle/oradata/CDB1/undotbs01.dbf /u01/app/oracle/oradata/CDB1/pdbseed/system01.dbf /u01/app/oracle/oradata/CDB1/pdbseed/sysaux01.dbf /u01/app/oracle/oradata/CDB1/users01.dbf /u01/app/oracle/oradata/CDB1/pdbseed/undotbs01.dbf /u01/app/oracle/oradata/CDB1/pdb1/system01.dbf /u01/app/oracle/oradata/CDB1/pdb1/sysaux01.dbf /u01/app/oracle/oradata/CDB1/pdb1/undotbs01.dbf /u01/app/oracle/oradata/CDB1/pdb1/users01.dbf /u01/app/oracle/oradata/CDB1/pdb1/henry01.dbf
Recovery out of the control file is no record of table space recover_rman
3.5 CDB control file recovery
Use recover database database recover
RMAN> recover database; Starting recover at 08-JUN-19 Starting implicit crosscheck backup at 08-JUN-19 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=134 device type=DISK Crosschecked 3 objects Finished implicit crosscheck backup at 08-JUN-19 Starting implicit crosscheck copy at 08-JUN-19 using channel ORA_DISK_1 Finished implicit crosscheck copy at 08-JUN-19 searching for all files in the recovery area cataloging files... no files cataloged using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 9 is already on disk as file /u01/app/oracle/oradata/CDB1/redo03.log archived log file name=/u01/app/oracle/oradata/CDB1/redo03.log thread=1 sequence=9 creating datafile file number=14 name=/u01/app/oracle/oradata/CDB1/pdb1/recover_rman01.dbf archived log file name=/u01/app/oracle/oradata/CDB1/redo03.log thread=1 sequence=9 media recovery complete, elapsed time: 00:00:01 Finished recover at 08-JUN-19
Please note that the penultimate line 4: Creating File Number The datafile = 14 name = / u01 / App / the Oracle / oradata / CDB1 / PDB1 / recover_rman01.dbf
Fully automatic restore command in the control file data files created added recover_rman
Check the data files recorded in the control file again
SQL> select name from v$datafile; NAME ---------------------------------------------------- /u01/app/oracle/oradata/CDB1/system01.dbf /u01/app/oracle/oradata/CDB1/sysaux01.dbf /u01/app/oracle/oradata/CDB1/undotbs01.dbf /u01/app/oracle/oradata/CDB1/pdbseed/system01.dbf /u01/app/oracle/oradata/CDB1/pdbseed/sysaux01.dbf /u01/app/oracle/oradata/CDB1/users01.dbf /u01/app/oracle/oradata/CDB1/pdbseed/undotbs01.dbf /u01/app/oracle/oradata/CDB1/pdb1/system01.dbf /u01/app/oracle/oradata/CDB1/pdb1/sysaux01.dbf /u01/app/oracle/oradata/CDB1/pdb1/undotbs01.dbf /u01/app/oracle/oradata/CDB1/pdb1/users01.dbf /u01/app/oracle/oradata/CDB1/pdb1/henry01.dbf /u01/app/oracle/oradata/CDB1/pdb1/recover_rman01.dbf
3.6 open CDB
Because the move "control file", so must be resetlogs opened, why? Do not ask, loved! I stroked the official document View
You want to directly open? too young, too simple, sometimes naive.- from Shakespeare's contempt.
SQL> alter database open; alter database open * ERROR at line 1: ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs; Database altered.
Your question is: recover database statement obviously is a fully restored action, why after the success, still need RESETLOGS ? Because recover database command only to repair the physical structure information control file data files, not modify the log sequence number in the control file , not the same as the data file, before the application filing and online log roll, so the serial number of the control file is still old , and therefore, the database can be opened only by resetting the sequence number.
After resetlogs to open, reset the log sequence number set to 1, the new version appears incarnation incarnation
RMAN> list incarnation; using target database control file instead of recovery catalog List of Database Incarnations DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time ------- ------- -------- ---------- ------- ---------- ---------- 1 1 CDB1 983951798 PARENT 1 17-APR-19 2 2 CDB1 983951798 PARENT 1920977 06-JUN-19 3 3 CDB1 983951798 CURRENT 2455443 08-JUN-19
INCARNATION is a what? Please refer to:
Oracle in the Incarnation in the end is what? Conceptual understanding articles
Oracle in the Incarnation in the end is what? Experimental OPERATION