Monday, February 22, 2010

Migration(Convertion) of Database from non-ASM to ASM (Part - 01)

Dear friends
I am posting the process of migration(conversion) of Oracle non-ASM database to ASM environment.The OS platform is Windows using Oracle Utility Recovery Manager (RMAN) for testing purpose. Before conversion I would like to describe few steps that deal with ASM Instance Creation, then we will go for Conversion!

ASM DISK CREATION IN WINDOWS USING ASMTOOL UTILITY…

Before converting database from non-ASM to ASM, we need to create few ASM disks to allocate them to ASM Instance and then later these ASM disks will be used for Database storage. You can create a mimicked ASM files in windows using this ASMTOOL utility.

Create a directory called ‘asmdir’ and In ‘asmdir’ directory create ASM disks using ‘ASMTOOL’. The below command creates an ASM disk of size 512MB

D:\asmdir>asmtool -create disk01 512
D:\asmdir>dir

Volume in drive D has no label.
Volume Serial Number is D80A-F55D
Directory of D:\asmdir
02/18/2010 11:00 AM
.
02/18/2010 11:00 AM
..
02/18/2010 11:02 AM 536,870,912 disk01
1 File(s) 536,870,912 bytes
2 Dir(s) 15,103,508,480 bytes free

Also we can create multiple ASM disks at once!

D:\asmdir>asmtool -create disk02 512 disk03 512 disk04 512
D:\asmdir>dir

Volume in drive D has no label.
Volume Serial Number is D80A-F55D
Directory of D:\asmdir
02/18/2010 11:07 AM
.
02/18/2010 11:07 AM
..
02/18/2010 11:02 AM 536,870,912 disk01
02/18/2010 11:06 AM 536,870,912 disk02
02/18/2010 11:07 AM 536,870,912 disk03
02/18/2010 11:09 AM 536,870,912 disk04

4 File(s) 2,147,483,648 bytes
2 Dir(s) 13,492,891,648 bytes free

ASM Instance Creation using DBCA:
We can create ASM Instance in Two ways , using Oracle tool DBCA (Database Configuration Assistant) or using manual method. For ease I have chosen DBCA.
The steps are as follow!

1.Run autoconfig: To create OCR key and CSS Service:
C:\oracle\product\10.2.0\db_1\BIN>localconfig add

Step 1: creating new OCR repository
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'quest', privgrp ''..
Operation successful.
Step 2: creating new CSS service
successfully created local CSS service
successfully added CSS to home

After OCR Repository and CSS service creation, call Oracle DBCA tool to create ASM Instance.
2. Creating ASM Instance using DBCA tool:

You can call DBCA tool from command prompt also like C:\>dbca




Click NEXT , to go further, there will be three major steps to complete the ASM instance Creation
In below shown option, choose Configure Automatic Storage Management




Here you will get a new window to create ASM Instance, where you have to set ASM related parameters and other settings .



Choose ASM Parameters option.



Select Show Advanced Parameters option here you have to check all the ASM Instance Parameters and set them accordingly similarly shown below…



Here you have to set ASM DISKGROUPS, ASM_DISKSTRING ,ASM_POWER_LIMIT,INSTANCE_TYPE, and other similar parameters as in normal Database Instance. You can check the description of each and every parameter and its usage by clicking on SHOW DESCRIPTION,




Like the parameter ASM_DISKSTRING description is something like below and you have to mention the Disks which are created using ASMTOOL include their complete path.. Observe the Description given above about ASM_DISKSTRING parameter .

The ASM Instance should have its own SYS user to manage remotely. So give a different password for ASM Instance SYS user



Click NEXT to go further.. Where DBCA comes to action for ASM instance creation and make it up , then you can use these ASM disk groups for Your Database storage.



Click OK to start the action, Below you can see the window of ASM creation.



Now, Your ASM Instance is created with the specified ASM DISKS, now assign these ASM disks to one or more ASM DISK GROUPS



Here you have to create new ASM Disk Groups , click on Create New, option to create a new ASM Disk Group and Assign the Disks which are created and mentioned in previous steps..



Here mention the name of the Disk Group (eg: DATA) , You need to set the Redundancy type , there are three types of Redundancies , HIGH,NORMAL and EXTERNAL, Though there is a lot to explain about Redundancy I would like to give you some brief information about them which is something important to know..

