Oracle rman recovery from different machines and oracle Lerman recovery
|
Oracle source host |
Oracle target host |
Host Platform |
CentOS6.2 (final) |
CentOs6.2 (FInal) |
Host Name |
Vick |
Rman |
IP address |
192.168.1.11 |
192.168.1.10 |
Instance name |
Orcl |
Orcl |
Oracle version |
11.2.0.4 |
11. 2.0.4 |
Oracle Data File Storage |
Filesystem |
Filesystem |
Control File Path |
/U01/app/oracle/oradata |
/U01/app/oracle/oradata |
Data File Path |
/U01/app/oracle/oradata |
/U01/app/oracle/oradata |
Online redo log path |
/U01/app/oracle/oradata |
/U01/app/oracle/oradata |
View the control file information of the source database:
SQL> select name from v $ controlfile;
NAME
------------------------------------------------------------------------------
/U01/app/oracle/oradata/orcl/control01.ctl
/U01/app/oracle/fast_recovery_area/orcl/control02.ctl
Data File Information of the source database:
SQL> select file #, name from v $ datafile;
FILE # NAME
--------------------------------------------------------------------------------
1/u01/app/oracle/oradata/orcl/system01.dbf
2/u01/app/oracle/oradata/orcl/sysaux01.dbf
3/u01/app/oracle/oradata/orcl/undotbs01.dbf
4/u01/app/oracle/oradata/orcl/users01.dbf
5/u01/app/oracle/oradata/orcl/tbs_catalog.dbf
6/u01/app/oracle/oradata/orcl/dave01.dbf
Online redo log files in the source database:
SQL> select group #, member from v $ logfile;
GROUP # MEMBER
--------------------------------------------------------------------------------
1/u01/app/oracle/oradata/orcl/redo01.log
2/u01/app/oracle/oradata/orcl/redo02.log
3/u01/app/oracle/oradata/orcl/redo03.log
If there are different paths, you need to perform relevant operations.
Back up the database with rman on the source database, including the database
[Oracle @ vick ~] $ Mkdir/u01/backup
[Oracle @ vick ~] $ Rman target/
RMAN> run {
2> allocate channel c1 device type disk;
3> backup incremental level 0
4> format '/u01/backup/db_full _ % U. bkp'
5> tag '2017-11-14-full'
6> database plus archivelog;
7> release channel c1;
8>}
RMAN> backup current controlfile format '/u01/backup/control20141114. bak ';
RMAN> backup spfile format '/u01/backup/spfile20141114.bak ';
2. copy backup data on the target host and prepare related directories
Upload the backup to the target host
[Oracle @ vick backup] $ scp * 192.168.1.10:/u01/backup
Db_full_3kpnjk76_00001.bkp 100% 148 MB 11.4 MB/s
Db_full_3lpnjk7l_00001.bkp 100% 1103 MB 7.8 MB/s
Control20141114. bak 100% 9664KB 9.4 MB/s
Spfile20141114.bak 100% 96KB 96.0KB/s
Create related directories
[Oracle @ rman orcl] $ mkdir {adump, bdump, cdump, dpdump, udump, pfile}
[Oracle @ rman ~] $ Mkdir-p/u01/app/oracle/oradata/orcl
[Oracle @ rman ~] $ Mkdir-p/u01/app/oracle/fast_recovery_area/ORCL
Create a password file:
[Oracle @ rman dbs] $ orapwd file = $ ORACLE_HOME/dbs/orapw $ ORACLE_SID password = oracle
Create an initorcl. ora File
[Oracle @ rman ~] $ Echo 'db _ name = orcl '> $ ORACLE_HOME/dbs/initorcl. ora
Recovery from different hosts --> the following operations are performed on the target host
Set DBID
View the DBID of the source host
SQL> select dbid from v $ database;
DBID
----------
1387254920
[Oracle @ rman dbs] $ rman target/
RMAN> set dbid 1387254920
Executing command: SET DBID
MAN> startup nomount;
Connected to target database (not started)
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2251816 bytes
Variable Size 159384536 bytes
Database Buffers 50331648 bytes
Redo Buffers 5189632 bytes
Restore parameter files
RMAN> restore spfile from '/u01/backup/spfile20141114.bak ';
Starting restore at 14-NOV-14
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 19 device type = DISK
Channel ORA_DISK_1: restoring spfile from AUTOBACKUP/u01/backup/spfile20141114.bak
Channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 14-NOV-14
Restart nomout
RMAN> startup nomount force;
Oracle instance started
Total System Global Area 613797888 bytes
Fixed Size 2255712 bytes
Variable Size 427820192 bytes
Database Buffers 180355072 bytes
Redo Buffers 3366912 bytes
Restore Control File
RMAN> restore controlfile from '/u01/backup/control20141114. Bak ';
Starting restore at 14-NOV-14
Using channel ORA_DISK_1
Channel ORA_DISK_1: restoring control file
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Output file name =/u01/app/oracle/oradata/orcl/control01.ctl
Output file name =/u01/app/oracle/fast_recovery_area/orcl/control02.ctl
Finished restore at 14-NOV-14
RMAN> startup mount
RMAN> restore database;
If this step cannot be executed, you can use the list incarnation product to view the relevant information, switch and execute
Reset database to incarnation XX;
RMAN> recover database;
RMAN-03002: failure of recover command at 11/14/2014 22:19:36
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 1 with sequence 13 and starting SCN of 1208284
An error was reported in this step. Later I found that the catalog was not executed.
Then I executed catalog start with '/u01/backup /';
Run recover again.
But the same error still occurred.
Then, after I run list backup of archivelog all to view the information, I can execute the following script:
RMAN> run {
2> set until scn 1208284;
3> recover database;
4>}
Executing command: SET until clause
Starting recover at 14-NOV-14
Using channel ORA_DISK_1
Using channel ORA_DISK_2
Using channel ORA_DISK_3
Using channel ORA_DISK_4
Starting media recovery
Media recovery complete, elapsed time: 00:00:00
Finished recover at 14-NOV-14
Then log on to the database and execute
SQL> alter database open resetlogs;
Alter database open resetlogs
*
ERROR at line 1:
ORA-19751: cocould not create the change tracking file
ORA-19750: change tracking file:
'/U01/app/oracle/oradata/orcl/ORCL/changetracking/o1_mf_b511_77x _. chg'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
If an error occurs again, I will go to the/u01/app/oracle/oradata/orcl/ORCL/changetracking/directory to check whether this directory exists.
Then I executed
SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
Then shut down the database shutdown immediate;
Execute startup;
Database started successfully
This is the first two days of recovery from a different machine. It has a big head and many solutions are useless. The above are my problems and I hope to help some friends who have encountered similar problems.
Change the location of the change tracking file
1) do not close the database
SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE 'new _ location ';
Note: This method will lose the content of the change tracking file.