Thursday, March 6, 2014

ASMCA

ASMCA stands for – Automatic Storage Management Configuration Assistant.

In Oracle 11gR2, ASMCA is used to create and configure ASM instance

Prior to 11gR2, DBCA is used to create and configure ASM instance.

As typical with all of oracle’s wizard, CA(configuration assistance is a Wizard), so has provided below wizards for different activities

ASMCA - Automatic Storage Management Configuration Assistant

DBCA – Database Configuration Assistant

NetCA – Network Configuration Assistant

EMCA – Enterprise Manager Configuration Assistant

 

- In RAC environment, for installing and configuring Grid Infrastructure(GI) Architecture we ASMCA is used.

- Installing and configuring Grid Infrastructure does a variety of things like

-It installs the GI software

-Installs the cluster software

-Creates ASM Instance

-Creates a default disk group to contain RAC specific disks (eg: Voting Disk & OCR Disks)

- After Installing the GI software, we will install DB software(just the software, without creating the DB)

- So before creating the DB (using DBCA), we usually use ASMCA to create the ASM disk groups to be used by Database.

- After the disk groups are created using ASM disk groups, Database is created using DBCA and point the disk groups created by ASMCA

To launch the asmca, one should be in ASM instance as below.

[oracle@rac1 ~]$ asmca
bash: asmca: command not found
[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? MyDB
The Oracle base has been set to /u01/app/oracle
[oracle@rac1 ~]$ asmca
bash: asmca: command not found

[oracle@rac1 ~]$ ps -ef | grep smon
oracle    2954     1  0 Mar03 ?        00:00:13 asm_smon_+ASM1
root      2993     1  2 Mar03 ?        02:01:42 /u01/app/12.1.0/grid/bin/osysmond.bin
oracle    3371     1  0 Mar03 ?        00:00:09 mdb_smon_-MGMTDB
oracle    3755     1  0 Mar03 ?        00:00:20 ora_smon_MyDB1
oracle    4007  3486  0 08:35 pts/1    00:00:00 grep smon
[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? +ASM1
The Oracle base has been set to /u01/app/oracle
[oracle@rac1 ~]$ asmca

image

image

To create a new disk group click on the Create button, in my current environment, there are no disks to add to the DiskGroups

 

image

High Redundancy – Should have at least 3 disks in diskgroups

Normal Redundancy – Should have at least 2 disks in diskgroups

External Redundacy – Should have at least 1 disk in the diskgroup

 

 

[oracle@rac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg  <====================   Data DiskGroup(dg) which was listed in asmca
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.asm
               ONLINE  ONLINE       rac1                     Started,STABLE
               ONLINE  ONLINE       rac2                     Started,STABLE
ora.net1.network
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.ons
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac2                     STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       rac1                     STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       rac1                     STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       rac1                     169.254.90.64 192.16
                                                             8.10.1,STABLE
ora.cvu
      1        ONLINE  ONLINE       rac1                     STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       rac1                     Open,STABLE
ora.mydb.db
      1        ONLINE  ONLINE       rac1                     Open,STABLE
      2        ONLINE  ONLINE       rac2                     Open,STABLE
ora.oc4j
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                     STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       rac2                     STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       rac1                     STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       rac1                     STABLE
--------------------------------------------------------------------------------

Sunday, March 2, 2014

Unix Shell Scripting–Expr

- The Bourne shell has no notion of a number (only strings), and as such incapable of doing numerical calculations

- However, there is a UNIX program called “expr” which was designed specifically for this purpose.

- It works like this:

[oracle@rac1 ~]$ expr 3 + 5
8
Note: There should be space before and after numerical operator (+, –, *, / etc)

Multiplication can be done using *, but * is also used for wildcard by Unix, so multiplications one should escape using backslash like below

[oracle@rac1 ~]$ expr 3 * 4
expr: syntax error
[oracle@rac1 ~]$ expr 3 \* 4
12

- To assign the output of an expr to a other variable, the expression need to placed in the backquotes (as expr is a Unix command and we are working with $ and variables)

oracle@rac1 ~]$ a=15
[oracle@rac1 ~]$ b=3
[oracle@rac1 ~]$ c=expr $a / $b
bash: 15: command not found  <===  without back quotes Unix considers the literal value of $a (which is 15) and throws the error saying 15 is not a command in bash.
[oracle@rac1 ~]$ c=`expr $a / $b`
[oracle@rac1 ~]$ echo $c
5

- Example of using expr in loops:

echo -n "Enter the counter to loop: "
read count

i=1

while [ $i -le $count ]
do
echo "This is loop number $i"
i=`expr $i + 1`
done

Enter the counter to loop: 5
This is loop number 1
This is loop number 2
This is loop number 3
This is loop number 4
This is loop number 5