Use RMAN for data migration

Source: Internet
Author: User

Use RMAN for data migration

Use RMAN for data migration

1. view the SCN and back up the database.

Run {
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate channel c3 type disk;
Allocate channel c4 type disk;
Allocate channel c5 type disk;
SQL 'alter system archive log current ';
Backup database tag 'db0' include current controlfile plus archivelog;
Release channel c1;
Release channel c2;
Release channel c3;
Release channel c4;
Release channel c5;
}

Backup File 249 GB, backup time 20 minutes

2. Transmit the backup to the target server (53 minutes)

3. Restore on the target server
Create the initmvbox. ora file under $ Oracle_HOME/dbs.
There is only one row in it
Db_name = mvbox

Start the database to nomount
Restore spfile to '/xxxx/spfilemvbox. ora' from '/xxxx/2015_06_11/o1_mf_nnsnf_DB0_bqky8s7r _. bkp ';

Restore Control Files
Shutdown abort;
Startup mount;
Restore controlfile from '/xxxx/2015_06_11/o1_mf_ncnnf_DB0_bqky8pq9 _. bkp ';
SQL 'alter database mount ';

Mount backup
Catalog start with '/xxxx/2015_06_11 ';

Restore database
Run {
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate channel c3 type disk;
Allocate channel c4 type disk;
Allocate channel c5 type disk;
Restore database;
Release channel c1;
Release channel c2;
Release channel c3;
Release channel c4;
Release channel c5;
}

It takes 30 minutes to restore the database.

4. Restore the database on the target server (actual service downtime)
First, service downtime
View the current SCN
Select to_char (CURRENT_SCN) from v $ database;

Back up archived logs
SQL 'alter system archive log current ';
Run {
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate channel c3 type disk;
Allocate channel c4 type disk;
Allocate channel c5 type disk;
Backup archivelog all tag 'arch0 ';
Release channel c1;
Release channel c2;
Release channel c3;
Release channel c4;
Release channel c5;
}

Because archive logs have been cleared before migration, the archive logs are only from the backup time to the current time.
The log volume is small. Backup and transmission can be completed within 10 minutes.

Command for clearing archived logs (delete noprompt archivelog all ;)

Mount archive logs
Catalog start with '/xxxx/2015_06_11 ';

Incomplete recovery,
Set until scn xxx
This number is the SCN viewed before the archived logs are backed up.

Run {
Shutdown immediate;
Startup mount;
Set until scn 79377202898;
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate channel c3 type disk;
Allocate channel c4 type disk;
Allocate channel c5 type disk;
Recover database;
Release channel c1;
Release channel c2;
Release channel c3;
Release channel c4;
Release channel c5;
}

It takes 11 minutes to restore the archive application (from to, 4 hours)

Alter database open resetlogs;

Migration completed.

Incomplete recovery from MySQL
We can find that
MySQL is restored first, binlog is applied, and then restored.
The recovery time is relatively short. The main time is to apply binlog (it takes 15 minutes for binlog to be restored every hour), and the final restoration does not take time (directly change datadir ..)

Oracle restores the database before restoring it.
The restoration time is relatively long (30 minutes), and the restoration time is relatively short (it takes 2 to 3 minutes for data to be restored every hour)
Therefore, it is important to maintain a recent restored backup on the backup server. at least 30 minutes of restoration time will be saved ..

-------------------------------------- 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.