How to relocate datafiles using RMAN [ID 755620.1]

How to relocate datafiles using RMAN [ID 755620.1]

 Modified 06-DEC-2010     Type HOWTO     Status PUBLISHED 

In this Document
  Goal
  Solution
  References


 

 

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.3 and later   [Release: 10.2 and later ]
Information in this document applies to any platform.
***Checked for relevance on 07-Dec-2010***

Goal

How to relocate all database files using RMAN. Database must be in MOUNT mode.

Solution

The examples below use /u002/oradata/ORA1020 as the new destination. You can use any destinations you like, including new ASM disk groups:

1) restart database in mount mode

SQL> shutdown immediate;
SQL> startup mount;

2)copy all datafiles to the new location

a) allow RMAN to generate the new name:

RMAN> backup as copy database format '/u002/oradata/ORA1020/%U';
    or
RMAN> backup as copy database format '+DGROUP4';


b) if you need to rename your datafiles to specific names, you will need to copy each datafile as follows:

RMAN> backup as copy datafile 1 format '/u002/oradata/ORA1020/datafile01.dbf';
    or
RMAN> backup as copy datafile 6 format '+DGROUP4';


3) switch to the datafile copies

RMAN> switch database to copy;


4) relocate the online redo logs

As online redo logs are not backed up by RMAN, you will need to relocate them outside of RMAN:

a) identify the list of online redo logs:

SQL> select * from v$logfile;

b) make an o/s copy of the line redo logs to the new location:

$ cp /tmp/redo01.log /u002/oradata/ORA1020/redo01.rdo
$ cp /tmp/redo02.log /u002/oradata/ORA1020/redo02.rdo
$ cp /tmp/redo03.log /u002/oradata/ORA1020/redo03.rdo
$ cp /tmp/redo04.log /u002/oradata/ORA1020/redo04.rdo

Note: as of 11g, you can also cp to an ASM diskgroup

c) now rename the log files, do this for each of the redo log files:

 SQL> alter database rename file '/tmp/redo01.log' to '/u002/oradata/ORA1020/redo01.rdo';
 SQL> alter database rename file '/tmp/redo02.log' to '/u002/oradata/ORA1020/redo02.rdo';
 SQL> alter database rename file '/tmp/redo03.log' to '/u002/oradata/ORA1020/redo03.rdo';
 SQL> alter database rename file '/tmp/redo04.log' to '/u002/oradata/ORA1020/redo04.rdo';

 

5) relocate the controlfiles

a) backup current controlfile to new location:

RMAN> backup as copy current controlfile format '/u002/oradata/ORA1020/control001.ctl';

b) duplicate the controlfile copy:

RMAN> backup as copy controlfilecopy '/u002/oradata/ORA1020/control01.ctl' format '/u002/oradata/ORA1020/control02.ctl';

c) change the controlfile locations:

SQL> startup nomount;
SQL> show parameter control

SQL> alter system set control_files='/u002/oradata/ORA1020/control01.ctl','/u002/oradata/ORA1020/control02.ctl'
scope=spfile;

SQL> alter database mount;
RMAN> recover database;
RMAN> alter database open;
 

 

6) if you need to relocate temp then simply drop and recreate it in SQL*Plus:

SQL> alter database drop temporary tablespace temp;
SQL> create temporary tablespace temp datafile '/tmp/temp01.dbf' size 100m;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值