You are on page 1of 7

Index

1.

Introduction ..................................................................................................................................................................2

2.

ASM Command library ................................................................................................................................................2

2.1.

ASM - Adding disk(s) to a diskgroup. ........................................................................................................................................... 2

2.2.

ASM - Vary disk(s) offline in a diskgroup ..................................................................................................................................... 2

2.3.

ASM - Dropping disk(s) from a diskgroup .................................................................................................................................... 2

2.4.

ASM - Rebalance disks after adding or dropping disk(s) ........................................................................................................... 2

2.5.

ASM - Mount all diskgroups ........................................................................................................................................................... 2

2.6.

ASM - Views ..................................................................................................................................................................................... 3

2.7.

ASM - debugging ASMCMD ........................................................................................................................................................... 3

3.

CRS Command library .................................................................................................................................................4

3.1.

CRS - Set debugging for SRVCTL commands in UNIX ............................................................................................................... 4

3.2.

CRS - NodeApps commands ......................................................................................................................................................... 4

3.3.

CRS - Re-assign Ip address on ethernet card .............................................................................................................................. 4

3.4.

CRS - Register / Unregister commands (DB - listener - Instance - ASM) .................................................................................. 4

3.5.

CRS - Start / Stop CRS Daemons - will also stop all dependent processes.............................................................................. 4

3.6.

CRS - Start / Stop registered listeners .......................................................................................................................................... 4

3.7.

CRS - Start / Stop ASM Instance.................................................................................................................................................... 5

3.8.

CRS - Start / Stop Database instance ............................................................................................................................................ 5

3.9.

CRS - Start / Stop Database ........................................................................................................................................................... 5

3.10.

CRS - check status of voting disks ............................................................................................................................................... 5

3.11.

CRS - SET, LIST and UNSET environment variables. .................................................................................................................. 5

4.

OCR Command library ................................................................................................................................................5

4.1.

OCR - show backups ...................................................................................................................................................................... 5

4.2.

OCR - Create manual backup......................................................................................................................................................... 5

4.3.

OCR - Dump contents of OCR disk to readable file ..................................................................................................................... 6

5.

Solutions - Solving listener with UNKNOWN status .................................................................................................6

RAC Commands_v1.1

Page 1 of 7

1.

Introduction

2.

ASM Command library

2.1.

ASM - Adding disk(s) to a diskgroup.


Add a disk to an ASM diskgroup (Single disk or multiple disks).
In DLL case reduncancy is managed at EMC level so we dont need to specify a failgroup
SQL> ALTER DISKGROUP DiskGroupName ADD DISK '/dev/DiskName' NAME LogicalDiskNameForASM ;
sql> ALTER DISKGROUP DiskGroupName ADD DISK
'/dev/DiskName1' NAME LogicalDiskNameForASM1 ,
'/dev/DiskName2' NAME LogicalDiskNameForASM2 ;
You can also add a disk without specifying a name, now the system generated name will be used.
SQL> ALTER DISKGROUP DiskGroupName ADD DISK '/dev/DiskName' ;

2.2.

ASM - Vary disk(s) offline in a diskgroup


vary disk(s) offline in a diskgroup.
SQL> ALTER DISKGROUP DiskGroupName OFFLINE DISK LogicalDiskNameForASM ;

2.3.

ASM - Dropping disk(s) from a diskgroup


Caution: The ALTER DISKGROUP...DROP DISK statement returns before the drop and rebalance
operations are complete. Do not reuse, remove, or disconnect the dropped disk until the
HEADER_STATUS column for this disk in the V$ASM_DISK view changes to FORMER. You can query the
V$ASM_OPERATION view to determine the amount of time remaining for the drop/rebalance operation
to complete. For more information
When dropping a member with asm_power_limit set to 0, you must rebalance manually to be able to
drop the disk. If you first set the asm_power_limit to a value higher than 0 before issueing the
alter diskgroup drop disk command the operation will complete automatically.
Dont forget to set asm_power_limit back to 0 after the disk is dropped.
Drop a disk from a diskgroup (single disk or multiple disks)
SQL> ALTER DISKGROUP DiskGroupName DROP DISK LogicalDiskNameForASM ;
SQL> ALTER DISKGROUP DiskGroupName DROP DISK LogicalDiskNameForASM1, LogicalDiskNameForASM2 ;

2.4.

ASM - Rebalance disks after adding or dropping disk(s)


You need to rebalance the data to all the disks within a disk group.
First login to the ASM instance as sysdba, next
SQL> alter system set asm_power_limit=10;
SQL> Alter diskgroup DiskGroupName rebalance power 10 ;
You can check rebalancing progress using following command from another session.
SQL> select * from v$asm_operation;
When the rebalance is done:
SQL> alter system set asm_power_limit=0;

