ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 利用RMAN将非ASM文件移动到ASM里 - [ASM]

利用RMAN将非ASM文件移动到ASM里 - [ASM]

原创 Linux操作系统 作者:season0891 时间:2011-04-13 15:04:03 0 删除 编辑

利用RMAN将非ASM文件移动到ASM里 - [ASM]

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://oracler.blogbus.com/logs/39754517.html

ASM是将来的趋势,这段时间一直在研究ASM。进入正题。

1、要移动的数据文件

SQL> select file_name from dba_data_files where tablespace_name='USERS';

 FILE_NAME

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

+GQISJ/gqsj/datafile/users.264.686852255

+GQISJ/gqsj/datafile/users.268.687200231

+GQ/tmp/user01

/opt/app/oracle/user01.dbf

 

2、连接到RMAN

[oracle@lee dbs]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Fri May 22 17:46:40 2009

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

connected to target database: GQSJ (DBID=2809640057)

RMAN>

 

3、把表空间置为只读状态

RMAN> sql'alter database datafile 7 offline';

using target database control file instead of recovery catalog

sql statement: alter database datafile 7 offline

RMAN>

 

4、复制数据文件到ASM磁盘组

RMAN> backup as copy datafile 7 format'+gqisj';

Starting backup at 22-MAY-09

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=143 devtype=DISK

channel ORA_DISK_1: starting datafile copy

input datafile fno=00007 name=/opt/app/oracle/user01.dbf

output filename=+GQISJ/gqsj/datafile/users.269.687549245 tag=TAG20090522T175403 recid=1 stamp=687549244

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 22-MAY-09

 

5switch数据文件

RMAN> switch datafile 7 to copy;

datafile 7 switched to datafile copy "+GQISJ/gqsj/datafile/users.269.687549245"

 

6、把数据文件置为ONLINE

RMAN> sql'alter database datafile 7 online';

sql statement: alter database datafile 7 online

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

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

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

RMAN-03009: failure of sql command on default channel at 05/22/2009 17:56:37

RMAN-11003: failure during parse/execution of SQL statement: alter database data                                                                             file 7 online

ORA-01113: file 7 needs media recovery

ORA-01110: data file 7: '+GQISJ/gqsj/datafile/users.269.687549245'

这里是由于把数据文件置为OFFLINE没有做检查点,所以需要恢复。

 

RMAN> recover datafile 7;

Starting recover at 22-MAY-09

using channel ORA_DISK_1

starting media recovery

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

Finished recover at 22-MAY-09

 

RMAN> sql'alter database datafile 7 online';

sql statement: alter database datafile 7 online

 

7、删除原始的文件

[oracle@lee oracle]$ rm user01.dbf

 

8、同理我们可以把一个表空间移动到ASM,也可以从一个磁盘组移动到另一个磁盘组。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/90618/viewspace-692425/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-06-10

  • 博文量
    790
  • 访问量
    1968255