In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to analyze RMAN backup and recovery in detail. the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
In-depth Analysis of RMAN backup and recovery
1. An example is given to illustrate the difference between the two kinds of incremental backup.
Good morning, everyone, the morning sun is really bright, a new day is about to begin, let's study the secret of incremental backup:)
Incremental incremental backup: the central idea is to reduce the amount of data backed up. Instead of backing up from scratch, we just need to back up the data blocks since the last backup.
About Incremental incremental backup levels:
There are five levels of Oracle 9i: 0, 1, 2, 3, 4, 0, 0, 4, 4, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 4, 0, 0, 4, 4, 0, 0, 4, 4, 0, 4, 4, 0, 0, 4, 4, 0, 0, 0, 4, 4, 0
The Oracle 10g official documentation clearly states that incremental backups have only two levels of 0 and 1 (too many incremental levels don't make much sense). However, when performing incremental operations, you can still specify multiple levels, up to a maximum of level 4 incremental backups.
There are only 0 and 1 levels for Oracle 11g incremental backups.
Level level 0 is a full database backup of the database, incremental backup must start from level 0, that is to say, there must be a full database backup as the basis.
If you are using the "backup full database" command to do a full-library backup, oracle does not think that this is a full-library backup of level 0, although it is the same, do a separate level 0. With level 0 as the foundation, you can have the following level 1 level 2 level 3 level 4. If you are impulsive to send a level1 backup directly, oracle will automatically add a level 0 in front of the level1, followed by level 0 backup and then level1 backup, a total of two backups.
About the type of Incremental incremental backup:
(1) differential incremental backup: back up all the changed data blocks since the parent and peer backups. Differential increment is the default incremental backup method.
Features: trigger condition is less than or equal to the current level of create tablespace test1 datafile'/u02/app/oracle/oradata/LEO1/test1_01.dbf' size 20m autoextend off
Tablespace created.
Create a test1 table
SYS@LEO1 > conn leo1/leo1
Connected.
LEO1@LEO1 > create table test1 tablespace test1 as select * fromdba_objects
Table created.
LEO1@LEO1 > select checkpoint_change# from vault database; we record the SCN number every time we finish an action
CHECKPOINT_CHANGE#
-
1079203
Level 1 differential backup
RMAN > backup incremental level 1 database
Starting backup at 10-MAY-13
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting incremental level 1 datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Input datafile file number=00001name=/u02/app/oracle/oradata/LEO1/system01.dbf
Input datafile file number=00002name=/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Input datafile file number=00003 name=/u02/app/oracle/oradata/LEO1/undotbs01.dbf
Input datafile file number=00005name=/u02/app/oracle/oradata/LEO1/leo1.dbf
Input datafile file number=00006name=/u02/app/oracle/oradata/LEO1/test1_01.dbf has added test1 table space this time.
Input datafile file number=00004name=/u02/app/oracle/oradata/LEO1/users01.dbf
Channel ORA_DISK_1: starting piece 1 at 10-MAY-13
Channel ORA_DISK_1: finished piece 1 at 10-MAY-13
Piece handle=/u02/app/oracle/backup/DB_0no99r4r_1_1 tag=TAG20130510T151746comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:02:15
Finished backup at 10-MAY-13
Starting Control File and SPFILE Autobackup at 10-MAY-13
Piece handle=/u02/app/oracle/backup/control/cf_c-1692458681-20130510-01comment=NONE
Finished Control File and SPFILE Autobackup at 10-MAY-13
Create test2 tablespace
LEO1@LEO1 > create tablespace test2 datafile'/u02/app/oracle/oradata/LEO1/test2_01.dbf' size 20m autoextend off
Tablespace created.
Create a test2 table
LEO1@LEO1 > create table test2 tablespace test2 as select * fromdba_objects
Table created.
LEO1@LEO1 > select checkpoint_change# from v$database
CHECKPOINT_CHANGE#
-
1079213
Level 1 differential backup again
RMAN > backup incremental level 1 database
Starting backup at 10-MAY-13
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting incremental level 1 datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Input datafile file number=00001name=/u02/app/oracle/oradata/LEO1/system01.dbf
Input datafile file number=00002name=/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Input datafile file number=00003name=/u02/app/oracle/oradata/LEO1/undotbs01.dbf
Input datafile file number=00005name=/u02/app/oracle/oradata/LEO1/leo1.dbf
Input datafile file number=00006name=/u02/app/oracle/oradata/LEO1/test1_01.dbf
Input datafile file number=00007 name=/u02/app/oracle/oradata/LEO1/test2_01.dbf has added test1 table space this time.
Input datafile file number=00004name=/u02/app/oracle/oradata/LEO1/users01.dbf
Channel ORA_DISK_1: starting piece 1 at 10-MAY-13
Channel ORA_DISK_1: finished piece 1 at 10-MAY-13
Piece handle=/u02/app/oracle/backup/DB_0qo99s79_1_1 tag=TAG20130510T153609comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:02:05
Finished backup at 10-MAY-13
Starting Control File and SPFILE Autobackup at 10-MAY-13
Piece handle=/u02/app/oracle/backup/control/cf_c-1692458681-20130510-03comment=NONE
Finished Control File and SPFILE Autobackup at 10-MAY-13
SYS@LEO1 > select checkpoint_change# from v$database
CHECKPOINT_CHANGE#
-
1084254
SYS@LEO1 > alter system switch logfile; Let's do a log switch from 2-> 3
System altered.
SYS@LEO1 > archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination / u02/app/oracle/archdata
Oldest online log sequence 1
Next log sequence to archive 3
Current log sequence 3
SYS@LEO1 > alter system switch logfile; Let's cut it again for insurance. The current log serial number is 4.
System altered.
SYS@LEO1 > conn leo1/leo1
Connected.
LEO1@LEO1 > drop table test1 purge; We delete the test1 and test2 tables
Table dropped.
LEO1@LEO1 > drop table test2 purge
Table dropped.
Now we want to restore to the state before it was deleted, there are two ways (1) to restore to scn=1084254 (2) to restore to sequence=3
Check the backup set
RMAN > list backupset
List of Backup Sets
=
BS Key Type LV Size Device Type Elapsed Time Completion Time
19 Incr 0 960.85M DISK 00:01:21 10-MAY-13
BP Key: 19 Status: AVAILABLE Compressed: NO Tag: TAG20130510T150112
Piece Name:/u02/app/oracle/backup/DB_0lo99q5p_1_1
List of Datafiles in backup set 19
File LV Type Ckp SCN Ckp Time Name
10 Incr 1081294 10-MAY-13/u02/app/oracle/oradata/LEO1/system01.dbf
2 0 Incr 1081294 10-MAY-13/u02/app/oracle/oradata/LEO1/sysaux01.dbf
3 0 Incr 1081294 10-MAY-13/u02/app/oracle/oradata/LEO1/undotbs01.dbf
4 0 Incr 1081294 10-MAY-13/u02/app/oracle/oradata/LEO1/users01.dbf
5 0 Incr 1081294 10-MAY-13/u02/app/oracle/oradata/LEO1/leo1.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
20 Full 9.39M DISK 00:00:01 10-MAY-13
BP Key: 20 Status: AVAILABLE Compressed: NO Tag: TAG20130510T150238
Piece Name:/u02/app/oracle/backup/control/cf_c-1692458681-20130510-00
SPFILE Included: Modificationtime: 30-APR-13
SPFILE db_unique_name: LEO1
Control File Included: Ckp SCN:1081329 Ckp time: 10-MAY-13
BS Key Type LV Size Device Type Elapsed Time Completion Time
21 Incr 1 19.38M DISK 00:02:08 10-MAY-13
BP Key: 21 Status: AVAILABLE Compressed: NO Tag: TAG20130510T151746
Piece Name:/u02/app/oracle/backup/DB_0no99r4r_1_1
List of Datafiles in backup set 21
File LV Type Ckp SCN Ckp Time Name
1 1 Incr 1083510 10-MAY-13/u02/app/oracle/oradata/LEO1/system01.dbf
2 1 Incr 1083510 10-MAY-13/u02/app/oracle/oradata/LEO1/sysaux01.dbf
3 1 Incr 1083510 10-MAY-13/u02/app/oracle/oradata/LEO1/undotbs01.dbf
4 1 Incr 1083510 10-MAY-13/u02/app/oracle/oradata/LEO1/users01.dbf
51 Incr 1083510 10-MAY-13/u02/app/oracle/oradata/LEO1/leo1.dbf
6 1 Incr 1083510 10-MAY-13/u02/app/oracle/oradata/LEO1/test1_01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
22 Full 9.39M DISK 00:00:01 10-MAY-13
BP Key: 22 Status: AVAILABLE Compressed: NO Tag: TAG20130510T152002
Piece Name: / u02/app/oracle/backup/control/cf_c-1692458681-20130510-01
SPFILE Included: Modificationtime: 10-MAY-13
SPFILE db_unique_name: LEO1
Control File Included: Ckp SCN:1083563 Ckp time: 10-MAY-13
BS Key Type LV Size Device Type Elapsed Time Completion Time
23 Full 9.39M DISK 00:00:02 10-MAY-13
BP Key: 23 Status: AVAILABLE Compressed: NO Tag: TAG20130510T152849
Piece Name: / u02/app/oracle/backup/control/cf_c-1692458681-20130510-02
SPFILE Included: Modificationtime: 10-MAY-13
SPFILE db_unique_name: LEO1
Control File Included: Ckp SCN:1084027 Ckp time: 10-MAY-13
BS Key Type LV Size Device Type Elapsed Time Completion Time
24 Incr 1 9.90M DISK 00:02:00 10-MAY-13
BP Key: 24 Status: AVAILABLE Compressed: NO Tag: TAG20130510T153609
Piece Name:/u02/app/oracle/backup/DB_0qo99s79_1_1
List of Datafiles in backup set 24
File LV Type Ckp SCN Ckp Time Name
1 1 Incr 1084375 10-MAY-13/u02/app/oracle/oradata/LEO1/system01.dbf
2 1 Incr 1084375 10-MAY-13 / u02/app/oracle/oradata/LEO1/sysaux01.dbf
3 1 Incr 1084375 10-MAY-13/u02/app/oracle/oradata/LEO1/undotbs01.dbf
4 1 Incr 1084375 10-MAY-13/u02/app/oracle/oradata/LEO1/users01.dbf
5 1 Incr 1084375 10-MAY-13/u02/app/oracle/oradata/LEO1/leo1.dbf
6 1 Incr 1084375 10-MAY-13/u02/app/oracle/oradata/LEO1/test1_01.dbf
7 1 Incr 1084375 10-MAY-13/u02/app/oracle/oradata/LEO1/test2_01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
25 Full 9.39M DISK 00:00:01 10-MAY-13
BP Key: 25 Status: AVAILABLE Compressed: NO Tag: TAG20130510T153814
Piece Name:/u02/app/oracle/backup/control/cf_c-1692458681-20130510-03
SPFILE Included: Modificationtime: 10-MAY-13
SPFILE db_unique_name: LEO1
Control File Included: Ckp SCN:1084436 Ckp time: 10-MAY-13
From this size size, we can see that 960.85m-> 19.38m-> 9.90m all we do are incremental backups, so it's good to start recovery now.
SYS@LEO1 > shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@LEO1 > startup mount starts mount state recovery
ORACLE instance started.
Total System Global Area 471830528bytes
Fixed Size 2214456bytes
Variable Size 184550856 bytes
Database Buffers 276824064bytes
Redo Buffers 8241152bytes
Database mounted.
RMAN performs incomplete recovery based on SCN number
RMAN > restore database until scn 1084254
Starting restore at 10-MAY-13
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID=10 device type=DISK
Creating datafile file number=7name=/u02/app/oracle/oradata/LEO1/test2_01.dbf
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 00001 to/u02/app/oracle/oradata/LEO1/system01.dbf
Channel ORA_DISK_1: restoring datafile 00002 to/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Channel ORA_DISK_1: restoring datafile 00003 to/u02/app/oracle/oradata/LEO1/undotbs01.dbf
Channel ORA_DISK_1: restoring datafile 00004 to/u02/app/oracle/oradata/LEO1/users01.dbf
Channel ORA_DISK_1: restoring datafile 00005 to/u02/app/oracle/oradata/LEO1/leo1.dbf
Channel ORA_DISK_1: reading from backup piece / u02/app/oracle/backup/DB_0lo99q5p_1_1 restore from level 0 backup
Channel ORA_DISK_1: piece handle=/u02/app/oracle/backup/DB_0lo99q5p_1_1tag=TAG20130510T150112
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:01:45
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 00006 to/u02/app/oracle/oradata/LEO1/test1_01.dbf
Channel ORA_DISK_1: reading from backup piece / u02/app/oracle/backup/DB_0no99r4r_1_1 restore level 1
Channel ORA_DISK_1: piece handle=/u02/app/oracle/backup/DB_0no99r4r_1_1tag=TAG20130510T151746
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 10-MAY-13
RMAN > recover database until scn 1084254; synchronous scn number
Starting recover at 10-MAY-13
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting incremental datafile backup set restore
Channel ORA_DISK_1: specifying datafile (s) to restore from backup set
Destination for restore of datafile 00001:/u02/app/oracle/oradata/LEO1/system01.dbf
Destination for restore of datafile 00002:/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Destination for restore of datafile 00003:/u02/app/oracle/oradata/LEO1/undotbs01.dbf
Destination for restore of datafile 00004:/u02/app/oracle/oradata/LEO1/users01.dbf
Destination for restore of datafile 00005:/u02/app/oracle/oradata/LEO1/leo1.dbf
Channel ORA_DISK_1: reading from backup piece/u02/app/oracle/backup/DB_0no99r4r_1_1
Channel ORA_DISK_1: piece handle=/u02/app/oracle/backup/DB_0no99r4r_1_1tag=TAG20130510T151746
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Starting media recovery
Archived log for thread 1 with sequence 1 is already on disk as file/u02/app/oracle/archdata/1_1_814107939.dbf
Archived log file name=/u02/app/oracle/archdata/1_1_814107939.dbf thread=1sequence=1
Media recovery complete, elapsed time: 00:00:02
Finished recover at 10-MAY-13
RMAN > alter database open resetlogs; inconsistent open
Database opened
Cumulative incremental backup
Zero-level backup
Backup incremental level 0 cumulative database
Create tablespace test3
Create table test3
First-level cumulative backup
Backup incremental level 1 cumulative database
Create tablespace test4
Create table test4
First-level cumulative backup
Backup incremental level 1 cumulative database
Remember the current sequence number, we delete table test3 and table test4, and then restore to the moment of sequence, check whether table test3 and table test4 are fully restored, restore window: restore two backup sets 0room1 (last backup) + redo
Let's do it a little faster.
RMAN > backup incremental level 0 cumulative database; level 0 cumulative incremental backup
Starting backup at 10-MAY-13
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting incremental level 0 datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Input datafile file number=00001 name=/u02/app/oracle/oradata/LEO1/system01.dbf
Input datafile file number=00002name=/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Input datafile file number=00003name=/u02/app/oracle/oradata/LEO1/undotbs01.dbf
Input datafile file number=00005name=/u02/app/oracle/oradata/LEO1/leo1.dbf
Input datafile file number=00006name=/u02/app/oracle/oradata/LEO1/test1_01.dbf
Input datafile file number=00007name=/u02/app/oracle/oradata/LEO1/test2_01.dbf
Input datafile file number=00004name=/u02/app/oracle/oradata/LEO1/users01.dbf
Channel ORA_DISK_1: starting piece 1 at 10-MAY-13
Channel ORA_DISK_1: finished piece 1 at 10-MAY-13
Piece handle=/u02/app/oracle/backup/DB_0to99v4v_1_1 tag=TAG20130510T162607comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
Finished backup at 10-MAY-13
Starting Control File and SPFILE Autobackup at 10-MAY-13
Piece handle=/u02/app/oracle/backup/control/cf_c-1692458681-20130510-05comment=NONE
Finished Control File and SPFILE Autobackup at 10-MAY-13
Create tablespaces and table test3
LEO1@LEO1 > create tablespace test3 datafile'/u02/app/oracle/oradata/LEO1/test3_01.dbf' size 20m autoextend off
Tablespace created.
LEO1@LEO1 > create table test3 tablespace test3 as select * fromdba_objects
Table created.
Level 1 cumulative backup
RMAN > backup incremental level 1 cumulative database
Starting backup at 10-MAY-13
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting incremental level 1 datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Input datafile file number=00001name=/u02/app/oracle/oradata/LEO1/system01.dbf
Input datafile file number=00002name=/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Input datafile file number=00003name=/u02/app/oracle/oradata/LEO1/undotbs01.dbf
Input datafile file number=00005name=/u02/app/oracle/oradata/LEO1/leo1.dbf
Input datafile file number=00006name=/u02/app/oracle/oradata/LEO1/test1_01.dbf
Input datafile file number=00007name=/u02/app/oracle/oradata/LEO1/test2_01.dbf
Input datafile file number=00008name=/u02/app/oracle/oradata/LEO1/test3_01.dbf
Input datafile file number=00004 name=/u02/app/oracle/oradata/LEO1/users01.dbf
Channel ORA_DISK_1: starting piece 1 at 10-MAY-13
Channel ORA_DISK_1: finished piece 1 at 10-MAY-13
Piece handle= / u02/app/oracle/backup/DB_0vo99vgi_1_1 tag=TAG20130510T163217 comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:02:05
Finished backup at 10-MAY-13
Starting Control File and SPFILE Autobackup at 10-MAY-13
Piece handle=/u02/app/oracle/backup/control/cf_c-1692458681-20130510-06comment=NONE
Finished Control File and SPFILE Autobackup at 10-MAY-13
Create tablespaces and table test4
LEO1@LEO1 > create tablespace test4 datafile'/u02/app/oracle/oradata/LEO1/test4_01.dbf' size 20m autoextend off
Tablespace created.
LEO1@LEO1 > create table test4 tablespace test4 as select * fromdba_objects
Table created.
Once again, level 1 cumulative backup
RMAN > backup incremental level 1 cumulative database
Starting backup at 10-MAY-13
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting incremental level 1 datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Input datafile file number=00001name=/u02/app/oracle/oradata/LEO1/system01.dbf
Input datafile file number=00002name=/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Input datafile file number=00003name=/u02/app/oracle/oradata/LEO1/undotbs01.dbf
Input datafile file number=00005 name=/u02/app/oracle/oradata/LEO1/leo1.dbf
Input datafile file number=00006name=/u02/app/oracle/oradata/LEO1/test1_01.dbf
Input datafile file number=00007name=/u02/app/oracle/oradata/LEO1/test2_01.dbf
Input datafile file number=00008 name=/u02/app/oracle/oradata/LEO1/test3_01.dbf
Input datafile file number=00009name=/u02/app/oracle/oradata/LEO1/test4_01.dbf
Input datafile file number=00004name=/u02/app/oracle/oradata/LEO1/users01.dbf
Channel ORA_DISK_1: starting piece 1 at 10-MAY-13
Channel ORA_DISK_1: finished piece 1 at 10-MAY-13
Piece handle= / u02/app/oracle/backup/DB_11o99vpa_1_1 tag=TAG20130510T163657 comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:01:55
Finished backup at 10-MAY-13
Starting Control File and SPFILE Autobackup at 10-MAY-13
Piece handle=/u02/app/oracle/backup/control/cf_c-1692458681-20130510-07comment=NONE
Finished Control File and SPFILE Autobackup at 10-MAY-13
SYS@LEO1 > drop table test3 purge
SYS@LEO1 > drop table test4 purge
Switch logs twice
SYS@LEO1 > alter system switch logfile
System altered.
SYS@LEO1 > alter system switch logfile
System altered.
SYS@LEO1 > archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination / u02/app/oracle/archdata
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
We just need to go back to sequence=4.
RMAN performs incomplete recovery based on sequence number
SYS@LEO1 > shutdown immediate
SYS@LEO1 > startup mount
RMAN > restore database until sequence 4 thread 1; all the way to the 4th archive log
Starting restore at 10-MAY-13
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID=10 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 00001 to/u02/app/oracle/oradata/LEO1/system01.dbf
Channel ORA_DISK_1: restoring datafile 00002 to/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Channel ORA_DISK_1: restoring datafile 00003 to/u02/app/oracle/oradata/LEO1/undotbs01.dbf
Channel ORA_DISK_1: restoring datafile 00004 to/u02/app/oracle/oradata/LEO1/users01.dbf
Channel ORA_DISK_1: restoring datafile 00005 to/u02/app/oracle/oradata/LEO1/leo1.dbf
Channel ORA_DISK_1: restoring datafile 00006 to/u02/app/oracle/oradata/LEO1/test1_01.dbf
Channel ORA_DISK_1: restoring datafile 00007 to/u02/app/oracle/oradata/LEO1/test2_01.dbf
Channel ORA_DISK_1: reading from backup piece/u02/app/oracle/backup/DB_0to99v4v_1_1
Channel ORA_DISK_1: piece handle= / u02/app/oracle/backup/DB_0to99v4v_1_1 tag=TAG20130510T162607
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:02:05
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 00008 to/u02/app/oracle/oradata/LEO1/test3_01.dbf
Channel ORA_DISK_1: restoring datafile 00009 to/u02/app/oracle/oradata/LEO1/test4_01.dbf
Channel ORA_DISK_1: reading from backup piece/u02/app/oracle/backup/DB_11o99vpa_1_1
Channel ORA_DISK_1: piece handle= / u02/app/oracle/backup/DB_11o99vpa_1_1 tag=TAG20130510T163657
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 10-MAY-13
RMAN > recover database until sequence 4 thread 1
Starting recover at 10-MAY-13
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting incremental datafile backup set restore
Channel ORA_DISK_1: specifying datafile (s) to restore from backup set
Destination for restore of datafile 00001:/u02/app/oracle/oradata/LEO1/system01.dbf
Destination for restore of datafile 00002:/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Destination for restore of datafile 00003: / u02/app/oracle/oradata/LEO1/undotbs01.dbf
Destination for restore of datafile 00004:/u02/app/oracle/oradata/LEO1/users01.dbf
Destination for restore of datafile 00005:/u02/app/oracle/oradata/LEO1/leo1.dbf
Destination for restore of datafile 00006: / u02/app/oracle/oradata/LEO1/test1_01.dbf
Destination for restore of datafile 00007:/u02/app/oracle/oradata/LEO1/test2_01.dbf
Channel ORA_DISK_1: reading from backup piece/u02/app/oracle/backup/DB_11o99vpa_1_1
Channel ORA_DISK_1: piece handle= / u02/app/oracle/backup/DB_11o99vpa_1_1 tag=TAG20130510T163657
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Starting media recovery
Archived log for thread 1 with sequence 3 is already on disk as file/u02/app/oracle/archdata/1_3_815069267.dbf
Archived log file name=/u02/app/oracle/archdata/1_3_815069267.dbf thread=1sequence=3
Media recovery complete, elapsed time: 00:00:01
Finished recover at 10-MAY-13
RMAN > alter database open resetlogs; Open the database
Database opened
LEO1@LEO1 > select count (*) from test3; is fully restored.
COUNT (*)
-
71894
LEO1@LEO1 > select count (*) from test4
COUNT (*)
-
71895
I'm sure you'll find an interesting phenomenon. Our backup set order is DB_0to99v4v_1_1- > DB_0vo99vgi_1_1- > DB_11o99vpa_1_1.
-rw-r- 1 oracle asmadmin 1023426560 May 10 16:27 DB_0to99v4v_1_1
-rw-r- 1 oracle asmadmin 10493952 May 10 16:34 DB_0vo99vgi_1_1
-rw-r- 1 oracle asmadmin 20193280 May 10 16:38 DB_11o99vpa_1_1
And we restore the order DB_0to99v4v_1_1- > DB_11o99vpa_1_1, there is no intermediate DB_0vo99vgi_1_1, this is the characteristic of cumulative incremental backup. When backing up, it needs to find a base point smaller than its own level for incremental backup, so DB_11o99vpa_1_1 is prepared from level 0 to the latest state (including DB_0vo99vgi_1_1) and gives priority to backup set recovery according to Oracle. After using all backup sets, In the application of archived log recovery, because the backup set efficiency is much faster than archiving, this principle, we can directly use the DB_11o99vpa_1_1 backup set for recovery.
Summary: the feeling is deep and rainy. The example shows that the difference between the two kinds of incremental backup has been completed. We have learned something from these experiments. It should be said that these two increments have their own advantages and are suitable for different application scenarios. How to make better use of them depends on the degree of backup and recovery that your project can accept. All right, I'll see you tomorrow, goodbye.
two。 Demonstrate using catalog database as the database of RMAN to make a full backup of the database
As we mentioned above, Rman metadata can be placed in a control file, but it can also be placed in a catalog database. What is a catalog library? Let's briefly explain its function.
1. Catalog library uniformly manages RMAN backup information, that is, metadata information. If there is no catalog library, the RMAN backup information is written into the control file.
two。 The target database must be registered with the catalog library to use
3. The cost of controlling file recovery is getting lower and lower, which reduces the use of catalog library.
4. Control files cannot retain backup information for more than one year, but catalog can.
5. Catalog library can save backup information of n databases at the same time, reduce management cost and improve management efficiency.
1. Create tablespace catalog1 to store rman backup information, create tablespace representative [catalog library]
LEO1@LEO1 > create tablespace catalog1 datafile'/u02/app/oracle/oradata/LEO1/catalog1_01.dbf' size 20m autoextend off
Tablespace created.
two。 Create the user cl_admin and specify the default tablespace catalog1
LEO1@LEO1 > create user cl_admin identified by cl_admin defaulttablespace catalog1
User created.
3. Grant the recovery_catalog_owner role to the cl_admin user to provide permission to maintain and query the recovery directory
LEO1@LEO1 > grant connect,resource,recovery_catalog_owner to cl_admin
Grant succeeded.
LEO1@LEO1 > select * from dba_roles where role like'% RECOVER%'
ROLE PASSWORD AUTHENTICAT
RECOVERY_CATALOG_OWNER NO NONE
LEO1@LEO1 > conn / as sysdba
Connected.
SYS@LEO1 > select * from role_sys_privs whererole='RECOVERY_CATALOG_OWNER'; to see what system permissions this role has-> 11 permissions
ROLE PRIVILEGE ADM
-
RECOVERY_CATALOG_OWNER CREATE SYNONYM NO
RECOVERY_CATALOG_OWNER CREATE CLUSTER NO
RECOVERY_CATALOG_OWNER ALTERSESSION NO
RECOVERY_CATALOG_OWNER CREATE DATABASE LINK NO
RECOVERY_CATALOG_OWNER CREATE SESSION NO
RECOVERY_CATALOG_OWNER CREATE TABLE NO
RECOVERY_CATALOG_OWNER CREATE SEQUENCE NO
RECOVERY_CATALOG_OWNER CREATEPROCEDURE NO
RECOVERY_CATALOG_OWNER CREATE VIEW NO
RECOVERY_CATALOG_OWNER CREATE TYPE NO
RECOVERY_CATALOG_OWNER CREATE TRIGGER NO
11 rows selected.
4. Enter rman to create a recovery directory catalog library
[oracle@leonarding1 backup] $rman catalog cl_admin/cl_admin logs in to rman as the owner of the recovery directory
Recovery Manager: Release 11.2.0.1.0-Production on Sat May 11 09 purl 0629 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to recovery catalog database connects to the recovery catalog database
RMAN > create catalog tablespace catalog1; represents catalog libraries with catalog1 tablespaces
Recovery catalog created
The 5.target library is registered to the catalog library
[oracle@leonarding1 backup] $rman target sys/oracle catalogcl_admin/cl_admin
Recovery Manager: Release 11.2.0.1.0-Production on Sat May 11 09 purl 15 purl 10 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to target database: LEO1 (DBID=1692458681) must be logged in as SYS, not as an ordinary user, otherwise it cannot be registered
Connected to recovery catalog database is also connected to the catalog library
RMAN > register database; put target library-> register-> catalog library, who registers whose backup information can be saved to catalog library.
Database registered in recovery catalog
Starting full resync of recovery catalog
Full resync complete
6. Confirm the success of registration in the database to see which databases are registered to the catalog library
[oracle@leonarding1 ~] $sqlplus cl_admin/cl_admin
CL_ADMIN@LEO1 > col name for A6
CL_ADMIN@LEO1 > select * from rc_database; from this view we can see that the leo1 library has been registered with catalog
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
--
24 1692458681 LEO1 1086803 10-MAY-13
7. Cancel registration
RMAN > unregister database; unregisters the target database from the recovery catalog library
8. Full database backup
RMAN > backup as compressed backupset full database include currentcontrolfile plus archivelog delete all input
Starting backup at 11-MAY-13
Current log archived
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID=19 device type=DISK
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=6 RECID=38 STAMP=814107533
Input archived log thread=1 sequence=7 RECID=36 STAMP=814105467
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_15o9bs9s_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_6_814098124.dbf RECID=38STAMP=814107533
Archived log file name=/u02/app/oracle/archdata/1_7_814098124.dbf RECID=36STAMP=814105467
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=1 RECID=39 STAMP=815067081
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_16o9bs9t_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_1_814107939.dbf RECID=39STAMP=815067081
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=8 RECID=37 STAMP=814105539
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_17o9bsa1_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_8_814098124.dbf RECID=37STAMP=814105539
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=2 RECID=40 STAMP=815067673
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_18o9bsa2_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_2_814107939.dbf RECID=40STAMP=815067673
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=1 RECID=43 STAMP=815070347
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_19o9bsa3_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_1_815069267.dbf RECID=43STAMP=815070347
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=3 RECID=41 STAMP=815067752
Input archived log thread=1 sequence=4 RECID=42 STAMP=815069267
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_1ao9bsa4_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_3_814107939.dbf RECID=41STAMP=815067752
Archived log file name=/u02/app/oracle/archdata/1_4_814107939.dbf RECID=42STAMP=815069267
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=2 RECID=44 STAMP=815070349
Input archived log thread=1 sequence=3 RECID=45 STAMP=815071289
Input archived log thread=1 sequence=4 RECID=46 STAMP=815071321
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_1bo9bsa5_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_2_815069267.dbf RECID=44STAMP=815070349
Archived log file name=/u02/app/oracle/archdata/1_3_815069267.dbf RECID=45STAMP=815071289
Archived log file name=/u02/app/oracle/archdata/1_4_815069267.dbf RECID=46STAMP=815071321
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=1 RECID=48 STAMP=815130519
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_1co9bsa9_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_1_815071959.dbf RECID=48STAMP=815130519
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=5 RECID=47 STAMP=815071959
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_1do9bsag_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_5_815069267.dbf RECID=47STAMP=815071959
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=2 RECID=49 STAMP=815132985
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_1eo9bsai_1_1 tag=TAG20130511T094947comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_2_815071959.dbf RECID=49STAMP=815132985
Finished backup at 11-MAY-13
Starting backup at 11-MAY-13
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting compressed full datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Input datafile file number=00001name=/u02/app/oracle/oradata/LEO1/system01.dbf
Input datafile file number=00002name=/u02/app/oracle/oradata/LEO1/sysaux01.dbf
Input datafile file number=00003name=/u02/app/oracle/oradata/LEO1/undotbs01.dbf
Input datafile file number=00005 name=/u02/app/oracle/oradata/LEO1/leo1.dbf
Input datafile file number=00006name=/u02/app/oracle/oradata/LEO1/test1_01.dbf
Input datafile file number=00007name=/u02/app/oracle/oradata/LEO1/test2_01.dbf
Input datafile file number=00008 name=/u02/app/oracle/oradata/LEO1/test3_01.dbf
Input datafile file number=00009name=/u02/app/oracle/oradata/LEO1/test4_01.dbf
Input datafile file number=00010name=/u02/app/oracle/oradata/LEO1/catalog1_01.dbf
Input datafile file number=00004 name=/u02/app/oracle/oradata/LEO1/users01.dbf
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_1fo9bsaj_1_1 tag=TAG20130511T095011comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35
Channel ORA_DISK_1: starting compressed full datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Including current control file in backup set
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_1go9bsdi_1_1 tag=TAG20130511T095011comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-MAY-13
Starting backup at 11-MAY-13
Current log archived
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting compressed archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=3 RECID=50 STAMP=815133109
Channel ORA_DISK_1: starting piece 1 at 11-MAY-13
Channel ORA_DISK_1: finished piece 1 at 11-MAY-13
Piece handle=/u02/app/oracle/backup/DB_1ho9bsdm_1_1 tag=TAG20130511T095150comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u02/app/oracle/archdata/1_3_815071959.dbf RECID=50STAMP=815133109
Finished backup at 11-MAY-13
Starting Control File and SPFILE Autobackup at 11-MAY-13
Piece handle=/u02/app/oracle/backup/control/cf_c-1692458681-20130511-01comment=NONE
Finished Control File and SPFILE Autobackup at 11-MAY-13
This backup information will be saved in the catalog database, you can save the backup information of n databases at the same time, please note that the catalog library also has the risk of crash, if the backup information is lost, then all backup sets will be invalid, so the catalog library also needs to be backed up.
Backup and recovery is a core module of the database, almost never seen the library without backup. RMAN is a special-level backup and recovery tool for oracle, which can complete almost all backup tasks and is a sharp weapon for our DBA.
RMAN backupset catalog full library backup differential incremental backup cumulative incremental backup
On how to in-depth analysis of RMAN backup and recovery to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.