Actual RMAN Migration Operations-additional common commands

Source: Internet
Author: User

Actual RMAN Migration Operations-additional common commands

Operation scenarios

Source server OEL 6.3 11G R2 11.2.0.3
Target Server OEL 6.3 11G R2 11.2.0.3
The data storage path of the source server and target server is the same.

Source Server
[Oracle @ mxq ~] $ Rman target/

Recovery Manager: Release 11.2.0.2.0-Production on Sat May 16 08:51:05 2015

Copyright (c) 1982,200 9, Oracle and/or its affiliates. All rights reserved.

Connected to target database: ORACLE11 (DBID = 2573050700)

RMAN> run
{Allocate channel orademo type disk MAXPIECESIZE 1024 m;
Backup incremental level 0 as compressed backupset database include current controlfile tag = 'full' format '/home/oracle/db _ % s _ % p _ % t' plus archivelog tag = 'arch _ all 'format'/home/oracle/arch _ % s _ % p _ % t' delete input;
} 2> 3> 4>

Released channel: ORA_DISK_1
Allocated channel: orademo
Channel orademo: SID = 147 device type = DISK


Starting backup at 16-MAY-15
Current log archived
Channel orademo: starting compressed archived log backup set
Channel orademo: specifying archived log (s) in backup set
Input archived log thread = 1 sequence = 96 RECID = 69 STAMP = 879840530
Channel orademo: starting piece 1 at 16-MAY-15
Channel orademo: finished piece 1 at 16-MAY-15
Piece handle =/home/oracle/arch_59_424879840531 tag = ARCH_ALL comment = NONE
Channel orademo: backup set complete, elapsed time: 00:00:01
Channel orademo: deleting archived log (s)
Archived log file name =/orafile/arc/41596_879804940.arc RECID = 69 STAMP = 879840530
Finished backup at 16-MAY-15

Starting backup at 16-MAY-15
Channel orademo: starting compressed incremental level 0 datafile backup set
Channel orademo: specifying datafile (s) in backup set
Including current SPFILE in backup set
Including current control file in backup set
Input datafile file number = 00002 name =/orafile/oradata/sysaux01.dbf
Input datafile file number = 00001 name =/orafile/oradata/system01.dbf
Input datafile file number = 00003 name =/orafile/oradata/undotbs01.dbf
Input datafile file number = 00004 name =/orafile/oradata/users01.dbf
Channel orademo: starting piece 1 at 16-MAY-15
Channel orademo: finished piece 1 at 16-MAY-15
Piece handle =/home/oracle/db_60_417879840533 tag = FULL comment = NONE
Channel orademo: backup set complete, elapsed time: 00:02:55
Finished backup at 16-MAY-15

Starting backup at 16-MAY-15
Current log archived
Channel orademo: starting compressed archived log backup set
Channel orademo: specifying archived log (s) in backup set
Input archived log thread = 1 sequence = 97 RECID = 72 STAMP = 879840713
Channel orademo: starting piece 1 at 16-MAY-15
Channel orademo: finished piece 1 at 16-MAY-15
Piece handle =/home/oracle/arch_61_487879840714 tag = ARCH_ALL comment = NONE
Channel orademo: backup set complete, elapsed time: 00:00:01
Channel orademo: deleting archived log (s)
Archived log file name =/orafile/arc/g097_879804940.arc RECID = 72 STAMP = 879840713
Finished backup at 16-MAY-15
Released channel: orademo

Copy the new backup set to the target server
[Oracle @ mxq ~] $ Cd/home/oracle/
[Oracle @ mxq ~] $ Ls
Arch_59_109879840531 arch_61_109879840714 db_60_415879840533
[Oracle @ mxq ~] $ Ll
Total 248900
-Rw-r ----- 1 oracle oinstall 219648 May 16 arch_59_415879840531
-Rw-r ----- 1 oracle oinstall 1256448 May 16 arch_61_316879840714
-Rw-r ----- 1 oracle oinstall 253394944 May 16 db_60_1_879840533
[Oracle @ mxq ~] $ Scp * [email protected]:/home/oracle/
[Email protected]'s password:
Arch_59_487879840531 100% 215KB 214.5KB/s
Arch_61_487879840714 100% 1227KB 1.2 MB/s
Db_60_0000879840533 100% 242 MB 13.4 MB/s

