无视这篇博文,没有写全,部分文件未迁移成功。
此前已经恢复过一个库
现在进行第二个库的恢复
切换一个没有用的实例名并登陆rman
$ export ORACLE_SID=PROD10
$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Jan 3 20:47:27 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)没有初始换参数文件的时候startup nomount 时RMAN会构造一个伪实例
RMAN> startup nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.4/db_1/dbs/initPROD10.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 281019272 bytes
Database Buffers 780140544 bytes
Redo Buffers 5517312 bytes指定备份集恢复spfile
RMAN> restore spfile from '/home/oracle/flash/PROD1/autobackup/2016_01_03/o1_mf_s_900189930_c8l5zb4v_.bkp';
Starting restore at 03-JAN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /home/oracle/flash/PROD1/autobackup/2016_01_03/o1_mf_s_900189930_c8l5zb4v_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 03-JAN-16将数据库关闭并且重启使用已经恢复的spfile启动到nomount
SQL> shutdown immediate
SQL> startup nomount
更改control_files,audit_file_dest,db_unique_name参数并重启
SQL> alter system set db_unique_name=PRDOD10 scope=spfile;
System altered.
SQL> alter system set audit_file_dest='/u01/app/oracle/admin/PROD10/adump' scope=spfile;
System altered.
SQL> alter system set control_files='/u01/app/oracle/oradata/PROD10/control01.ctl','/u01/app/oracle/fast_recovery_area/PROD10/control02.ctl' scope=spfile;
System altered.
SQL> shutdown immediate
SQL> startup nomount重新登陆RMAN开始恢复控制文件
$ rman target /
RMAN> restore controlfile from '/home/oracle/flash/PROD1/autobackup/2016_01_03/o1_mf_s_900189930_c8l5zb4v_.bkp';
Starting restore at 03-JAN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
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/PROD10/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/PROD10/control02.ctl
Finished restore at 03-JAN-16
SQL> alter database mount;
Database altered.
将数据库置为mount状态开始恢复参数文件
RMAN> alter database nmount;
RMAN> run{
2> set newname for database to '/u01/app/oracle/oradata/PROD10/%U';
3> restore database;
4> switch datafile all;
5> recover database;
6> alter database open resetlogs;
7> }
executing command: SET NEWNAME
Starting restore at 03-JAN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-SYSTEM_FNO-1
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-SYSAUX_FNO-2
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-UNDOTBS1_FNO-3
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-USERS_FNO-4
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-TEST1_FNO-6
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-TEST2_FNO-7
channel ORA_DISK_1: reading from backup piece
/home/oracle/flash/PROD1/backupset/2016_01_03/o1_mf_nnndf_TAG20160103T204521_c8l5z1x9_.bkp
channel ORA_DISK_1: piece
handle=/home/oracle/flash/PROD1/backupset/2016_01_03/o1_mf_nnndf_TAG20160103T204521_c8l5z1x9_.
bkp tag=TAG20160103T204521
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 03-JAN-16
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=900191499 file name=/u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-SYSTEM_FNO-1
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=900191499 file name=/u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-SYSAUX_FNO-2
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=900191499 file name=/u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-UNDOTBS1_FNO-3
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=900191499 file name=/u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-USERS_FNO-4
datafile 6 switched to datafile copy
input datafile copy RECID=11 STAMP=900191499 file name=/u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-TEST1_FNO-6
datafile 7 switched to datafile copy
input datafile copy RECID=12 STAMP=900191499 file name=/u01/app/oracle/oradata/PROD10/data_D-
PROD1_TS-TEST2_FNO-7
Starting recover at 03-JAN-16
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 10 is already on disk as file
/home/oracle/flash/PROD1/archivelog/2016_01_03/o1_mf_1_10_c8l5z8xy_.arc
archived log for thread 1 with sequence 11 is already on disk as file
/u01/app/oracle/oradata/PROD1/redo02.log
archived log file name=/home/oracle/flash/PROD1/archivelog/2016_01_03/o1_mf_1_10_c8l5z8xy_.arc
thread=1 sequence=10
archived log file name=/u01/app/oracle/oradata/PROD1/redo02.log thread=1 sequence=11
media recovery complete, elapsed time: 00:00:00
Finished recover at 03-JAN-16
Database altered.关于rodolog和temp的位置可以使用
alter database rename fiie '/...' to '/....'; 更改。
至此结束
本文记录了一次使用RMAN进行Oracle数据库迁移的实验过程。通过单个服务器上的备份,成功恢复了两个不同的数据库。首先,切换到未使用的实例并调整相关配置,如control_files, audit_file_dest和db_unique_name。接着,恢复控制文件并置数据库于mount状态,然后恢复参数文件。最后,利用alter database命令更改redo log和temp文件的位置完成恢复。"
116091416,10666184,算法竞赛解析:2050年挑战与Codeforces实战,"['算法竞赛', '数论问题', '图论算法', '矩阵操作', '路径规划']

1142

被折叠的 条评论
为什么被折叠?



