Tuesday, May 10, 2011

Virtual IP in Oracle CRS

To check the value of IP/interface on RAC node.

$ srvctl config nodeapps -n {hostname} -a

Ex :
$ srvctl config nodeapps -n hostname -a
VIP exists.: /vipalias/10.0.125.12/255.255.255.224/lan900:lan901
IP=10.0.125.12
Subnet=255.255.255.224
Interface name=lan900:lan901


To change Network interface of VIP in CRS

Shutdown RAC DB and CRS nodeapps before executing following.

$ srvctl modify nodeapps -n hostname -A 10.0.125.12/255.255.255.224/lan900

Stop/Start Oracle RAC databases.

To Shutdown oracle RAC databases.
Execute following on Primary or node1

$ srvctl stop database -d {database name}

To Shutdown ASM

Execute following on each node.

$  srvctl stop asm -n {Hostname}

Execute following on node1/Primary to stop node apps.

$ srvctl stop nodeapps -n host1

Finally Stop CRS on each RAC node.

switch user to root and execute following
set environment of CRS_HOME and cd to $CRS_HOME/bin

# ./crsctl stop crs


To check crs

# ./crsctl check crs


__________________________________________________________________


Start CRS on each RAC node. (CRS auto starts as part of init script if it does not start then use following command)

Make sure CRS is up on all nodes before starting node apps,ASM,Database.

To check crs

# ./crsctl check crs


switch user to root and execute following
set environment of CRS_HOME and cd to $CRS_HOME/bin

# ./crsctl start crs


Execute following on node1/Primary to start node apps.

$ srvctl start nodeapps -n host1



To start ASM

Execute following on each node.

srvctl start asm -n {Hostname}


To start oracle RAC databases.
Execute following on Primary or node1

srvctl start database -d {database name}


Monday, May 9, 2011

Oracle CRS commands

To get the status of all nodeapps.

$ ./crs_stat -v -t

To see public and private interfaces.

$  oifcfg getif

HP-Unix network commands

To get IP and interface names.

#netstat -inw

# lanscan -i |awk '{print $1}'

Tuesday, May 3, 2011

ASM Disk Space

To Check free space diskgroup wise.

set lines 255
col path for a35
col Diskgroup for a15
col DiskName for a20
col disk# for 999
col total_mb for 999,999,999
col free_mb for 999,999,999
compute sum of total_mb on DiskGroup
compute sum of free_mb on DiskGroup
break on DiskGroup skip 1 on report -  
set pages 255
select a.name DiskGroup, b.disk_number Disk#, b.name DiskName, b.total_mb, b.free_mb, b.path, b.header_status from v$asm_disk b, v$asm_diskgroup a where a.group_number (+) =b.group_number order by b.group_number, b.disk_number, b.name
/

To Check disk group status.

SELECT STATE, NAME FROM V$ASM_DISKGROUP;

To mount/dismount diskgroup

ALTER DISKGROUP TEST123 MOUNT;

ALTER DISKGROUP TEST123 DISMOUNT;
Where TEST is diskgroup name

to Drop disk group

DROP DISKGROUP TEST123; --(from the ASM instance, on which diskgroup is still mounted make sure its unmounted on all other nodes).

To add disk to already exixting disk group.

Once disk is presented to nodes check access privileges to oracle or the user who is owner of ASM installation on all nodes this is very important.

If ASM lib is installed(Typically on Linux OS)

$ /etc/init.d/oracleasm  scandisks
$ /etc/init.d/oracleasm  listdisks
$ /etc/init.d/oracleasm  querydisk <each disk from previous output>


Check diskgroup to which you want to add disk

SELECT STATE, NAME FROM V$ASM_DISKGROUP;

Add disk to existing diskgroup as follows

ALTER DISKGROUP <my diskgroup> ADD DISK '<your candidate disk>';

Check if rebalance is complete.

select * from v$asm_operation;

if no rows returned then rebalance complete.