2.5.

ASM - Mount all diskgroups


Mount all diskgroups in the ASM instance
SQL> ALTER DISKGROUP ALL MOUNT ;

RAC Commands_v1.1

Page 2 of 7

2.6.

ASM - Views
ASM Dynamic Views: ASM Instance Information
V$ASM_ALIAS
V$ASM_CLIENT
V$ASM_DISK
V$ASM_DISKGROUP

V$ASM_FILE
V$ASM_OPERATION
V$ASM_TEMPLATE

Shows every alias for every disk group mounted by the ASM instance
Shows which database instance(s) are using any ASM disk groups that are being
mounted by this ASM instance
Discovers and lists disks in ASM_DISKSTRING, including disks that are not part
of any ASM disk group
[name, allocation, unit_size, compatibility, database_compatibility-]
Describes information about ASM disk groups mounted by the ASM instance.
Discovers disks in ASM_DISKSTRING
Lists each ASM file in every ASM disk group mounted by the ASM instance
Like its counterpart, V$SESSION_LONGOPS, it shows each long-running ASM
operation in the ASM instance
Lists each template present in every ASM disk group mounted by the ASM instance

Fixed views
X$KFALS
X$KFDSK
X$KFFIL
X$KFGRP
X$KFGMG
X$KFKID
X$KFNCL
X$KFMTA

ASM
ASM
ASM
ASM
ASM
ASM
ASM
ASM

aliases
disks
files
disk groups
operations
disk performance
clients
templates

11g requires compatible.asm=11.1


V$PWFILE_USERS(sysasm)
V$ASM_DISK_IOSTAT
V$ASM_ATTRIBUTE

2.7.

ASM - debugging ASMCMD


Setting DBI_TRACE=1 on unix level will put asmcmd in trace-mode
This will enable debugging for example connectivity issues like ASMCMD-08202: internal error:
$ export DBI_TRACE=1
$ asmcmd [-a sysdba]
DBI 1.50-ithread default trace level set to 0x0/1 (pid 9764996)
-> DBI->connect(dbi:Oracle:, , ****, HASH(0x1108ae980))
-> DBI->install_driver(Oracle) for aix perl=5.008003 pid=9764996 ruid=3501 euid=3501
install_driver: DBD::Oracle version 1.15 loaded from
/rac01/app/asm/product/11.1.0/perl/lib/site_perl/5.8.3/aix-thread-multi-64all/DBD/Oracle.pm
<- STORE('ShowErrorStatement' 1)= 1 at Oracle.pm line 68
<- install_driver= DBI::dr=HASH(0x11023cc60)
<- DESTROY(DBI::st=HASH(110bb9ec0))= undef at Oracle.pm line 298
<- connect('' '' ...)= DBI::db=HASH(0x110bac8a0) at DBI.pm line 617
<- STORE('PrintError' 0)= 1 at DBI.pm line 664
<- STORE('AutoCommit' 1)= 1 at DBI.pm line 664
<- STORE('Username' '')= 1 at DBI.pm line 667
<> FETCH('Username')= '' ('Username' from cache) at DBI.pm line 667
$h->{'ora_session_mode'}=2 ignored for invalid driver-specific attribute
<- STORE('ora_session_mode' 2)= '' at DBI.pm line 667
<- FETCH('ora_session_mode')= undef at DBI.pm line 667
<- connect= DBI::db=HASH(0x110bac8a0)
<- STORE('dbi_connect_closure' CODE(0x110bac990))= 1 at DBI.pm line 683
<- prepare('select value from v$parameter where name='instance_type'')=
DBI::st=HASH(0x110bba190) at asmcmdshare.pm line 2274
<- execute= '0E0' at asmcmdshare.pm line 2298
<- fetchrow_hashref= HASH(0x110d1fb60)1keys row1 at asmcmdshare.pm line 2324
<- finish= 1 at asmcmdshare.pm line 2345
<- DESTROY(DBI::st=HASH(110bb9fb0))= undef at asmcmdbase.pm line 4125
<- prepare('select version from v$instance')= DBI::st=HASH(0x110bba230) at asmcmdshare.pm
line 2274
<- execute= '0E0' at asmcmdshare.pm line 2298
<- fetchrow_hashref= HASH(0x110d1fb90)1keys row1 at asmcmdshare.pm line 2324
<- finish= 1 at asmcmdshare.pm line 2345
<- DESTROY(DBI::st=HASH(1100524c0))= undef at asmcmdcore line 322
ASMCMD>

