Copy Datafile Local To ASM

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

To copy the datafile to ASM from local, if its added by mistake.

****************************************************************
Example:
alter tablespace DHCP_DATA_2015_03_23 add datafile ' +PLMTPRDATA' size 1G a
utoextend on next 256m maxsize 30G;===>space before DG name.
alter tablespace DHCP_DATA_2015_03_23 add datafile 'PLMTPRDATA' size 1G aut
oextend on next 256m maxsize 30G;===>"+" missed in DG name.

Check the status of the tablespace.


***********************************
SQL> @tbs
size 2621504k,
TO increase size by 15% use command as below
select <substitute Tot size of tbs>*.15 from dual
Enter value for tablespace_name: DHCP_DATA_2015_03_23
TABLESPACE_NAME Tot size MB Tot Free MB %FREE %USED MAX_FR
EE CHUNKS_FREE
------------------------- ----------- ----------- ---------- ---------- --------
-- -----------
DHCP_DATA_2015_03_23 34816 1375 4 96 11
80 4

FILE_ID FILE_NAME TABLESPACE_NAME


ALLOCATED FREE_SPACE USED_SPACE
---------- --------------------------------------------- -----------------------
-- ---------- ---------- ----------
59 /u01/app/oracle/product/11.2.0.3/db1/dbs/ +PL DHCP_DATA_2015_03_23
1024 34 990 ==========>Datafile is at local instead of A
SM
MTPRDATA
117 +PLMTPRDATA/plmtpr/datafile/dhcp_data_2015_03 DHCP_DATA_2015_03_23
31744 161 31583
_23.636.873842401

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++
Bring the datafile offline.
***************************
SQL> alter database datafile 59 offline;
Database altered.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++
Copy the datafile from Local to ASM through rman and switch it.
***************************************************************
RMAN> copy datafile "/u01/app/oracle/product/11.2.0.3/db1/dbs/ +PLMTPRDATA" to "
+PLMTPRDATA";
Starting backup at 23-MAR-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1360 instance=plmtpr2 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00059 name=/u01/app/oracle/product/11.2.0.3/db1/dbs/
+PLMTPRDATA
output file name=+PLMTPRDATA/plmtpr/datafile/dhcp_data_2015_03_23.713.875125527
tag=TAG20150323T182527 RECID=9 STAMP=875125532
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 23-MAR-15
RMAN> switch datafile 59 to copy;
datafile 59 switched to datafile copy "+PLMTPRDATA/plmtpr/datafile/dhcp_data_201
5_03_23.713.875125527"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++
Recover the datafile.
*********************
RMAN> run
{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
recover datafile 59;
}2> 3> 4> 5> 6>
allocated channel: c1
channel c1: SID=593 instance=plmtpr2 device type=DISK
allocated channel: c2
channel c2: SID=1246 instance=plmtpr2 device type=DISK
Starting recover at 23-MAR-15
starting media recovery
media recovery complete, elapsed time: 00:00:09
Finished recover at 23-MAR-15
released channel: c1
released channel: c2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++
Bring it back online.
*********************
SQL> alter database datafile 59 online;
Database altered.

SQL> select FILE_ID,STATUS,ONLINE_STATUS from dba_data_files where FILE_ID=59;


FILE_ID STATUS ONLINE_
---------- --------- -------
59 AVAILABLE ONLINE
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++
Crosscheck the datafile if any is expired.
******************************************
RMAN> crosscheck datafilecopy all;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++
Done!, cool.

You might also like