ITPub博客

首页 > 数据库 > Oracle > Oracle迁移数据文件从文件系统至裸设备

Oracle迁移数据文件从文件系统至裸设备

原创 Oracle 作者:abp0109 时间:2010-10-08 20:24:46 0 删除 编辑

客户一系统的某表空间的数据文件不知何原因在当初创建时将数据文件存放在了文件系统上,后经与客户协商,实施将文件系统上的数据文件移至裸设备上。

进入sqlplus命令行:

$ sqlplus '/as sysdba'

SQL*Plus: Release 9.2.0.6.0 - Production on Thu Aug 19 19:52:32 2010

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.6.0 - Production

offline该表空间:

SQL> alter tablespace BONC offline;

Tablespace altered.

迁移文件系统数据文件至裸设备:

$ rman target /

Recovery Manager: Release 9.2.0.6.0 - 64bit Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: HIUBI (DBID=2363790514)

RMAN> copy datafile 108 to '/dev/rv06_4_back007';

Starting copy at 19-AUG-10

using channel ORA_DISK_1

channel ORA_DISK_1: copied datafile 108

output filename=/dev/rv06_4_back007 recid=7 stamp=727473123

Finished copy at 19-AUG-10

重命名数据文件:

SQL> alter tablespace BONC

2 rename datafile '/arrayubi/oracle/product/9.2.0/dbs/D:ORACLEPRODUCT10.2.0ORADATAORCLbonc.dbf'

3 to '/dev/rv06_4_back007';

online该表空间并修改为read write:

SQL> alter tablespace BONC online;

Tablespace altered.

SQL> alter tablespace BONC read write;

Tablespace altered.

查验:

SQL> set linesize 120

SQL> col file_name for a30

SQL> select file_id,file_name,tablespace_name,bytes/1024/1024 M,status from dba_data_files where tablespace_name='BONC';

FILE_ID FILE_NAME TABLESPACE_NAME M STATUS

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

108 /dev/rv06_4_back007 BONC 2460 AVAILABLE

最后将原文件系统上的数据文件rm掉即可。

其实在遇到此类问题时,解决问题的思路还是比较简单的,有如下4步:

1、 使表空间离线

2、 使用rman的copy命令进行操作

3、 退出rman进入sqlplus命令行,对表空间数据文件进行重命名

4、 在线表空间并置为可读可写状态

[@more@]

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

下一篇: 内部错误ORA-04301
请登录后发表评论 登录
全部评论

注册时间:2010-01-21

  • 博文量
    17
  • 访问量
    36615