spfile='+DISK1/spfile'
RMAN> shutdown immediate
database closed
database dismounted
Oracle instance shut down
SQL> startup nomount pfile='/u02/backup/inittest_temp.ora'
ORACLE instance started.
Total System Global Area? 167772160 bytes
Fixed Size? ? ? ? ? ? ? ? ? 1272600 bytes
Variable Size? ? ? ? ? ? 109053160 bytes
Database Buffers? ? ? ? ? 54525952 bytes
Redo Buffers? ? ? ? ? ? ? ? 2920448 bytes
6.为了下一步将控制文件迁移到ASM中,修改control_files参数:
SQL> alter system set control_files='+DISK1/control01.ctl' scope=spfile;
System altered.
7.通过设置db_recovery_file_dest和db_recovery_file_dest_size来指定闪回区,这里闪回区大小设置为2G(因为这里只是进行迁移测试实验)
SQL> alter system set db_recovery_file_dest_size=2G;
System altered.
SQL> alter system set db_recovery_file_dest='+DISK1';
System altered.
8.将实例重新启动到nomount状态,使用RMAN在ASM中创建新的控制文件(使用原来控制文件来创建),切换数据文件,并执执恢复
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount pfile='/u02/backup/inittest_temp.ora'
ORACLE instance started.
Total System Global Area? 167772160 bytes
Fixed Size? ? ? ? ? ? ? ? ? 1272600 bytes
Variable Size? ? ? ? ? ? 109053160 bytes
Database Buffers? ? ? ? ? 54525952 bytes
Redo Buffers? ? ? ? ? ? ? ? 2920448 bytes
RMAN> restore controlfile from '/u01/app/oracle/oradata/test/control01.ctl';
Starting restore at 2015-04-01 17:11:20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: copied control file copy
output filename=+DISK1/control01.ctl
Finished restore at 2015-04-01 17:11:28
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> switch database to copy;
datafile 1 switched to datafile copy "+DISK1/test/datafile/system.266.875894803"
datafile 2 switched to datafile copy "+DISK1/test/datafile/undotbs1.263.875894899"
datafile 3 switched to datafile copy "+DISK1/test/datafile/sysaux.267.875894845"
datafile 4 switched to datafile copy "+DISK1/test/datafile/users.262.875894907"
datafile 5 switched to datafile copy "+DISK1/test/datafile/example.265.875894871"
datafile 6 switched to datafile copy "+DISK1/test/datafile/tspitr.264.875894885"
datafile 7 switched to datafile copy "+DISK1/test/datafile/test.261.875894909"
starting full resync of recovery catalog
full resync complete
RMAN> recover database;
Starting recover at 2015-04-01 17:12:29
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 2015-04-01 17:12:33
9.将临时文件迁移到ASM,必须为每个临时文件执行set newname命令,然后执行switch命令
RMAN> run
2> {
3> set newname for tempfile '/u01/app/oracle/oradata/test/temp01.dbf' to '+DISK1';
4>switch tempfile all;
5> }
executing command: SET NEWNAME
renamed temporary file 1 to +DISK1 in control file
starting full resync of recovery catalog
full resync complete
10.禁用闪回数据库并重新启动闪回数据库让闪回日志创建在ASM中
SQL> alter database flashback off;
Database altered.
SQL> alter database flashback on;
Database altered.
11.改变跟踪文件不会被迁移。只能禁用改变跟踪再重新启用改变跟踪,并将改变跟踪文件存储在ASM中
SQL> alter database disable block change tracking;
Database altered.
SQL> alter database enable block change tracking using file '+DISK1';
Database altered.
12.如果迁移的是主库,打开数据库
SQL> alter database open;
Database altered.
如果是备库,恢复管理恢复模式
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;