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 PDB1 delete all data files
3.4 PDB1 restore all data files
3.5 PDB1 recover all the data files
3.6 open PDB1 for data validation
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 this example only demonstrates the complete recovery of the data file, the command of the control file recovery will be discussed next.
Saying: recover database is to complete all of the data recovery operation ( control files, archive logs, the case of online log intact )
2. note
The current system, control files, archive logs, online logs are intact, delete data files, restore, recover database using a full recovery.
3. Experimental procedure
CDB Backup 3.1
Backup the entire CDB (CDB $ ROOT / PDB1 / PDB $ SEED)
RMAN> backup database format '/u02/backup/%s_%d_%U.full' tag 'full_backup';
RMAN> backup database format '/u02/backup/%s_%d_%U.full' tag 'full_backup'; Starting backup at 08-JUN-19 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/CDB1/system01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/CDB1/sysaux01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/CDB1/undotbs01.dbf input datafile file number=00007 name=/u01/app/oracle/oradata/CDB1/users01.dbf channel ORA_DISK_1: starting piece 1 at 08-JUN-19 channel ORA_DISK_1: finished piece 1 at 08-JUN-19 piece handle=/u02/backup/8_CDB1_08u3ji4n_1_1.full tag=FULL_BACKUP comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00010 name=/u01/app/oracle/oradata/CDB1/pdb1/sysaux01.dbf input datafile file number=00009 name=/u01/app/oracle/oradata/CDB1/pdb1/system01.dbf input datafile file number=00011 name=/u01/app/oracle/oradata/CDB1/pdb1/undotbs01.dbf input datafile file number=00012 name=/u01/app/oracle/oradata/CDB1/pdb1/users01.dbf input datafile file number=00013 name=/u01/app/oracle/oradata/CDB1/pdb1/henry01.dbf channel ORA_DISK_1: starting piece 1 at 08-JUN-19 channel ORA_DISK_1: finished piece 1 at 08-JUN-19 piece handle=/u02/backup/9_CDB1_09u3ji6f_1_1.full tag=FULL_BACKUP comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00006 name=/u01/app/oracle/oradata/CDB1/pdbseed/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/CDB1/pdbseed/system01.dbf input datafile file number=00008 name=/u01/app/oracle/oradata/CDB1/pdbseed/undotbs01.dbf channel ORA_DISK_1: starting piece 1 at 08-JUN-19 channel ORA_DISK_1: finished piece 1 at 08-JUN-19 piece handle=/u02/backup/10_CDB1_0au3ji78_1_1.full tag=FULL_BACKUP comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25 Finished backup at 08-JUN-19 Starting Control File and SPFILE Autobackup at 08-JUN-19 piece handle=/u02/backup/c-983951798-20190608-02.CTL comment=NONE Finished Control File and SPFILE Autobackup at 08-JUN-19
3.2 PDB1 create test data
Connection PDB1 view the current data file
[oracle@henry ~]$ sqlplus sys/oracle@pdb1 as sysdba SQL> select name from v$datafile;
[oracle@henry ~]$ sqlplus sys/oracle@pdb1 as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Sat Jun 8 16:48:51 2019 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> select name from v$datafile; NAME ------------------------------------------------ /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
Create a test table recover_db, 2, 3, and commit insert data submitted
SQL> create table recover_db(id number) tablespace henry; Table created. SQL> insert into recover_db values(1); 1 row created. SQL> insert into recover_db values(2); 1 row created. SQL> insert into recover_db values(3); 1 row created. SQL> commit; Commit complete.
3.3 PDB1 delete all data files
SQL> !rm -rf /u01/app/oracle/oradata/CDB1/pdb1/*
4,5,6 continue to insert data is not submitted, the Executive trigger completely checkpoint, brush cache data error (Consider:? Physical file deletion, can also continue to insert data Why)
SQL> insert into recover_db values(4); 1 row created. SQL> insert into recover_db values(5); 1 row created. SQL> insert into recover_db values(6); 1 row created. SQL> alter system checkpoint; System altered. SQL> / alter system checkpoint * ERROR at line 1: ORA-03135: connection lost contact Process ID: 30992 Session ID: 273 Serial number: 51273
Since all operations on the table in memory which are, at this time, and independent of the physical data file , it is possible to continue.
The purpose is to trigger a checkpoint brush the cached data to disk, and data files and then you have a relationship, the first time the trigger is fully checkpoint brush data, did not react, a second brush error, because the cache data to be written into the disk, but the corresponding disk file is deleted, and therefore error.
Please note : insert 4,5,6 operation after three data, whether there is submitted? If you can recover the full recovery 4,5,6?
CDB View PDB1 switch status, and try to start (this is why the PDB1 MOUNT?)
SQL> conn / as sysdba Connected. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------- ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 MOUNTED
SQL> alter pluggable database pdb1 open; alter pluggable database pdb1 open * ERROR at line 1: ORA-01157: cannot identify/lock data file 13 - see DBWR trace file ORA-01110: data file 13: '/u01/app/oracle/oradata/CDB1/pdb1/henry01.dbf'
Because the multi-tenant system, parameter files , and control files are in the CDB level, so long as the CDB is turned on, all of the following are the lowest level PDB MOUNT (even if the library has a problem, stopped, still shows MOUNT)
3.4 PDB1 restore all data files
Restore data files
You can restore your connection PDB1
[oracle@henry ~]$ rman target sys/oracle@pdb1 Recovery Manager: Release 19.0.0.0.0 - Production on Sat Jun 8 17:13:26 2019 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: CDB1:PDB1 (DBID=2947650716, not open) RMAN> restore database from tag='FULL_BACKUP'; 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=11 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/CDB1/pdb1/system01.dbf channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/CDB1/pdb1/sysaux01.dbf channel ORA_DISK_1: restoring datafile 00011 to /u01/app/oracle/oradata/CDB1/pdb1/undotbs01.dbf channel ORA_DISK_1: restoring datafile 00012 to /u01/app/oracle/oradata/CDB1/pdb1/users01.dbf channel ORA_DISK_1: restoring datafile 00013 to /u01/app/oracle/oradata/CDB1/pdb1/henry01.dbf channel ORA_DISK_1: reading from backup piece /u02/backup/9_CDB1_09u3ji6f_1_1.full channel ORA_DISK_1: piece handle=/u02/backup/9_CDB1_09u3ji6f_1_1.full tag=FULL_BACKUP channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:36 Finished restore at 08-JUN-19
May also be connected CDB, reduction PDB1
RMAN> restore pluggable database pdb1 from tag='FULL_BACKUP'; Starting restore at 08-JUN-19 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/CDB1/pdb1/system01.dbf channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/CDB1/pdb1/sysaux01.dbf channel ORA_DISK_1: restoring datafile 00011 to /u01/app/oracle/oradata/CDB1/pdb1/undotbs01.dbf channel ORA_DISK_1: restoring datafile 00012 to /u01/app/oracle/oradata/CDB1/pdb1/users01.dbf channel ORA_DISK_1: restoring datafile 00013 to /u01/app/oracle/oradata/CDB1/pdb1/henry01.dbf channel ORA_DISK_1: reading from backup piece /u02/backup/9_CDB1_09u3ji6f_1_1.full channel ORA_DISK_1: piece handle=/u02/backup/9_CDB1_09u3ji6f_1_1.full tag=FULL_BACKUP channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:35 Finished restore at 08-JUN-19
3.5 PDB1 recover all the data files
Restore data files
You can restore your connection PDB1
RMAN> recover database; Starting recover at 08-JUN-19 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:00 Finished recover at 08-JUN-1
You can also connect CDB, recovery PDB1
RMAN> recover pluggable database pdb1; Starting recover at 08-JUN-19 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:00 Finished recover at 08-JUN-19
3.6 open PDB1 for data validation
Open the database
You can open your own connection PDB1
RMAN> alter database open; Statement processed
You can also connect CDB, open PDB1
RMAN> alter pluggable database pdb1 open; Statement processed
verify the data
I ask, after full recovery, recover_db table has several data ? why?
SQL> select * from recover_db; ID ---------- 1 2 3
Because the insertion 4,5,6 not submitted, the transaction is not over, is not persistent. Fully restored is restored to the last time before the downtime commit state .