关于RMAN恢复中的switch database …

来源:互联网 发布:尔雅网络课程怎么快进 编辑:程序博客网 时间:2024/06/05 19:04
After the RESTORE command but before the RECOVER command in yourRUN 
block, use a SWITCH command to update the control file with thenew 
filenames of the datafiles. The SWITCH command is equivalent tothe 
SQL statement ALTER DATABASE RENAME FILE. SWITCH DATAFILE ALLupdates
 the control file to reflect the new names for alldatafiles for 
 which a SET NEWNAME has been issued in the RUNblock.


RUN
{
  SQL 'ALTER TABLESPACE users OFFLINEIMMEDIATE';
  SQL 'ALTER TABLESPACE tools OFFLINEIMMEDIATE';
  # specify the new location for eachdatafile
  SET NEWNAME FOR DATAFILE '/olddisk/users01.dbf'TO 
  '/newdisk/users01.dbf';
  SET NEWNAME FOR DATAFILE '/olddisk/tools01.dbf'TO 
  '/newdisk/tools01.dbf';
  # to restore to an ASM disk group named dgroup,use: 
  # SET NEWNAME FOR DATAFILE'/olddisk/trgt/tools01.dbf'
  # TO '+dgroup';
  RESTORE TABLESPACE users, tools;
  SWITCH DATAFILE ALL; # update control file withnew filenames
  RECOVER TABLESPACE users, tools;
}
0 0
原创粉丝点击