RAC Commands_v1.1

Page 3 of 7

3.

CRS Command library

3.1.

CRS - Set debugging for SRVCTL commands in UNIX


Set debugging for SRVCTL commands in UNIX
$ export SRVM_TRACE=TRUE

3.2.

CRS - NodeApps commands


Relocate NodeApps: run as oracrs1
$ crs_relocate ora.<node>.vip -c <node>
Relocate VIP
$ srvctl stop nodeapps -n <node> -r
Start / Stop NodeApps: run as oracrs1
$ srvctl <start/stop> nodeapps -n <node>

3.3.

CRS - Re-assign Ip address on ethernet card


(run as oracrs1)
$ srvctl modify nodeapps -n <node> -A <IP>/<MASK>/<INTERFACE> (i.e. en2)

3.4.

CRS - Register / Unregister commands (DB - listener - Instance - ASM)


Register listener: done per node
$ srvctl add listener -n <node> -o $ORACLE_HOME -l LISTENER_<node>
Unregister listener: done per node
$ srvctl remove listener -n <node> -l LISTENER_<node>
Register ASM instance: done per node
$ srvctl add asm -n <node> -i +ASM<1/2> -o ${ORACLE_HOME}
Unregister ASM instance: done per node
$ srvctl remove asm -n <node> -i +ASM<1/2>
Register database
$ srvctl add database -d <Database> -o ${ORACLE_HOME}
Unregister database (after unregistering all instances)
$ srvctl remove database -d <Database>
Register database instance
$ srvctl add instance -d <Database> -i <instance<1/2>> -n <Node>
Unregister database instance
$ srvctl remove instance -d <Database> -i <instance<1/2>>

3.5.

CRS - Start / Stop CRS Daemons - will also stop all dependent processes.
Start CRS deamons: run as root
# /rac01/app/crs/product/11.1.0/bin/crsctl start crs
Stop CRS deamons: run as root
# /rac01/app/crs/product/11.1.0/bin/crsctl stop crs

3.6.

CRS - Start / Stop registered listeners


Start registered listener
$ srvctl start listener -n <node> -l LISTENER_<node>
Stop registered listener
$ srvctl stop listener -n <node> -l LISTENER_<node>

RAC Commands_v1.1

Page 4 of 7

3.7.

CRS - Start / Stop ASM Instance


Start ASM instance
$ srvctl start ASM -i +ASM<1/2> -n <node>
Stop ASM instance
$ srvctl stop ASM -i +ASM<1/2> -n <node>

3.8.

CRS - Start / Stop Database instance


Start database instance
$ srvctl start instance -d <database> -i "<instance>,<instance>"
Stop database instance
$ srvctl stop instance -d <database> -i "<instance>,<instance>"

3.9.

CRS - Start / Stop Database


Start database
$ srvctl stop database -d <database>
Stop database
$ srvctl stop database -d <database>

3.10.

CRS - check status of voting disks


Show the status of the voting-disk(s)
$ $ORACLE_CRS_HOME/crsctl query css votedisk

3.11.

CRS - SET, LIST and UNSET environment variables.


SET environment variable in CRS for TNS_ADMIN for an instance
$ srvctl setenv instance -d <database> -i <instance>
-t "<NAME>=<value>, <NAME2>=<value2>, . . ."
LIST environment variable in CRS for an instance
$ srvctl getenv -d <database> -i <instance>
Example
$ srvctl getenv instance -d OLMSND2 -i OLMSND22
TNS_ADMIN=/snd2001/app/orasnd2/product/11.1.0/network/admin/OLMSND21_phls6843
UNSET environment variable in CRS for an instance
$ srvctl unsetenv -d <database> -i <instance> -t <NAME>, <NAME>, . . .
Example
$ srvctl unsetenv instance -d OLMSND2 -i OLMSND22 -t "TNS_ADMIN"
Environment variables can be set for Database, Instance, Service and NodeApps.

4.

OCR Command library

4.1.

OCR - show backups


Show backups done for OCR disk
$ $ORACLE_CRS_HOME/bin/ocrconfig -showbackup

4.2.

OCR - Create manual backup


Create manual backup of OCR disk
$ $ORACLE_CRS_HOME/bin/ocrconfig -manualbackup

RAC Commands_v1.1

Page 5 of 7

4.3.

OCR - Dump contents of OCR disk to readable file


