登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

飞哥的技术博客

世上无难事,只怕有心人!

 
 
 

日志

 
 
 
 

学习Mechanics of Datafile Restore Operations的注意点  

2009-06-23 20:20:08|  分类: Oracle |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

 学习Mechanics of Datafile Restore Operations的注意点收藏

 

学习Mechanics of Datafile Restore Operations的注意点

When you issue a RESTORE command, RMAN directs a server session to restore a suitable backup to either:

The default location, overwriting the files with the same name currently there

A new location, which you can specify with the SET NEWNAME command

To restore a datafile, either mount the database, or keep it open and take the datafile to be restored offline. When RMAN performs a restore, it creates the restored files as datafile image copies and records them in the repository.

The following table describes the behavior of the RESTORE, SET NEWNAME, and SWITCH commands.

No

RMAN restores the files to their current path names.

N/A

Yes

RMAN restores the files to the path names specified by SET NEWNAME and creates repository records for each datafile copy after the restore.

If yes, then RMAN replaces the current datafile names in the control file to the names of the restored files and current datafile names (if exists) are stored as datafile copies. If no, then RMAN doesn't update current datafile names and the restored file is retained as datafile copies.

For example, if you restore datafile ?/oradata/trgt/tools01.dbf to its default location, then RMAN restores the file ?/oradata/trgt/tools01.dbf and overwrites any file that it finds with the same filename. If you run a SET NEWNAME command before you restore a file, then RMAN creates a datafile copy with the name that you specify. For example, assume that you run the following commands:

RUN {

    SET NEWNAME FOR DATAFILE '/opt/oracle/oradata/ge02/users01.dbf' TO '/test/users01.dbf';

    RESTORE DATAFILE '/opt/oracle/oradata/ge02/users01.dbf';

}


In this case, RMAN creates a datafile copy of ?/oradata/trgt/tools01.dbf named /tmp/tools01.dbf and records it in the repository. To update the control file to use the datafile copy at ?/oradata/trgt/tools01.dbf to /tmp/tools01.dbf as the datafile, use the SWITCH command as shown in the following example:

SWITCH DATAFILE '/opt/oracle/oradata/ge02/users01.dbf' TO COPY;

The SWITCH command is the RMAN equivalent of the SQL statement ALTER DATABASE RENAME FILE.

注意红色的部分,只有这样写才正确,如果象下面的写法,则会报错:

RMAN> SWITCH DATAFILE '/opt/oracle/oradata/ge02/users01.dbf' TO COPY   '/test/users01.dbf' ;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-00558: error encountered while parsing input commands

RMAN-01009: syntax error: found "single-quoted-string": expecting one of: ";"

RMAN-01007: at line 1 column 66 file: standard input

RMAN> SWITCH DATAFILE 5 TO COPY   '/test/users01.dbf' ;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-00558: error encountered while parsing input commands

RMAN-01009: syntax error: found "single-quoted-string": expecting one of: ";"

RMAN-01007: at line 1 column 29 file: standard input

如果是上面红色的写法,则步会报错:

RMAN>

datafile 5 switched to datafile copy "/test/users01.dbf"

starting full resync of recovery catalog

full resync complete

RMAN> SWITCH DATAFILE '/opt/oracle/oradata/ge02/users01.dbf'  TO COPY;

datafile 5 switched to datafile copy "/test/users01.dbf"

starting full resync of recovery catalog

full resync complete

  评论这张
 
阅读(475)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018