oracle 11g备份文件位置,11g rman备份恢复数据文件datafile到新的位置

----备份数据文件5

-bash-3.2$ rman target sys/system

backup datafile 5 format '/oracle/rmanbackup/backupwisdomone.dbf';

----恢复数据文件5到新的位置

-bash-3.2$ rman target sys/system

Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jun 6 05:04:27 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ZXY (DBID=1701163695)

----注意:run与{在同一行,不然运行会报错

run{

sql 'alter database datafile 5 offline';--恢复数据文件前先离线

set newname for datafile 5 to '/oracle/newwisdomone.dbf';--指定数据文件5新的存储位置

restore datafile 5;--还原数据文件

switch datafile 5;--切换数据文件

recover datafile 5;--恢复数据文件

sql 'alter database datafile 5 online';--数据文件在线

8> }

using target database control file instead of recovery catalog

sql statement: alter database datafile 5 offline

executing command: SET NEWNAME

Starting restore at 06-JUN-13

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=37 device type=DISK

datafile 5 is already restored to file /oracle/newwisdomone.dbf

restore not done; all files read only, offline, or already restored

Finished restore at 06-JUN-13

datafile 5 switched to datafile copy

input datafile copy RECID=3 STAMP=817362275 file name=/oracle/newwisdomone.dbf

Starting recover at 06-JUN-13

using channel ORA_DISK_1

starting media recovery

media recovery complete, elapsed time: 00:00:00

Finished recover at 06-JUN-13

sql statement: alter database datafile 5 online

RMAN> exit

Recovery Manager complete.

-bash-3.2$ sqlplus sys/system as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 6 05:04:46 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

----检查数据文件是否变更为新的存储位置

SQL> select file#,name from v$datafile;

FILE#

----------

NAME

--------------------------------------------------------------------------------

1

/oracle/app/oracle/oradata/zxy/system01.dbf

2

/oracle/app/oracle/oradata/zxy/sysaux01.dbf

3

/oracle/app/oracle/oradata/zxy/undotbs01.dbf

FILE#

----------

NAME

--------------------------------------------------------------------------------

4

/oracle/app/oracle/oradata/zxy/users01.dbf

5

/oracle/newwisdomone.dbf ---这个OK了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值