Oracle 迁移库从文件系统到ASM

1、使用RMAN备份库

前提是,库必须是在archivelog模式下

RMAN> BACKUP FORMAT '/home/oracle/%t_%T.bkp' DATABASE;

2、设置新库SID

export ORACLE_SID=o1

3、启动新库到DUMMY的NOMOUNT状态,恢复SPFILE

RMAN> RESTORE SPFILE FROM '/home/oracle/808489927_20130227.bkp' to '/home/oracle/inito1.ora';

4、创建PFILE,修改PFILE

SQL> STARTUP NOMOUNT;

SQL> CREATE PFILE='/home/oracle/inito1.ora' FROM SPFILE;

修改PFILE中各路径

5、用修改后的PFILE启动并生成SPFILE,使用SPFILE启动

SQL> STARTUP PFILE='/home/oracle/inito1.ora';

SQL> CREATE SPFILE FROM PFILE='/home/oracle/inito1.ora';

SQL> SHUTDOWN IMMEDIATE;

SQL> STARTUP NOMOUNT;

6、还原控制文件

RMAN> RESTORE CONTROLFILE TO '+DATA/o1/controfile01.ctl' FROM'/home/oracle/808489927_20130227.bkp';

7、还原数据文件

RMAN>

run {

set newname for datafile '/u01/app/oracle/oradata/orcl/system01.dbf' to '+DATA/o1/system01.dbf';

set newname for datafile '/u01/app/oracle/oradata/orcl/sysaux01.dbf' to '+DATA/o1/sysaux01.dbf';

set newname for datafile '/u01/app/oracle/oradata/orcl/undotbs01.dbf' to '+DATA/o1/undotbs01.dbf';

set newname for datafile '/u01/app/oracle/oradata/orcl/users01.dbf' to '+DATA/o1/users01.dbf';

restore database;

}

8、做不完全恢复并打开数据库

SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;

指定其一个原先的REDOLOG文件

SQL> ALTER DATABASE OPEN RESETLOGS;

9、在ASM上增加REDOLOG

SQL> ALTER DATABASE ADD LOGFILE GROUP 4 '+DATA/o1/redo01.log' SIZE 100M;

SQL>ALTER DATABASE ADD LOGFILE GROUP 5 '+DATA/o1/redo02.log' SIZE 100M;

SQL>ALTER DATABASE ADD LOGFILE GROUP 6 '+DATA/o1/redo03.log' SIZE 100M;

10、逐步DROP原来的旧日志


你可能感兴趣的:(ASM,oracle,rman,迁移)