RMAN backs up the database and restores it to another machine.
1. dbid and data file name query on the source database run in archive Mode
Select dbid from v $ database;
Select file #, name from v $ datafile;
Create pfile from spfile
Select * from v $ logfile;
Close source database after rman backup
2. Create the same instance name on the target database. The database version must be consistent.
Network configuration file, password file, parameter file pfile, rman backup set (including control file, data file backup set), redo log copy to the corresponding directory
3. target database
Start to nomount: startup nomount pfile 'xx'
Rman target/
Start nomount
Set dbid = xxx (source database dbid)
Restore controlfile from backup set path
Alter database mount
Restore database
Recover database
Alter database open: consistent recovery or alter database open resetlogs; inconsistent recovery
-------------------------------------- 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 --------------------------------------
Note:
If the data file of the target database is different from the source database file path
Run {
Set newname for datafile 1 to 'd: \ oradata \ ocp \ SYSTEM01.DBF ';
Set newname for datafile 2 to 'd: \ oradata \ ocp \ UNDOTBS01.DBF ';
Set newname for datafile 3 to 'd: \ oradata \ ocp \ SYSAUX01.DBF ';
Set newname for datafile 4 to 'd: \ oradata \ ocp \ USERS01.DBF ';
Set newname for datafile 5 to 'd: \ oradata \ ocp \ EXAMPLE01.DBF ';
Set newname for datafile 6 to 'd: \ oradata \ ocp \ HYGEIA01.DBF ';
Set newname for datafile 7 to 'd: \ oradata \ ocp \ HYGEIA02.DBF ';
Restore database;
Switch datafile all;
}
Copy redo to the target database to the new path.
Alter database rename file 'original 'to 'destination Path'
Recover database;
Alter database open: consistent recovery or alter database open resetlogs; inconsistent recovery