--Adding Test table space
sql> Create tablespace xff datafile '/u01/oradata/xifenfei.dbf ' size 10m autoextend on maxsize 100m;
Tablespace created.
--View Data File location
Sql> select name from V$datafile;
NAME
--------------------------------------------------------------------------------
+data/tasm/system01.dbf
+data/tasm/undotbs01.dbf
+data/tasm/sysaux01.dbf
+data/tasm/users01.dbf
+data/tasm/example01.dbf
/u01/oradata/xifenfei.dbf
6 rows selected.
--Create a test table
Sql> CREATE TABLE Hr.a tablespace xff
2 AS
3 SELECT * from Dba_tables;
Table created.
Sql> Select COUNT (*) from HR.A;
COUNT (*)
----------
1580
--Transfer data File location
[Oracle@localhost oradata]$ Rman Target/
Recovery manager:release 10.2.0.3.0-production on Mon June 27 04:30:22 2011
Copyright (c) 1982, +, Oracle. All rights reserved.
Connected to target Database:tasm (dbid=3032096031)
Rman> SQL ' alter tablespace xff offline ';
Using target database control file instead of recovery catalog
More Wonderful content: http://www.bianceng.cn/database/Oracle/
SQL Statement:alter tablespace xff offline
rman> Backup as copy tablespace xff format ' +data ';
Starting backup at 27-jun-11
Allocated Channel:ora_disk_1
Channel ora_disk_1:sid=132 Devtype=disk
Channel ora_disk_1:starting datafile Copy
Input datafile fno=00006 name=/u01/oradata/xifenfei.dbf
Output filename=+data/tasm/datafile/xff.269.754893121 tag=tag20110627t043200 recid=2 stamp=754893123
Channel ora_disk_1:datafile copy complete, elapsed time:00:00:03
Finished backup at 27-jun-11
rman> switch tablespace xff to copy;
DataFile 6 switched to datafile copy "+data/tasm/datafile/xff.269.754893121"
Rman> SQL ' alter tablespace XFF online ';
SQL Statement:alter tablespace xff Online
--View the transferred data file location
Sql> select name from V$datafile;
NAME
--------------------------------------------------------------------------------
+data/tasm/system01.dbf
+data/tasm/undotbs01.dbf
+data/tasm/sysaux01.dbf
+data/tasm/users01.dbf
+data/tasm/example01.dbf
+data/tasm/datafile/xff.269.754893121
6 rows selected.
--Test whether the data exists
Sql> Select COUNT (*) from HR.A;
COUNT (*)
----------
1580
--Create a file alias in ASM
asmcmd> Mkalias +data/tasm/datafile/xff.269.754893121 +data/tasm/xff01.dbf
--File Rename
sql> alter tablespace XFF offline;
Tablespace altered.
sql> ALTER DATABASE rename file ' +data/tasm/datafile/xff.269.754893121 ' to ' +data/tasm/xff01.dbf ';
Database altered.
sql> alter tablespace XFF online;
Tablespace altered.
Sql> select name from V$datafile;
NAME
--------------------------------------------------------------------------------
+data/tasm/system01.dbf
+data/tasm/undotbs01.dbf
+data/tasm/sysaux01.dbf
+data/tasm/users01.dbf
+data/tasm/example01.dbf
+data/tasm/xff01.dbf
6 rows selected.
--delete original data manually
[Oracle@localhost oradata]$ RM xifenfei.dbf
Note: You can transfer the data file location in Rman, while processing the alias, and then renaming the table space, implementation requires only tablespace offline once
Author: 51cto Oracle small-mixed son