Wednesday, January 7, 2015

How to move system datafile from one ASM diskgroup to another

Follow the below steps to move system datafile from one ASM diskgroup to another.

1. Check the file which you need to move.
2. Stop the database and start it in mount mode.
3. Connect to rman 
4. issue the copy command from the rman prompt
5. login to the sql prompt and issue rename file command
6. stop and start the database

Note: Be very cautious while executing the rename file command as it will remove the original file from the ASM.(tested in 11.2.0.4)


[oracle@linux01 ~]$ sqlplus sys as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 2 03:09:48 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
+FRA_DG01/orcl/datafile/system.144021.867898701

[oracle@linux01 ~]$ srvctl stop database -d ORCL
[oracle@linux01 ~]$ srvctl start database -d ORCL -o mount
[oracle@linux01 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jan 2 03:05:00 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=408657265, not open)
RMAN> copy datafile '+FRA_DG01/orcl/datafile/system.144021.867898701' to '+DATA_DG01';
Starting backup at 02-JAN-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=81 instance=ORCL1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+FRA_DG01/orcl/datafile/system.144021.867898701
output file name=+DATA_DG01/orcl/datafile/system.307.867899135 tag=TAG20150102T030534 RECID=2 STAMP=867899143
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 02-JAN-15
RMAN> exit
Recovery Manager complete.
[oracle@linux01 ~]$sqlplus sys as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 2 03:06:19 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter database rename file '+FRA_DG01/orcl/datafile/system.144021.867898701' to '+DATA_DG01/orcl/datafile/system.307.867899135';
Database altered.
SQL> exit

[oracle@linux01 ~]$ srvctl stop database -d ORCL
[oracle@linux01 ~]$ srvctl start database -d ORCL
[oracle@linux01 ~]$ sqlplus sys as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 2 03:09:48 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------

+DATA_DG01/orcl/datafile/system.307.867899135

No comments:

Post a Comment