Target Server

Tip:
If a data file, control file, online log file, or parameter file is deleted, the file is deleted and restored. Otherwise, an error is returned.

[Oracle @ mxq ~] $ Rman target/

Recovery Manager: Release 11.2.0.2.0-Production on Sun May 17 12:10:05 2015

Copyright (c) 1982,200 9, Oracle and/or its affiliates. All rights reserved.

Connected to target database (not started)


RMAN> startup force nomount;

Oracle instance started

Total System Global Area 521936896 bytes

Fixed Size 2228072 bytes
Variable Size 159383704 bytes
Database Buffers 352321536 bytes
Redo Buffers 8003584 bytes


RMAN> restore spfile from '/home/oracle/db_54_424879855779 ';

Starting restore at 17-MAY-15
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 134 device type = DISK

Channel ORA_DISK_1: restoring spfile from AUTOBACKUP/home/oracle/db_54_415879855779
Channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 17-MAY-15

RMAN> shutdown immediate;

Oracle instance shut down

RMAN> set DBID = 2573050700

Executing command: SET DBID

RMAN> startup nomount;

Connected to target database (not started)
Oracle instance started

Total System Global Area 521936896 bytes

Fixed Size 2228072 bytes
Variable Size 176160920 bytes
Database Buffers 335544320 bytes
Redo Buffers 8003584 bytes


RMAN> restore controlfile from '/home/oracle/db_54_424879855779 ';

Starting restore at 17-MAY-15
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 134 device type = DISK

Channel ORA_DISK_1: restoring control file
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Output file name =/orafile/oradata/control01.ctl
Output file name =/orafile/oradata/control02.ctl
Finished restore at 17-MAY-15

RMAN> alter database mount;

Database mounted


RMAN> list backup summary;


List of Backups
====================
Key ty lv s Device Type Completion Time # Pieces # Copies Compressed Tag
-----------------------------------------------------------------
10 B A DISK 16-MAY-15 1 1 YES ARCH_ALL
11 B A DISK 16-MAY-15 1 1 YES ARCH_ALL
12 B 0 A DISK 16-MAY-15 1 1 YES FULL

RMAN> restore database from tag = 'full ';

Starting restore at 17-MAY-15
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 133 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/orafile/oradata/system01.dbf
Channel ORA_DISK_1: restoring datafile 00002 to/orafile/oradata/sysaux01.dbf
Channel ORA_DISK_1: restoring datafile 00003 to/orafile/oradata/undotbs01.dbf
Channel ORA_DISK_1: restoring datafile 00004 to/orafile/oradata/users01.dbf
Channel ORA_DISK_1: reading from backup piece/home/oracle/db_60_415879840533
Channel ORA_DISK_1: piece handle =/home/oracle/db_60_425879840533 tag = FULL
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:01:45
Finished restore at 17-MAY-15

RMAN> recover database from tag = 'arch _ all ';

Starting recover at 17-MAY-15
Using channel ORA_DISK_1

Starting media recovery

Archived log for thread 1 with sequence 97 is already on disk as file/orafile/arc/12797_879804940.arc
Archived log for thread 1 with sequence 1 is already on disk as file/orafile/arc/sequential route 879955249.arc
Archived log for thread 1 with sequence 2 is already on disk as file/orafile/arc/1_2_879955249.arc
Archived log for thread 1 with sequence 3 is already on disk as file/orafile/arc/1_3_879955249.arc
Archived log file name =/orafile/arc/1_97_879804940.arc thread = 1 sequence = 97
Archived log file name =/orafile/arc/1_2_879955249.arc thread = 1 sequence = 2
Media recovery complete, elapsed time: 00:00:17
Finished recover at 17-MAY-15

RMAN> alter database open;

Database opened

-----------------------
The migration completed

Add Common commands:

1. Concepts

Incremental difference: all changed data blocks since the backup of the backup level and the backup level. incremental difference is the default Incremental backup mode.
Cumulative increment: all changed blocks since backup