ocrdump [file_name|-stdout] [-backupfile backup_file_name] [-keyname keyname] [-xml] [-noheader]
By default, output from the OCRDUMP utility is written to the predefined output file named
OCRDUMPFILE. The file_name option redirects OCRDUMP output to the file that you specify.
file_name
The name of a file to which you want OCRDUMP to write output.
-stdout
Use this option to redirect the OCRDUMP output to the text terminal that initiated the program.
-keyname
The name of an OCR key whose subtree is to be dumped.
-xml
Writes the output in XML format.
-noheader
Does not print the time at which you ran the command and when the OCR configuration occurred.
-backupfile backup_file_name
Option to identify a backup file.
The name of the backup file with the content you want to view. You can query the backups using
the ocrconfig -showbackup command.

5.

Solutions - Solving listener with UNKNOWN status


Sometimes a resource can get into an UNKNOWN status while checking with the crsstat command.
Below you can find steps to stop and eventually remove the resource from clusterware.
In our case the entries in the listener.ora were gone for the registered listener in clusterware.
 First add listener info into the listener.ora on the node where the listener is supposed
to run (LISTENER_PHLD6844 in listener.ora on phls6844 in our case).
LISTENER_phls6844 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = racsnd22-vip.dll.corp)(PORT = 1572)(IP = FIRST)))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = phls6844)(PORT = 1572)(IP = FIRST)))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROCOLMSND22)))
)
)
SID_LIST_LISTENER_phls6844 =
(SID_LIST =
(SID_DESC = (ORACLE_HOME = /snd2001/app/orasnd2/product/11.1.0)(SID_NAME = OLMSND22))
(SID_DESC = (SID_NAME = PLSExtProc)(ORACLE_HOME =
/snd2001/app/orasnd2/product/11.1.0)(PROGRAM = extproc))
)
 Next make sure the listeners is NOT running anymore by stopping it through lsnrctl
$ lsnrctl stop LISTENER_PHLS6844
 Next check status and manually stop the resource using the force option.

RAC Commands_v1.1

Page 6 of 7

$ crsstat
HA Resource
----------ora.RTSTDB0.RTSTDB01.inst
ora.RTSTDB0.RTSTDB02.inst
ora.RTSTDB0.db
ora.phls6843.ASM1.asm
ora.phls6843.LISTENER_PHLS6843_+ASM1.lsnr
ora.phls6843.gsd
ora.phls6843.ons
ora.phls6843.vip
ora.phls6844.ASM2.asm
ora.phls6844.LISTENER_PHLS6844.lsnr
ora.phls6844.LISTENER_PHLS6844_+ASM2.lsnr
ora.phls6844.gsd
ora.phls6844.ons
ora.phls6844.vip

Target
-----OFFLINE
OFFLINE
OFFLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE

State
----OFFLINE
OFFLINE
OFFLINE
ONLINE on phls6843
ONLINE on phls6843
ONLINE on phls6843
ONLINE on phls6843
ONLINE on phls6843
ONLINE on phls6844
UNKNOWN on phls6844
ONLINE on phls6844
ONLINE on phls6844
ONLINE on phls6844
ONLINE on phls6844

$ crs_stop -f ora.phls6844.LISTENER_PHLS6844.lsnr
Attempting to stop `ora.phls6844.LISTENER_PHLS6844.lsnr` on member `phls6844`
Stop of `ora.phls6844.LISTENER_PHLS6844.lsnr` on member `phls6844` succeeded.
$ crsstat
HA Resource
----------ora.RTSTDB0.RTSTDB01.inst
ora.RTSTDB0.RTSTDB02.inst
ora.RTSTDB0.db
ora.phls6843.ASM1.asm
ora.phls6843.LISTENER_PHLS6843_+ASM1.lsnr
ora.phls6843.gsd
ora.phls6843.ons
ora.phls6843.vip
ora.phls6844.ASM2.asm
ora.phls6844.LISTENER_PHLS6844.lsnr
ora.phls6844.LISTENER_PHLS6844_+ASM2.lsnr
ora.phls6844.gsd
ora.phls6844.ons
ora.phls6844.vip

Target
-----OFFLINE
OFFLINE
OFFLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
OFFLINE
ONLINE
ONLINE
ONLINE
ONLINE

State
----OFFLINE
OFFLINE
OFFLINE
ONLINE on
ONLINE on
ONLINE on
ONLINE on
ONLINE on
ONLINE on
OFFLINE
ONLINE on
ONLINE on
ONLINE on
ONLINE on

phls6843
phls6843
phls6843
phls6843
phls6843
phls6844
phls6844
phls6844
phls6844
phls6844

 If needed, you can now continue to remove the resource from clusterware.

RAC Commands_v1.1

Page 7 of 7

You might also like