Convert Non ASM to ASM disks in Oracle

Convert from NON-ASM to ASM disks Oracle

Automatic storage management is feature in oracle for make error detection or redundancy/mirroring in data without special level raid hard disk. Convert database from normal disk to ASM with help of RMAN. You can migrate your data files from Disk to ASM Disk with help of RMAN.

Steps to migrate datafiles from NON ASM disk to ASM Disk.

1. Check Block change tracking : v$block_change_tracking;

Select * from v$block_change_tracking;

2. Shutdown the database:

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

3. Create Pfile and add/modify the below parameters:

[oracle@node1-pub oracle]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 21 12:17:50 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.

SQL> create pfile from spfile;

4. Modify Pfile with these parameters:
I have already created 2 ASM diskgroups DATA and FLASH.

*.control_files=(+DATA, +FLASH)
*.db_recovery_file_dest=+FLASH
*.db_recovery_file_dest_size=2147483648
*.db_create_file_dest=+DATA
*.db_create_online_log_dest_1=+FLASH
*.db_create_online_log_dest_2=+DATA -- optional if you want another online redo logs dest.

5. Create spfile back from modified pfile:
PS: take a copy of original spfile before you overwrite spfile using below command.

create spfile from pfile;

6. Copy Database to ASM diskgroups using rman

1. Start the instance on NOMOUNT state
2. Copy the controlfile from old location to ASM using "restore" rman command
3. Mount the database
4. Copy the datafiles to ASM disk group using rman "BACKUP AS COPY DATABASE" command
5. Switch database to COPY and open the database.
[oracle@node1-pub oracle]$ $ORACLE_HOME/bin/rman
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jul 21 10:03:10 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.

RMAN> connect target
connected to target database (not started)

RMAN> startup nomount
Oracle instance started
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 83888372 bytes
Database Buffers 79691776 bytes
Redo Buffers 2973696 bytes

RMAN> restore controlfile from '/home/oracle/oradata/db10g/control01.ctl';
Starting restore at 21-JUL-06
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
channel ORA_DISK_1: copied control file copy
output filename=+DATA/db10g/controlfile/backup.256.596369129
output filename=+FLASH/db10g/controlfile/backup.256.596369131
Finished restore at 21-JUL-06

RMAN> startup mount
database is already started
database mounted
released channel: ORA_DISK_1

RMAN> configure device type disk parallelism 4;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored

RMAN> BACKUP AS COPY DATABASE FORMAT '+DATA';
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:21
Finished backup at 21-JUL-06

RMAN> SWITCH DATABASE TO COPY;
datafile 1 switched to datafile copy "+DATA/db10g/datafile/system.257.596369339"
datafile 2 switched to datafile copy "+DATA/db10g/datafile/undotbs1.259.596369341"
datafile 3 switched to datafile copy "+DATA/db10g/datafile/sysaux.258.596369341"
datafile 4 switched to datafile copy "+DATA/db10g/datafile/users.260.596369341"

RMAN> alter database open;
database opened

RMAN> exit
Recovery Manager complete.

7. Migrate tempfile to ASM:
The tempfile has to be manually migrated to ASM.

[oracle@node1-pub oracle]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 21 10:12:42 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select name, bytes from v$tempfile;

SQL> create temporary tablespace temp1 tempfile SIZE 100M extent management local uniform size 1M;
Tablespace created.

SQL> alter database default temporary tablespace temp1;
Database altered.

SQL> drop tablespace temp including contents;
Tablespace dropped.

SQL> create temporary tablespace temp tempfile SIZE 100M extent management local uniform size 1M;
Tablespace created.

SQL> alter database default temporary tablespace temp;
Database altered.

SQL> drop tablespace temp1 including contents;
Tablespace dropped.

SQL> select name from v$tempfile;
NAME
-----------------------------------------------
+DATA/db10g/tempfile/temp.264.596370217

8. Migrate and drop the old Online Redo Logs to ASM:
Drop and recreate the redo groups into ASM to migrate them to ASM Diskgroup.

SQL> select member from v$logfile;
MEMBER
---------------------------------------------------
+FLASH/db10g/onlinelog/group_3.259.596373619
+FLASH/db10g/onlinelog/group_2.258.596373615
+FLASH/db10g/onlinelog/group_1.261.596373613
+FLASH/db10g/onlinelog/group_4.257.596373293
+FLASH/db10g/onlinelog/group_5.260.596373609

9. DELETE THE OLD DATAFILES USING RMAN.
This way, it will also clear out the datafiles entry from controlfile.

[oracle@node1-pub oracle]$ $ORACLE_HOME/bin/rman
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jul 21 11:22:33 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.

RMAN> connect target
connected to target database: DB10G (DBID=4283639931)
RMAN> run {
2> DELETE COPY OF DATABASE;
3> }

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=134 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=151 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=153 devtype=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: sid=138 devtype=DISK

List of Datafile Copies
Key File S Completion Time Ckp SCN Ckp Time Name
------- ---- - --------------- ---------- --------------- ----
6 1 A 21-JUL-06 461254 21-JUL-06 /home/oracle/oradata/db10g/system01.dbf
7 2 A 21-JUL-06 461254 21-JUL-06 /home/oracle/oradata/db10g/undotbs01.dbf
8 3 A 21-JUL-06 461254 21-JUL-06 /home/oracle/oradata/db10g/sysaux01.dbf
9 4 A 21-JUL-06 461254 21-JUL-06 /home/oracle/oradata/db10g/users01.dbf

Do you really want to delete the above objects (enter YES or NO)? YES
deleted datafile copy
datafile copy filename=/home/oracle/oradata/db10g/system01.dbf recid=6 stamp=596369439
deleted datafile copy
datafile copy filename=/home/oracle/oradata/db10g/undotbs01.dbf recid=7 stamp=596369439
deleted datafile copy
datafile copy filename=/home/oracle/oradata/db10g/sysaux01.dbf recid=8 stamp=596369440
deleted datafile copy
datafile copy filename=/home/oracle/oradata/db10g/users01.dbf recid=9 stamp=596369440
Deleted 4 objects

RMAN> exit

10. REMOVE THE OLD ONLINE REDO LOGS FILES PHYSICALLY:

[oracle@node1-pub oracle]$ rm /home/oracle/oradata/db10g/redo*.log

11. Enable the block change tracking:

SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s