天天看点

改变 Flash Recovery Area (FRA)到一个新路径的方法

改变 Flash Recovery Area (FRA)到一个新路径的方法。

目标:

本文描述了改变FRA目的地的方法和从老的FRA中move file到新FRA的方法

解决方案:

如果你需要改变你的FRA到新的路径,需要从sqlplus里边改变DB_RECOVERY_FILE_DEST初始化参数:

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='+disk1' SCOPE=BOTH SID='*';      

当你改变这个参数之后,新的所有的FRA file 将会建立在新的路径下

永久的file(控制文件和在线日志文件),闪回日志和临时文件可以放在老的FRA区里边。当这些临时文件可以被删除时,数据库将会从老的FRA区里边删除这些临时文件.

为了闪回日志能使用新的'db_recovery_file_dest'位置,数据库的闪回选项需要off掉再on

类似如下的方法:

- Shutdown the Database    
   SQL> shutdown immediate

 - Startup mount the Database:
   SQL> startup mount; 

 - Drop the garanteed restore points    
   SQL> select * from v$restore_point;
        drop restore point <name>;

 - Toggle the Flashback off:
   SQL> alter database flashback off; 

 - Toggle the Flashback on:
   SQL> alter database flashback on; 

 - Open the Database:
   SQL> alter database open;      

如果你需要move你的永久文件、临时文件到新的FRA区中,请使用下面的步骤:

1) To move the existing backupsets and archived redo log files,use the following command:

RMAN> BACKUP AS COPY ARCHIVELOG ALL DELETE INPUT;
    RMAN> BACKUP DEVICE TYPE DISK BACKUPSET ALL DELETE INPUT;      

 2) To move the datafile copies. Run the below command for each datafile copy:

RMAN> BACKUP AS COPY DATAFILECOPY <name> DELETE INPUT;      

     where the <name> is the datafilecopy name in the old recovery area.

3) To move the controlfile from the old Flash Recovery Area to new one.

   Change the location in the parameter CONTROL_FILES to the new location

   and restart the instance in NOMOUNT.

RMAN> RESTORE CONTROLFILE FROM 'filename_of_old_control_file';      

 4) To move the online redo logs. Use the commands to add a a log file stored in

   the new Flash Recovery Area and drop the logfile in the old Flash Recovery Area

   for each redo log group.

SQL> alter database add logfile size 100M;
SQL> alter database drop logfile '<name of the old redo log>';      

 Oracle will clean up transient files remaining in the old Flash Recovery Area

location as they become eligible for deletion.