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