实施将文件系统上的数据文件移至裸设备上:
进入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、 在线表空间并置为可读可写状态