Moving a Single Datafile from File System to ASM System
Connect to sqlplus and create a new tablespace
SQL>
select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/myasm/datafile/system.302.907085491
+DATA/myasm/datafile/sysaux.303.907085493
+DATA/myasm/datafile/undotbs1.304.907085495
+DATA/myasm/datafile/users.305.907085495
SQL>
create tablespace demo datafile '/u01/demo2.dbf' size 10M;
Tablespace
created.
SQL>
select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/myasm/datafile/system.302.907085491
+DATA/myasm/datafile/sysaux.303.907085493
+DATA/myasm/datafile/undotbs1.304.907085495
+DATA/myasm/datafile/users.305.907085495
/u01/demo2.dbf
SQL>
alter tablespace demo offline;
Tablespace
altered.
SQL>
!rman target /
Recovery
Manager: Release 11.2.0.1.0 - Production on Mon Mar 21 21:57:43 2016
Copyright
(c) 1982, 2009, Oracle and/or its affiliates.
All rights reserved.
connected to
target database: MYASM (DBID=36010415)
RMAN>
copy datafile '/u01/demo2.dbf' to '+DATA';
Starting
backup at 21-MAR-16
using target
database control file instead of recovery catalog
allocated
channel: ORA_DISK_1
channel
ORA_DISK_1: SID=42 device type=DISK
channel
ORA_DISK_1: starting datafile copy
input
datafile file number=00006 name=/u01/demo2.dbf
output file
name=+DATA/myasm/datafile/demo.319.907106321 tag=TAG20160321T215829
RECID=1 STAMP=907106329
channel
ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26
Finished
backup at 21-MAR-16
RMAN>
exit
Recovery
Manager complete.
SQL>
alter database rename file '/u01/demo2.dbf' to
'+DATA/myasm/datafile/demo.319.907106321' ;
Database
altered.
SQL>
alter tablespace demo online;
Tablespace
altered.
SQL>
select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/myasm/datafile/system.302.907085491
+DATA/myasm/datafile/sysaux.303.907085493
+DATA/myasm/datafile/undotbs1.304.907085495
+DATA/myasm/datafile/users.305.907085495
+DATA/myasm/datafile/demo.319.907106321
6 rows
selected.
SQL>