日期:2014-05-16 浏览次数:20421 次
环境:
sys@ORCL> select * from v$version; BANNER ---------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod sys@ORCL> !uname Linux
⑴ 修改控制文件的位置
sys@ORCL> show parameter control_files NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string /u01/app/oracle/oradata/ORCL/c ontrolfile/o1_mf_8050hgfp_.ctl , /u01/app/oracle/flash_recove ry_area/ORCL/controlfile/o1_mf _8050hgqh_.ctl sys@ORCL> alter database backup controlfile to '/home/oracle/ctlasm.ctl'; sys@ORCL> alter system set control_files='+WATER' scope=spfile; sys@ORCL> shutdown immediate;
⑵ 数据文件迁移
RMAN> startup nomount RMAN> restore controlfile from '/home/oracle/ctlasm.ctl'; RMAN> alter database mount; RMAN> backup as copy database format '+WATER'; RMAN> recover database; RMAN> switch database to copy;
⑶ 日志文件迁移
idle> conn / as sysdba idle> alter database open resetlogs; idle> alter database add logfile group 4 '+WATER/redo04.log' size 50m; idle> alter database add logfile group 5 '+WATER/redo05.log' size 50m; idle> alter database add logfile group 6 '+WATER/redo06.log' size 50m; idle> select group#,status from v$log; GROUP# STATUS ---------- ---------------- 1 UNUSED 2 CURRENT 3 UNUSED 4 UNUSED 5 UNUSED 6 UNUSED idle> alter system switch logfile; idle> alter system switch logfile; idle> alter system switch logfile; idle> select group#,status from v$log; GROUP# STATUS ---------- ---------------- 1 ACTIVE 2 ACTIVE 3 ACTIVE 4 ACTIVE 5 ACTIVE 6 CURRENT idle> alter system checkpoint; idle> alter database drop logfile group 1; idle> alter database drop logfile group 2; idle> alter database drop logfile group 3; idle> select member from v$logfile; MEMBER ---------------------------------------------------------------- +WATER/redo04.log +WATER/redo05.log +WATER/redo06.log
⑷ 临时文件迁移
sys@ORCL> select file_name,tablespace_name from dba_temp_files; FILE_NAME TABLESPACE_NAME ----------------------------- ------------------------------ /u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_8050j34j_.tmp TEMP sys@ORCL> alter tablespace temp add tempfile '+WATER'; sys@ORCL> select file_name,tablespace_name from dba_temp_files; FILE_NAME TABLESPACE_NAME ----------------------------- ------------------------------ +WATER/orcl/tempfile/temp.265.798479421 TEMP /u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_8050j34j_.tmp TEMP sys@ORCL&g