REDUNDANCY Clause:
The REDUNDANCY clause lets you specify the redundancy level of the disk group.
NORMAL REDUNDANCY requires the existence of at least two failure groups . Automatic Storage Management provides redundancy for all files in the disk group according to the attributes specified in the disk group templates.
HIGH REDUNDANCY requires the existence of at least three failure groups. Automatic Storage Management fixes mirroring at 3-way mirroring, with each extent getting two mirrored copies. HIGH REDUNDANCY disk groups can tolerate the loss of two failure groups.
EXTERNAL REDUNDANCY indicates that Automatic Storage Management does not provide any redundancy for the disk group. The disks within the disk group must provide redundancy (for example, using a storage array), or you must be willing to tolerate loss of the disk group if a disk fails (for example, in a test environment). You cannot specify the FAILGROUP clause if you specify EXTERNAL REDUNDANCY.


Now, SELECTING DISK MEMEBERS , Which may belong to the below four status, those are
Former - Disk was formerly part of disk group.
Candidate - Available to be added to a disk group.
Member - Indicate part of a disk group.
Provisioned - Similar to candidate, made available using ASMLIB.


So , choose SHOW CANDIDATES, to select the available addable ASM disks,

Wait, Wait, something went wrong , though we select Show Candidate option We are unable to see the ASM DISKS, So there is something has to be done more , that is , Actually there is a hidden Parameter called _ASM_ALLOW_ONLY_RAW_DISKS , Which value has to be set to FALSE to cope up our mimicked so called ASM DISKS. Now cancel only CREATE DISK GROUP window, we shall reopen it after the below settings.

So connect to the ASM Instance from command prompt like below

C:\Documents and Settings\Quest>SET ORACLE_SID=+ASM
C:\Documents and Settings\Quest>SQLPLUS / AS SYSDBA

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Feb 18 12:24:50 2010
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> ALTER SYSTEM SET "_ASM_ALLOW_ONLY_RAW_DISKS"=FALSE SCOPE=SPFILE;
System altered.

Now restart the ASM Instance to above changed parameter come into action,
SQL> SHUTDOWN IMMEDIATE
ORA-15100: invalid or missing diskgroup name
ASM instance shutdown
SQL> STARTUP
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1247420 bytes
Variable Size 57472836 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted

Ignore the above error because we have not attached the ASM DISKS yes and not mounted.
Now choose CREATE NEW option again and You can see the CANDIDATE ASM DISKS .



Here You can choose the number of CANDIDATE disks to attach them to the Disk Group(Eg: DATA)



Here I have choosen all available CANDIDATE ASM DISKS and Redundency EXTERNAL is taken.
Now click OK




Now , DISK GROUP CREATION will be processed,



Yes ! a new DISK GROUP called DATA is created and mounted successfully, So this Disk Group can be now used for our DATABASE. Though there is a lot to explain about the ASM options, due to the fear that this might lead us to deviation from the actual concept I am forcibly reverting to our topic.

Click FINISH to wash your hands now.



Click YES to farewell the DBCA tool.

Now you are successfully created the ASM Instance using DBCA and Mounted the DISK GROUPS, You can check them below using command prompt.
C:\Documents and Settings\Quest>net start oracleasmservice+asm
The OracleASMService+ASM service is starting.....
The OracleASMService+ASM service was started successfully.
C:\Documents and Settings\Quest>set oracle_sid=+asm
C:\Documents and Settings\Quest>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Feb 18 12:51:33 2010
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>
( Here all the DISK GROUPS are mounted so we are not getting the error that blinked last time.)

Check some important parameters here,
SQL> show parameter asm
NAME TYPE VALUE
------------------------------------ ---------- ------------------------------
_asm_allow_only_raw_disks boolean FALSE
asm_diskgroups string DATA
asm_diskstring string D:\ASMDIR\DIS*
asm_power_limit integer 1

Yes, it’s the time to move on to our actual concept, Migration of DATABASE from FILE SYSTEM to ASM environment using RMAN…. (End of part :1)

3 comments:

  1. assamalaikum bhai,
    how r u, i red your topic. its very interesting, by posting this type of topics we are able to learn real time scenarios. i request you to post as many as topics if possible.

    remember me in your dua's

    ReplyDelete
  2. Great post... Keep up the great work...

    ReplyDelete
  3. Hi syed,
    very good evening.....Hope you are rocking at your end.
    Now,thank you very much to you. your blogs has assisted me for my important job.........once again thank you dude .....

    ReplyDelete

Oracle RAC node unavailable with error: Server unexpectedly closed network connection6]clsc_connect: (0x251c670) no listener at (ADDRESS=(PROTOCOL=ipc)(KEY=OCSSD_LL_node2_))

 Early midnight I received a call from the monitoring team that one of the critical production database node is not available. As I am aware...