网络很多帖子介绍的都是不完全恢复的方法.
注意: 迁移前要保证是归档状态下.
1 迁移在线重做日志文件
迁移重做日志的方法与不完全恢复的做法是一致的。在ASM上有两个磁盘组,一个是DATA,一个是FRA。
1.1 修改参数
SQL> show parameter db_create;
NAME TYPE VALUE
------------------------------ ----------- -------------
db_create_file_dest string
db_create_online_log_dest_1 string
db_create_online_log_dest_2 string
db_create_online_log_dest_3 string
db_create_online_log_dest_4 string
db_create_online_log_dest_5 string
SQL> alter system set db_create_online_log_dest_1 = '+DATA';
System altered.
SQL> alter system set db_create_file_dest = '+DATA';
System altered.
SQL> alter system set db_recovery_file_dest = '+FRA';
System altered.
SQL> show parameter db_create;
NAME TYPE VALUE
------------------------------ ----------- -------------
db_create_file_dest string +DATA
db_create_online_log_dest_1 string +DATA
db_create_online_log_dest_2 string
db_create_online_log_dest_3 string
db_create_online_log_dest_4 string
db_create_online_log_dest_5 string
SQL> show parameter db_recovery
NAME TYPE VALUE
------------------------------- ----------- -------------
db_recovery_file_dest string +FRA
db_recovery_file_dest_size big integer 2G
1.2 增加日志组
增加日志组,新的日志组路径指向ASM,并删除旧的日志组
SQL> alter database add logfile group 4 size 25M;
Database altered.
SQL> alter database add logfile group 5 size 25M;
Database altered.
SQL> alter database add logfile group 6 size 25M;
Database altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- -------------
1 INACTIVE
2 INACTIVE
3 CURRENT
4 UNUSED
5 UNUSED
6 UNUSED
6 rows selected.
1.3 删除日志组
SQL> alter database drop logfile group 1;
Database altered.
SQL> alter database drop logfile group 2;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system checkpoint;
System altered.
SQL> alter database drop logfile group 3;
Database altered.
1.4 查看ASM日志组
此时可以看到在ASM上的日志组信息:
[oracle@cent4 ~]$ asmcmd
ASMCMD> ls
DATA/
FRA/
ASMCMD> cd data
ASMCMD> cd test
ASMCMD> cd onlinelog
ASMCMD> ls
group_4.256.752606807
group_5.257.752606815
group_6.258.752606821
ASMCMD> pwd
+data/test/onlinelog
2 迁移数据文件
迁移数据文件要在mount的状态下进行。
2.1 原数据库切换到mount状态下
SQL> shutdown immediate
SQL> startup mount
2.2 在rman下迁移数据文件
[oracle@cent4 ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on 星期二 5月 31 17:29:36 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: TEST (DBID=2050570208, not open)
RMAN> backup as copy database format '+DATA';
Starting backup at 2011-05-31 17:29:54
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=100 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/oradata/test/system01.dbf
output filename=+DATA/test/datafile/system.259.752606999 tag=TAG20110531T172955 recid=2 stamp=752607035
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/oradata/test/sysaux01.dbf
outp