Because the cumulative increment is all the changed data blocks since the backup of the upper level, the cumulative increment requires more backup time and a smaller recovery time;
The incremental difference is the opposite. It can back up the changed data blocks since the same level of backup. Therefore, the backup time is reduced, but more recovery time is required.
9. Incremental Backup requires scanning the data blocks of the entire database to know which data blocks have changed. This is a very costly and time-consuming process,
In addition, because Incremental Backup forms multiple different backup sets, recovery becomes more independent, so Incremental backup is not recommended in version 9; in 10 Gb,
Incremental backup is greatly improved. You do not need to scan all data blocks to find out which data blocks have changed, which greatly improves the backup efficiency. However, these are at the cost of disk I/o,
Therefore, in the oltp transaction system, you have to determine whether you are willing to ensure security and high availability at the cost of I/o. Incremental merge is also supported for 10 Gb, and Incremental Backup supports 7-level increments.

 

1. Image Copies)

Image copying is actually a copy of data files, control files, or archive files. It is essentially the same as copying a file created using an operating system command, however, RMAN uses service processes in the target database to replicate files, while the user uses operating system commands. Therefore, the image COPY method does not reflect the advantages of RMAN, which is not the focus of our discussion. Let's take a look (what? Want to know how to use image copy? Card, ask the village chief to go ~~~~~).

2. Backup Sets)

A backup set is a logical backup object created through RMAN. A backup set can contain multiple data files, control files, or archive files. A backup set is physically composed of multiple backup segments, each of which is an operating system file.

 

1. List the databases backed up by RMAN:

Full recovery

Restore database repair database
Recover database

Incomplete recovery

Set until time '2017-06-06 21:00:00 '; set recovery based on incomplete time
Set until scn 3404460; set incomplete restoration based on scn
Set until sequence = 3; set recovery based on incomplete serial numbers
Restore database
Recover database

Backup

Back up the entire database
Back up to there

Bakckup database format = '/home/oracle/all_U'

Back up the current control file

Backup current controlfile format = '/home/oracle/all_U'

Backup tablespace

Backup tablespace user format = '/home/oracle/all_U'

Backup parameter file

Backup spfile format '/home/oracle/spfile_U'

Back up all archived logs and delete archived logs after backup

Backup archivelog all delete input format '/home/oracle/arc_U'


Retention Policy:

Time-based:

Configure retention policy to recovery window of n DAYS;

Redundancy-based quantity:

Configure retention policy to redundancy n


1.1. list backup summary; -- Overview of available backups
List incarnation; -- Aggregate Query

-- If there are many backup files, use these two list commands to get a general understanding of the backup files.
B Indicates backup
A Indicates Archivelog, F indicates full backup, 0, 1, and 2 indicates incremental level backup.
A Indicates AVALIABLE and X indicates EXPIRED.

List available backup Sets
List backup of database summary
List available archive logs
List backup of archivelog all summary
List available tablespaces
List backup of tablespace users summary;
List available data files
List backup of datafile n, n, n summary

List all backup parameter files
List backup of spfile;


List all backup control files
List backup of controlfile;


List all backup data files
List backup of datafle n, n;


List all backup tablespaces
List backup of tablespace tablespace_name;

List all expired backups
List expired backup;

List all backup Archives
List archivelog all;

Delele

Delete all old backups
Delete noprompt obsolete;

Delete expired backup
Delete noprompt expired backup;
The preceding command deletes the physical backup file and checks whether the backup is available.
Corsscheck backup;

Delete all expired Archives
Delete expired archivelog all;

Delete an archive within 60 days
Delete archivelog all completed before 'sysdate-60 ';
 
Crosscheck backup of archivelog all;

Crosscheck backup of controlfile: Check the backup set of the control file;

Crosscheck backup of spfile: Check the SPFILE backup set;

-------------------------------------- Recommended reading --------------------------------------

RMAN: Configure an archive log deletion policy

Basic Oracle tutorial-copying a database through RMAN

Reference for RMAN backup policy formulation

RMAN backup learning notes

Oracle Database Backup encryption RMAN Encryption

-------------------------------------- Split line --------------------------------------

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.