There are several ways to move the oracle datafiles from operating system file system to oracle ASM file system. Following section will demonstrate how we can achieve that through RMAN copy command.
Step 01: Create a tablespace and put corresponding datafile in the OS file system.
E:\Documents and Settings\Arju>sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Sat Dec 19 22:07:28 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create tablespace migrate_asm datafile 'F:\migrate_to_asm.dbf' size 10M;
Tablespace created.
SQL> select file_name from dba_data_files where tablespace_name='MIGRATE_ASM';
FILE_NAME
--------------------------------------------------------------------------------
F:\MIGRATE_TO_ASM.DBF
Step 02: Take the tablespace offline.
The datafiles to which you want to move to asm file system take the corresponding tablespace offline. If you have many datafiles under one tablespace and want to move single or several from them then take the corresponding datafile offline.
SQL> ALTER TABLESPACE MIGRATE_ASM OFFLINE;
Tablespace altered.
Step 03: Check the ASM datafile location.
SQL> SELECT FILE_NAME FROM DBA_DATA_FILES;
FILE_NAME
--------------------------------------------------------------------------------
+DATADG/racdb/datafile/users.dbf
+DATADG/racdb/datafile/sysaux.dbf
+DATADG/racdb/datafile/undotbs.dbf
+DATADG/racdb/datafile/system.dbf
F:\MIGRATE_TO_ASM.DBF
5 rows selected.
Step 04: Connect to RMAN session and execute the copy command.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
E:\Documents and Settings\Arju>rman target /
Recovery Manager: Release 11.1.0.6.0 - Production on Sat Dec 19 23:07:44 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: A (DBID=3940131450)
RMAN> copy datafile 'F:\MIGRATE_TO_ASM.DBF' to '+DATADG';
RMAN> exit
Recovery Manager complete.
Step 05: Start a sqlplus session, rename the old file to new ASM file.
E:\Documents and Settings\Arju>sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Sat Dec 19 23:13:36 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>alter database rename file 'F:\MIGRATE_TO_ASM.DBF' to '+DATADG/racdb/datafile/MIGRATE_TO_ASM.DBF';
Database altered.
Step 06: Bring the tablespace online.
SQL> alter tablespace MIGRATE_ASM online;
Tablespace altered.
Step 07: Drop the file from OS file system.
rm F:\MIGRATE_TO_ASM.DBF
Related Documents
http://arjudba.blogspot.com/2009/12/enable-archive-log-mode-for-rac.html
No comments:
Post a Comment