当前位置:Gxlcms > mysql > OracleRMAN跨平台恢复测试(Windows-Linux)

OracleRMAN跨平台恢复测试(Windows-Linux)

时间:2021-07-01 10:21:17 帮助过:68人阅读

原数据库为ORACLE11G 11.2.0.3,跑在64位WINDOWS上,使用RMAN做了个备份,将备份文件上传到Linux服务器上的/home/oracle/rmanbac

原数据库为Oracle11G 11.2.0.3,跑在64位WINDOWS上,使用RMAN做了个备份,将备份文件上传到Linux服务器上的/home/oracle/rmanbackup目录中,准备恢复到64位LINUX上,过程如下:

将数据库启动到nomount状态

oracle@changeme:~> sqlplus /nolog
SQL> conn / as sysdba
SQL> startup nomount
SQL> exit

进入RMAN进行恢复

oracle@changeme:~> rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 29 17:39:40 2013

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

connected to target database: CSDB (not mounted)

RMAN> set DBID=3039653104

executing command: SET DBID


RMAN> restore controlfile from '/home/oracle/rmanbackup/CTL_0FODDSB1_20130629';

Starting restore at 29-JUN-13
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/csdb/control01.ctl
Finished restore at 29-JUN-13

RMAN> sql 'alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1

RMAN> catalog start with '/home/oracle/rmanbackup';

Starting implicit crosscheck backup at 29-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
Crosschecked 8 objects
Finished implicit crosscheck backup at 29-JUN-13

Starting implicit crosscheck copy at 29-JUN-13
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 29-JUN-13

searching for all files in the recovery area
cataloging files...
no files cataloged

searching for all files that match the pattern /home/oracle/rmanbackup

List of Files Unknown to the Database
=====================================
File Name: /home/oracle/rmanbackup/ARCH_0GODDSKM_20130629
File Name: /home/oracle/rmanbackup/DB_INC0_0DODDS85_20130629
File Name: /home/oracle/rmanbackup/CTL_0FODDSB1_20130629
File Name: /home/oracle/rmanbackup/DB_INC0_0EODDSAQ_20130629

Do you really want to catalog the above files (enter YES or NO)? y
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /home/oracle/rmanbackup/ARCH_0GODDSKM_20130629
File Name: /home/oracle/rmanbackup/DB_INC0_0DODDS85_20130629
File Name: /home/oracle/rmanbackup/CTL_0FODDSB1_20130629
File Name: /home/oracle/rmanbackup/DB_INC0_0EODDSAQ_20130629

RMAN> run{
2> allocate channel c1 type disk;
3> set newname for datafile 1 to '/u01/app/oracle/oradata/csdb/system01.dbf';
4> set newname for datafile 2 to '/u01/app/oracle/oradata/csdb/sysaux01.dbf';
5> set newname for datafile 3 to '/u01/app/oracle/oradata/csdb/undotbs1.dbf';
6> set newname for datafile 4 to '/u01/app/oracle/oradata/csdb/users01.dbf';
7> set newname for datafile 5 to '/u01/app/oracle/oradata/csdb/example01.dbf';
8> set newname for datafile 6 to '/u01/app/oracle/oradata/csdb/undotbs2.dbf';
9> set newname for datafile 7 to '/u01/app/oracle/oradata/csdb/testtbs01.dbf';
10> restore database;
11> switch datafile all;
12> release channel c1;
13> }

released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=134 device type=DISK

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 29-JUN-13

channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to /u01/app/oracle/oradata/csdb/system01.dbf
channel c1: restoring datafile 00002 to /u01/app/oracle/oradata/csdb/sysaux01.dbf
channel c1: restoring datafile 00003 to /u01/app/oracle/oradata/csdb/undotbs1.dbf
channel c1: restoring datafile 00004 to /u01/app/oracle/oradata/csdb/users01.dbf
channel c1: restoring datafile 00005 to /u01/app/oracle/oradata/csdb/example01.dbf
channel c1: restoring datafile 00006 to /u01/app/oracle/oradata/csdb/undotbs2.dbf
channel c1: restoring datafile 00007 to /u01/app/oracle/oradata/csdb/testtbs01.dbf
channel c1: reading from backup piece /home/oracle/rmanbackup/DB_INC0_0DODDS85_20130629
channel c1: piece handle=/home/oracle/rmanbackup/DB_INC0_0DODDS85_20130629 tag=DB_INCR0
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:25
Finished restore at 29-JUN-13

datafile 1 switched to datafile copy
input datafile copy RECID=15 STAMP=819395669 file name=/u01/app/oracle/oradata/csdb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=16 STAMP=819395669 file name=/u01/app/oracle/oradata/csdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=17 STAMP=819395669 file name=/u01/app/oracle/oradata/csdb/undotbs1.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=18 STAMP=819395669 file name=/u01/app/oracle/oradata/csdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=19 STAMP=819395669 file name=/u01/app/oracle/oradata/csdb/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=20 STAMP=819395669 file name=/u01/app/oracle/oradata/csdb/undotbs2.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=21 STAMP=819395669 file name=/u01/app/oracle/oradata/csdb/testtbs01.dbf

released channel: c1

RMAN> run{
2> allocate channel ch1 type disk;
3> recover database;
4> release channel ch1;
5> }

allocated channel: ch1
channel ch1: SID=134 device type=DISK

Starting recover at 29-JUN-13

starting media recovery

人气教程排行