Tabs

Showing posts with label ASM. Show all posts
Showing posts with label ASM. Show all posts

Tuesday, January 13, 2015

How to Move datafile into Oracle ASM using RMAN

How to move a datafile that was created on the OS to ASM.

Issue:
Datafile created on the OS instead of in ASM

Given:
RAC 3 nodes
tablespace has multiple datafiles 

 Check the status of the file:
select df.file#,to_char(df.creation_time,'mm-dd-yyyy hh24:mi:ss') created,df.name,ts.name,df.status from v$datafile df,v$tablespace ts where df.ts#=ts.ts# and df.file#=127;


FILE# CREATION_TIME       NAME                        TS_NAME        STATUS
----- ------------------- --------------------------- -------------- ------
127   12-10-2015 05:06:27 dbhome_1/dbs/DBNAME_DATA_01 APPS_TS_TX_IDX ONLINE


RMAN> connect target /

connected to target database: DBNAME (DBID=2919937482)

RMAN> copy datafile 127 to '+DBNAME_DATA_01';
Starting backup at 10-DEC-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=854 instance=DBNAME1 device type=DISK
allocated channel: ORA_DISK_2

channel ORA_DISK_1: starting datafile copy
input datafile file number=00127 name=/icm01/u0001/app/oracle/product/11.2.0/dbhome_1/dbs/DBNAME_DATA_01
output file name=+DBNAME_DATA_01/DBNAME/datafile/apps_ts_tx_idx.480.801661731 tag=TAG20121210T114844 RECID=54 STAMP=801661781
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:56
Finished backup at 10-DEC-12

Starting Control File and SPFILE Autobackup at 10-DEC-12
piece handle=+DBNAME_FRA_01/DBNAME/autobackup/2012_12_10/s_801661785.5682.801661787 comment=NONE
Finished Control File and SPFILE Autobackup at 10-DEC-12

RMAN> switch datafile 127 to copy;
datafile 127 switched to datafile copy "+DBNAME_DATA_01/DBNAME/datafile/apps_ts_tx_idx.480.801661731"

RMAN> exit


Recovery Manager complete.


SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 10 11:50:32 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options




FILE# CREATION_TIME       NAME                     TS_NAME          STATUS
----- ------------------- ------------------------ ---------------- -------
127   12-10-2015 05:06:27
+apps_ts_tx_idx.480.   APPS_TS_TX_IDX RECOVER
                        801661731

>rman

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Dec 10 11:51:22 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect target /

connected to target database: DBNAME (DBID=2919937482)

RMAN> recover datafile 127;

Starting recover at 10-DEC-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=3679 instance=DBNAME1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=3955 instance=DBNAME1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=4524 instance=DBNAME1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=4799 instance=DBNAME1 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=5082 instance=DBNAME1 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:07

Finished recover at 10-DEC-12

RMAN> exit
Recovery Manager complete.

SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 10 11:52:06 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options



FILE# CREATION_TIME       NAME                     TS_NAME          STATUS
----- ------------------- ------------------------ ---------------- -------
127   12-10-2015 05:06:27
+apps_ts_tx_idx.480.   APPS_TS_TX_IDX OFFLINE
                        801661731


SQL> alter database datafile 127 online;
Database altered.

SQL>

FILE# CREATION_TIME       NAME                     TS_NAME          STATUS
----- ------------------- ------------------------ ---------------- -------
127   12-10-2015 05:06:27
+apps_ts_tx_idx.480.   APPS_TS_TX_IDX ONLINE
                        801661731

DBNAMEb01cdp(DBNAME1)  /icm01/u0001/app/oracle/product/11.2.0/dbhome_1/dbs
>rm DBNAME_DATA_01

How to add a new diskgroup to existing ASM diskgroup in 11gR2

Here I am going to show you how to add new disks( or extra space/storage) to the existing ASM diskgroups.

Given:

Unix SA has provided/presented the new raw devices with the same size as the existing disks in our ASM disk group.


here my asm discovery path or the location where the new disks have been presented is
"/dev/oracle/"

given/need to add the six new disks:


crw------- 1 oracle oinstall 302, 42061 Dec 8 14:59 disk64g_t1_0028
crw------- 1 oracle oinstall 302, 42062 Dec 8 14:59 disk64g_t1_0029
crw------- 1 oracle oinstall 302, 42063 Dec 8 14:59 disk64g_t1_0030
crw------- 1 oracle oinstall 302, 42064 Dec 8 14:59 disk64g_t1_0031
crw------- 1 oracle oinstall 302, 42065 Dec 8 14:59 disk64g_t1_0032
crw------- 1 oracle oinstall 302, 42066 Dec 8 14:59 disk64g_t1_0033


current disk group info:

ASM Diskgroup information ..


DiskGroup Name       %Used TOTAL_MB      FREE_MB
-------------------- ----- ------------ ------------
ICMQA_DATA_01         95    1,768,532     85,547


To the above disk group we are going to add new disks.


Invoke asmca after setting the X11 and display settings.


my unix host(+ASM1) /export/home/oracle
>asmca


then follow the screen shots.




now click on disk groups.



right click on the disk group where you want to add new disks to.




click on add disks.




now select the disks that you want to add to and click ok.





disks have added now.

After adding the disks.





ASM Diskgroup information ..


DiskGroup Name  %Used  TOTAL_MB   FREE_MB
--------------- ----- ---------- ---------
ICMQA_DATA_01    78    2,161,538  478,541