Search This Blog

Total Pageviews

Tuesday, 27 March 2012

Oracle Tablespace Monitoring Script

Oracle Tablespace Monitoring

from this Blog

http://blog.csdn.net/flighting/article/details/1119253




Oracle Tablespace Monitoring Script
Oracle Tablespace Monitoring


from this Blog
http://blog.csdn.net/flighting/article/details/1119253

 


 




-- List tablespaces
- space allocated
- space used
- %free (without maxbytes)
- Autoextend Y|N|Y/N
- Sum of maxbytes
- increment (in Mb) 10/100 or 0/10/.... if more than 2 datafiles with different increment size
- Largest free extent
- Space management (DICT MAN -> Dictionnary Manual| ASSM | LMTS)
- Number of files
- T: tempfile | D: datafile
- %Used (using maxbytes in calcul)



set linesize 145
set pagesize 60
set trimout on
set trimspool on
Set Feedback off
set timing off
set verify off


prompt

prompt -- ----------------------------------------------------------------------- ---

prompt -- Tablespaces ---

prompt -- ----------------------------------------------------------------------- ---

prompt


Set Heading Off
Set Termout Off

create or replace function show_autoext_tbs(P_Tablespace_Name In Varchar2) return varchar2
Is
--
Cursor CX Is
Select distinct Substr(autoextensible,1,1)
from dba_data_files
where tablespace_name=P_Tablespace_Name
Union
Select distinct Substr(autoextensible,1,1)
from dba_temp_files
where tablespace_name=P_Tablespace_Name
;
--
W_Texte Varchar2(20);
W_Temp Varchar2(20);
--
Begin
--
W_Texte := Null;
--
Open CX;
Loop
Fetch CX Into W_Temp;
Exit When CX%notfound;
W_Texte := W_Texte|| ' ' || W_Temp;
End Loop;
Close CX;
--
W_Texte := Replace(Substr(W_Texte, 2, 4), ' ', '/');
--
Return W_Texte;
--
End;
/

-- show error



Column Var_DB_BLOCK_SIZE new_value Var_DB_BLOCK_SIZE noprint

Select value Var_DB_BLOCK_SIZE
from v$parameter
where Upper(name) = Upper ('db_block_size')
;

Set Termout On
Set Heading On


create or replace function show_increment_tbs(P_Tablespace_Name In Varchar2, P_Db_Block_Size In Number) return varchar2
Is
--
Cursor CX Is
Select distinct To_Char(round(((Increment_By * P_Db_Block_Size)/1024/1024),1) )
from dba_data_files
where tablespace_name=P_Tablespace_Name
Union
Select distinct To_Char(Round(((Increment_By * P_Db_Block_Size)/1024/1024),1) )
from dba_temp_files
where tablespace_name=P_Tablespace_Name
;
--
W_Texte Varchar2(20);
W_Temp Varchar2(20);
--
Begin
--
W_Texte := Null;
--
Open CX;
Loop
Fetch CX Into W_Temp;
Exit When CX%notfound;
W_Texte := W_Texte|| ' ' || W_Temp;
End Loop;
Close CX;
--
W_Texte := W_Texte||' ';
W_Texte := Replace(W_Texte,' ', '/');
W_Texte := Substr(W_Texte,2, Instr(W_Texte, '/', -1, 1)-2);
If Instr(W_Texte, '/', 1,2) != 0 then
W_Texte := Substr(W_Texte, 1, Instr(W_Texte, '/', 1,2))||'...';
End If;
--
Return W_Texte;
--
End;
/

Set Termout On
Set Heading On
clear breaks
break on contents -
skip 1
compute Sum of alloc used maxbytes nfree nbfrag on contents
column tblsp format a22 wrap heading "Tablespace|Name"
column Alloc format 99999999 heading "Alloc|(Mb)"
column file_name format a45 wrap heading "DataFile Name"
column rfno format 999 heading "R.|Fno"
-- column inc format 9999999 heading "Incr|(Mb)"
column inc format a15 heading "Incr|(Mb)"
column maxbytes format 9999999 heading "Sum Max|(Gb)"
column user_bytes format 999999 heading "Userbytes|(Mb)"
column free format 999999 heading "Free|(Mb)"
column nfree format 99999 heading "Max|Free|(Mb)"
column used format 99999999 heading "Used|(Mb)"
column pused format 990.9 heading "%Used"
column maxpused format 990.9 heading "Max|%Used"
column contents format a5 heading "Cont."
column fragmax format 99999 heading "Larg.|Free|Ext|(Mb)"
column nbfrag format 99999 heading "Nb|frag"
column nbfile format 99 heading "Nb|F."
column autoext format a3 wrap heading "Auto|Ext."
column ftype format a2 wrap heading "F.|T."
column ext_manage format a5 wrap heading "Ext.|M."
column seg_sp_mg format a2 wrap heading "S.|M."
column seg_space_mg format a7 wrap heading "Space|Mg."
set linesize 145
Select
dt.contents contents
, dt.Tablespace_Name tblsp
, df.alloc alloc
, df.alloc - nvl(fs.free,0) used
, ((df.alloc - nvl(fs.free,0))* 100)/df.alloc pused
, dt.autoext autoext
, df.summaxbytes/1024 maxbytes
, dt.Inc inc
-- , nvl(fs.free,0) free
-- , fs.nbfrag
, Nvl(fs.fragmax,0) fragmax
-- , dt.ext_manage
-- , dt.seg_sp_mg seg_sp_mg
, Decode(dt.ext_manage||' '||dt.seg_sp_mg,'LOC MA', ' LMTS', 'LOC AU', ' ASSM',dt.ext_manage||' '||dt.seg_sp_mg) seg_space_mg
, df.nbf nbfile
, df.ftype ftype
-- , decode((df.summaxbytes),0,(df.alloc),(df.summaxbytes))-(df.alloc - nvl(fs.free,0)) nfree
, 100 - ((decode((df.summaxbytes),0,(df.alloc),(df.summaxbytes))-(df.alloc - nvl(fs.free,0))) * 100 / decode((df.summaxbytes),0,(df.alloc),(df.summaxbytes))) maxpused
from
( select
Substr(contents,1,4) contents
, tablespace_name
, Substr(extent_management,1,3) ext_manage
, Substr(segment_space_management,1,2) seg_sp_mg
, show_autoext_tbs(tablespace_name) autoext
, show_increment_tbs (tablespace_name, &Var_DB_BLOCK_SIZE) inc
from dba_tablespaces
) dt
, ( select
Sum(Bytes/1024/1024) alloc
, Max(MaxBytes/1024/1024) maxbytes
, Sum(MaxBytes/1024/1024) summaxbytes
, count(*) nbf
, tablespace_name
, 'D' ftype
from Dba_Data_Files
Group
By tablespace_name
Union
select
Sum(Bytes/1024/1024) alloc
, Max(MaxBytes/1024/1024) maxbytes
, Sum(MaxBytes/1024/1024) summaxbytes
, count(*) nbf
, tablespace_name
, 'T' ftype
from Dba_Temp_Files
Group
By tablespace_name
) df
, (select
Nvl(Sum(nvl(bytes/1024/1024,0)),0) free
, Nvl(max (bytes)/1048576,0) fragmax
, tablespace_name
, count(*) nbfrag
from (Select distinct tablespace_name, bytes from dba_free_space)
Group By tablespace_name
order by max (bytes)/1048576 desc
) fs
Where df.tablespace_name = fs.tablespace_name (+)
and df.tablespace_name = dt.tablespace_name
Group
By dt.contents
, dt.Tablespace_Name
, df.alloc
, df.maxbytes
, df.summaxbytes
, df.nbf
, dt.Inc
-- , nvl(fs.free,0)
, df.alloc - nvl(fs.free,0)
-- , fs.nbfrag
, fs.fragmax
, dt.autoext
, dt.ext_manage
, df.ftype
, dt.seg_sp_mg
Order
By contents
, maxpused desc
, dt.inc
;
Prompt
Set Heading Off
Set Termout Off
Drop function show_autoext_tbs;
Drop function show_increment_tbs;
Set Heading On
Set Termout On


Larg.
Free
Tablespace Alloc Used Aut Sum Max Incr Ext Space Nb F. Max
Cont. Name (Mb) (Mb) %Used Ext (Gb) (Mb) (Mb) Mg. F. T. %Used
----- ---------------------- --------- --------- ------ --- -------- --------------- ------ ------- --- -- ------
PERM SYSTEM 690 684 99.2 Y 32 10 5 LMTS 1 D 2.1
SYSAUX 550 513 93.4 Y 32 10 32 ASSM 1 D 1.6
EXAMPLE 100 79 78.8 Y 32 .6 19 ASSM 1 D 0.2
USERS 5 4 81.3 Y 32 1.3 1 ASSM 1 D 0.0
***** --------- --------- --------
sum 1345 1280 128

TEMP TEMP 29 29 100.0 Y 32 .6 0 LMTS 1 T 0.1

Larg.
Free
Tablespace Alloc Used Aut Sum Max Incr Ext Space Nb F. Max
Cont. Name (Mb) (Mb) %Used Ext (Gb) (Mb) (Mb) Mg. F. T. %Used
----- ---------------------- --------- --------- ------ --- -------- --------------- ------ ------- --- -- ------
***** --------- --------- --------
sum 29 29 32

UNDO UNDOTBS1 95 40 41.8 Y 32 5 40 LMTS 1 D 0.1
***** --------- --------- --------
sum 95 40 32


6 rows selected.

Sunday, 25 March 2012

srvctl command reference

srvctl command reference ... 


Setting Environment Variables Through Srvctl (Doc ID 733567.1)



 srvctl config database  list of database 
$ srvctl -h
srvctl [-V]
srvctl add database -d <db_unique_name> -o <oracle_home> [-m <domain_name>] [-p <spfile>] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}] [-s <start_options>] [-t <stop_options>] [-n <db_name>] [-y {AUTOMATIC | MANUAL}] [-g "<serverpool_list>"] [-x <node_name>] [-a "<diskgroup_list>"]
srvctl config database [-d <db_unique_name> [-a] ]
srvctl start database -d <db_unique_name> [-o <start_options>]
srvctl stop database -d <db_unique_name> [-o <stop_options>] [-f]
srvctl status database -d <db_unique_name> [-f] [-v]
srvctl enable database -d <db_unique_name> [-n <node_name>]
srvctl disable database -d <db_unique_name> [-n <node_name>]
srvctl modify database -d <db_unique_name> [-n <db_name>] [-o <oracle_home>] [-u <oracle_user>] [-m <domain>] [-p <spfile>] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}] [-s <start_options>] [-t <stop_options>] [-y {AUTOMATIC | MANUAL}] [-g "<serverpool_list>" [-x <node_name>]] [-a "<diskgroup_list>"|-z]
srvctl remove database -d <db_unique_name> [-f] [-y]
srvctl getenv database -d <db_unique_name> [-t "<name_list>"]
srvctl setenv database -d <db_unique_name> {-t <name>=<val>[,<name>=<val>,...] | -T <name>=<val>}
srvctl unsetenv database -d <db_unique_name> -t "<name_list>"

srvctl add instance -d <db_unique_name> -i <inst_name> -n <node_name> [-f]
srvctl start instance -d <db_unique_name> {-n <node_name> [-i <inst_name>] | -i <inst_name_list>} [-o <start_options>]
srvctl stop instance -d <db_unique_name> {-n <node_name> | -i <inst_name_list>}  [-o <stop_options>] [-f]
srvctl status instance -d <db_unique_name> {-n <node_name> | -i <inst_name_list>} [-f] [-v]
srvctl enable instance -d <db_unique_name> -i "<inst_name_list>"
srvctl disable instance -d <db_unique_name> -i "<inst_name_list>"
srvctl modify instance -d <db_unique_name> -i <inst_name> { -n <node_name> | -z }
srvctl remove instance -d <db_unique_name> [-i <inst_name>] [-f] [-y]

srvctl add service -d <db_unique_name> -s <service_name> {-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}] | -g <server_pool> [-c {UNIFORM | SINGLETON}] } [-k   <net_num>] [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}] [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z <failover_retries>] [-w <failover_delay>]
srvctl add service -d <db_unique_name> -s <service_name> -u {-r "<new_pref_inst>" | -a "<new_avail_inst>"}
srvctl config service -d <db_unique_name> [-s <service_name>] [-a]
srvctl enable service -d <db_unique_name> -s "<service_name_list>" [-i <inst_name> | -n <node_name>]
srvctl disable service -d <db_unique_name> -s "<service_name_list>" [-i <inst_name> | -n <node_name>]
srvctl status service -d <db_unique_name> [-s "<service_name_list>"] [-f] [-v]
srvctl modify service -d <db_unique_name> -s <service_name> -i <old_inst_name> -t <new_inst_name> [-f]
srvctl modify service -d <db_unique_name> -s <service_name> -i <avail_inst_name> -r [-f]
srvctl modify service -d <db_unique_name> -s <service_name> -n -i "<preferred_list>" [-a "<available_list>"] [-f]
srvctl modify service -d <db_unique_name> -s <service_name> [-c {UNIFORM | SINGLETON}] [-P {BASIC|PRECONNECT|NONE}] [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}][-q {true|false}] [-x {true|false}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z <integer>] [-w <integer>]
srvctl relocate service -d <db_unique_name> -s <service_name> {-i <old_inst_name> -t <new_inst_name> | -c <current_node> -n <target_node>} [-f]
       Specify instances for an administrator-managed database, or nodes for a policy managed database
srvctl remove service -d <db_unique_name> -s <service_name> [-i <inst_name>] [-f]
srvctl start service -d <db_unique_name> [-s "<service_name_list>" [-n <node_name> | -i <inst_name>] ] [-o <start_options>]
srvctl stop service -d <db_unique_name> [-s "<service_name_list>" [-n <node_name> | -i <inst_name>] ] [-f]

srvctl add nodeapps { { -n <node_name> -A <name|ip>/<netmask>/[if1[|if2...]] } | { -S <subnet>/<netmask>/[if1[|if2...]] } } [-p <portnum>] [-m <multicast-ip-address>] [-e <eons-listen-port>] [-l <ons-local-port>]  [-r <ons-remote-port>] [-t <host>[:<port>][,<host>[:<port>]...]] [-v]
srvctl config nodeapps [-a] [-g] [-s] [-e]
srvctl modify nodeapps {[-n <node_name> -A <new_vip_address>/<netmask>[/if1[|if2|...]]] | [-S <subnet>/<netmask>[/if1[|if2|...]]]} [-m <multicast-ip-address>] [-p <multicast-portnum>] [-e <eons-listen-port>] [ -l <ons-local-port> ] [-r <ons-remote-port> ] [-t <host>[:<port>][,<host>[:<port>]...]] [-v]
srvctl start nodeapps [-n <node_name>] [-v]
srvctl stop nodeapps [-n <node_name>] [-f] [-r] [-v]
srvctl status nodeapps
srvctl enable nodeapps [-v]
srvctl disable nodeapps [-v]
srvctl remove nodeapps [-f] [-y] [-v]
srvctl getenv nodeapps [-a] [-g] [-s] [-e] [-t "<name_list>"]
srvctl setenv nodeapps {-t "<name>=<val>[,<name>=<val>,...]" | -T "<name>=<val>"}
srvctl unsetenv nodeapps -t "<name_list>" [-v]

srvctl add vip -n <node_name> -k <network_number> -A <name|ip>/<netmask>/[if1[|if2...]] [-v]
srvctl config vip { -n <node_name> | -i <vip_name> }
srvctl disable vip -i <vip_name> [-v]
srvctl enable vip -i <vip_name> [-v]
srvctl remove vip -i "<vip_name_list>" [-f] [-y] [-v]
srvctl getenv vip -i <vip_name> [-t "<name_list>"]
srvctl start vip { -n <node_name> | -i <vip_name> } [-v]
srvctl stop vip { -n <node_name>  | -i <vip_name> } [-f] [-r] [-v]
srvctl status vip { -n <node_name> | -i <vip_name> }
srvctl setenv vip -i <vip_name> {-t "<name>=<val>[,<name>=<val>,...]" | -T "<name>=<val>"}
srvctl unsetenv vip -i <vip_name> -t "<name_list>" [-v]

srvctl add asm [-l <lsnr_name>]
srvctl start asm [-n <node_name>] [-o <start_options>]
srvctl stop asm [-n <node_name>] [-o <stop_options>] [-f]
srvctl config asm [-a]
srvctl status asm [-n <node_name>] [-a]
srvctl enable asm [-n <node_name>]
srvctl disable asm [-n <node_name>]
srvctl modify asm [-l <lsnr_name>]
srvctl remove asm [-f]
srvctl getenv asm [-t <name>[, ...]]
srvctl setenv asm -t "<name>=<val> [,...]" | -T "<name>=<value>"
srvctl unsetenv asm -t "<name>[, ...]"
srvctl start diskgroup -g <dg_name> [-n "<node_list>"]
srvctl stop diskgroup -g <dg_name> [-n "<node_list>"] [-f]
srvctl status diskgroup -g <dg_name> [-n "<node_list>"] [-a]
srvctl enable diskgroup -g <dg_name> [-n "<node_list>"]
srvctl disable diskgroup -g <dg_name> [-n "<node_list>"]
srvctl remove diskgroup -g <dg_name> [-f]

srvctl add listener [-l <lsnr_name>] [-s] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-o <oracle_home>] [-k <net_num>]
srvctl config listener [-l <lsnr_name>] [-a]
srvctl start listener [-l <lsnr_name>] [-n <node_name>]
srvctl stop listener [-l <lsnr_name>] [-n <node_name>] [-f]
srvctl status listener [-l <lsnr_name>] [-n <node_name>]
srvctl enable listener [-l <lsnr_name>] [-n <node_name>]
srvctl disable listener [-l <lsnr_name>] [-n <node_name>]
srvctl modify listener [-l <lsnr_name>] [-o <oracle_home>] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-u <oracle_user>] [-k <net_num>]
srvctl remove listener [-l <lsnr_name> | -a] [-f]
srvctl getenv listener [-l <lsnr_name>] [-t <name>[, ...]]
srvctl setenv listener [-l <lsnr_name>] -t "<name>=<val> [,...]" | -T "<name>=<value>"
srvctl unsetenv listener [-l <lsnr_name>] -t "<name>[, ...]"

srvctl add scan -n <scan_name> [-k <network_number> [-S <subnet>/<netmask>[/if1[|if2|...]]]]
srvctl config scan [-i <ordinal_number>]
srvctl start scan [-i <ordinal_number>] [-n <node_name>]
srvctl stop scan [-i <ordinal_number>] [-f]
srvctl relocate scan -i <ordinal_number> [-n <node_name>]
srvctl status scan [-i <ordinal_number>]
srvctl enable scan [-i <ordinal_number>]
srvctl disable scan [-i <ordinal_number>]
srvctl modify scan -n <scan_name>
srvctl remove scan [-f] [-y]
srvctl add scan_listener [-l <lsnr_name_prefix>] [-s] [-p [TCP:]<port>[/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]]
srvctl config scan_listener [-i <ordinal_number>]
srvctl start scan_listener [-n <node_name>] [-i <ordinal_number>]
srvctl stop scan_listener [-i <ordinal_number>] [-f]
srvctl relocate scan_listener -i <ordinal_number> [-n <node_name>]
srvctl status scan_listener [-i <ordinal_number>]
srvctl enable scan_listener [-i <ordinal_number>]
srvctl disable scan_listener [-i <ordinal_number>]
srvctl modify scan_listener {-u|-p [TCP:]<port>[/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]}
srvctl remove scan_listener [-f] [-y]

srvctl add srvpool -g <pool_name> [-l <min>] [-u <max>] [-i <importance>] [-n "<server_list>"]
srvctl config srvpool [-g <pool_name>]
srvctl status srvpool [-g <pool_name>] [-a]
srvctl status server -n "<server_list>" [-a]
srvctl relocate server -n "<server_list>" -g <pool_name> [-f]
srvctl modify srvpool -g <pool_name> [-l <min>] [-u <max>] [-i <importance>] [-n "<server_list>"]
srvctl remove srvpool -g <pool_name>

srvctl add oc4j [-v]
srvctl config oc4j
srvctl start oc4j [-v]
srvctl stop oc4j [-f] [-v]
srvctl relocate oc4j [-n <node_name>] [-v]
srvctl status oc4j [-n <node_name>]
srvctl enable oc4j [-n <node_name>] [-v]
srvctl disable oc4j [-n <node_name>] [-v]
srvctl modify oc4j -p <oc4j_rmi_port> [-v]
srvctl remove oc4j [-f] [-v]

srvctl start home -o <oracle_home> -s <state_file> -n <node_name>
srvctl stop home -o <oracle_home> -s <state_file> -n <node_name> [-t <stop_options>] [-f]
srvctl status home -o <oracle_home> -s <state_file> -n <node_name>

srvctl add filesystem -d <volume_device> -v <volume_name> -g <dg_name> [-m <mountpoint_path>] [-u <user>]
srvctl config filesystem -d <volume_device>
srvctl start filesystem -d <volume_device> [-n <node_name>]
srvctl stop filesystem -d <volume_device> [-n <node_name>] [-f]
srvctl status filesystem -d <volume_device>
srvctl enable filesystem -d <volume_device>
srvctl disable filesystem -d <volume_device>
srvctl modify filesystem -d <volume_device> -u <user>
srvctl remove filesystem -d <volume_device> [-f]

srvctl start gns [-v] [-l <log_level>] [-n <node_name>]
srvctl stop gns [-v] [-n <node_name>] [-f]
srvctl config gns [-v] [-a] [-d] [-k] [-m] [-n <node_name>] [-p] [-s] [-V]
srvctl status gns -n <node_name>
srvctl enable gns [-v] [-n <node_name>]
srvctl disable gns [-v] [-n <node_name>]
srvctl relocate gns [-v] [-n <node_name>] [-f]
srvctl add gns [-v] -d <domain> -i <vip_name|ip> [-k <network_number> [-S <subnet>/<netmask>[/<interface>]]]
srvctl modify gns [-v] [-f] [-l <log_level>] [-d <domain>] [-i <ip_address>] [-N <name> -A <address>] [-D <name> -A <address>] [-c <name> -a <alias>] [-u <alias>] [-r <address>] [-V <name>] [-F <forwarded_domains>] [-R <refused_domains>] [-X <excluded_interfaces>]
Usage: srvctl remove gns [-f] [-d <domain_name>]

Crsctl Syntax (for further explanation of these commands see the Oracle Documentation)

$ ./crsctl -h
Usage: crsctl add       - add a resource, type or other entity
       crsctl check     - check a service, resource or other entity
       crsctl config    - output autostart configuration
       crsctl debug     - obtain or modify debug state
       crsctl delete    - delete a resource, type or other entity
       crsctl disable   - disable autostart
       crsctl enable    - enable autostart
       crsctl get       - get an entity value
       crsctl getperm   - get entity permissions
       crsctl lsmodules - list debug modules
       crsctl modify    - modify a resource, type or other entity
       crsctl query     - query service state
       crsctl pin       - Pin the nodes in the nodelist
       crsctl relocate  - relocate a resource, server or other entity
       crsctl replace   - replaces the location of voting files
       crsctl setperm   - set entity permissions
       crsctl set       - set an entity value
       crsctl start     - start a resource, server or other entity
       crsctl status    - get status of a resource or other entity
       crsctl stop      - stop a resource, server or other entity
       crsctl unpin     - unpin the nodes in the nodelist
       crsctl unset     - unset a entity value, restoring its default
==================
srvctl command list



srvctl commands
SRVCTL:
srvctl command target [options]
commands: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
targets: database/db|instance/inst|service/serv|nodeapps|asm|listener
targets: database/db|instance/inst|service/serv|nodeapps|asm|listener |diskgroup|home|ons|eons|filesystem|gns|oc4j|scan|scan_listener |srvpool|server|VIP -- From Oracle 11g R2

srvctl -help or srvctl -v



srvctl -V -- prints version
srvctl version: 10.2.0.0.0 (or) srvctl version: 11.2.0.1.0



srvctl -h -- print usage



srvctl status service –h




srvctl enable asm -n node_name [-i asm_inst_name]

-n node_name:Node name
-i inst_name:ASM instance name.


An example of this command is:

srvctl enable asm -n node01 -i asm1





To add/remove listener
srvctl add listener -n node_name -o ORACLE_HOME [-l listener_name]
srvctl add listener –n linuxrac01 –o $ORACLE_HOME –l listenerbhavik_test01
srvctl remove listener -n node_name [-l listener_name]
srvctl remove listener –n linuxrac02 –l listenerbhavik_test02


To add/remove listener in 11g Rel 2
srvctl add listener -l LISTENERASM01 -p "TCP:1525" -o $ORACLE_HOME
srvctl add listener -l listenerbhavik01 -p 1341 -o /db/oracle/ora11201
srvctl remove listener [-l lsnr_name|-a] [-f]
srvctl remove listener -l listenerbhavik01


To start/stop listener
srvctl start listener -n node_name [-l listener_names]
srvctl start listener -n linuxrac01
srvctl stop listener -n node_name [-l listener_names]
srvctl stop listener -n linuxrac01


To check the status of the listener
srvctl status listener [-n node_name] [-l listener_names]
srvctl status listener -n linuxrac02

To configure listener
srvctl config listener -n node_name
srvctl config listener –n linuxrac01
srvctl config listener [-l lsnr_name] [-a]
srvctl config listener -l listenerbhavik01

To modify the listener
srvctl modify listener -n node_name [-l listener_names] -o ORACLE_HOME
srvctl modify listener -n linuxrac03 -o /db/oracle/app/oracle/product/11.2/asm -l "LISTENERbhavik_test04"

To enable/disable listener
srvctl enable listener [-l lsnr_name] [-n node_name]
srvctl enable listener -l listenerbhavik_test02 -n linuxrac02
srvctl disable listener [-l lsnr_name] [-n node_name]
srvctl disable listener -l listenerbhavik_test02 -n linuxrac02

To get/set/unset environment parameter for listener
srvctl getenv listener [-l lsnr_name]
srvctl getenv listener -l listenerbhavik_test02



gets the environment configuration for a cluster database:

srvctl getenv database -d mndb



srvctl setenv listener [-l lsnr_name] [-t "name=val]
srvctl setenv listener -t LANG=en

srvctl unsetenv listener [-l lsnr_name] [-t name]
srvctl unsetenv listener -t "TNS_ADMIN"




Database:
srvctl add database -d db_name -o ORACLE_HOME [-m domain_name][-p spfile] [-A name|ip/netmask]
[-r {PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY}]
[-s start_options] [-n db_name] [-y {AUTOMATIC|MANUAL}]
srvctl add database -d prod -o /u01/oracle/product/102/prod
  
srvctl remove database -d db_name [-f]
srvctl remove database -d prod

srvctl start database -d db_name [-o start_options] [-c connect_str|-q]
srvctl start database -d db_name [-o open]
srvctl start database -d db_name -o nomount
srvctl start database -d db_name -o mount

srvctl start db -d prod
srvctl start database -d apps -o open

srvctl stop database -d db_name [-o stop_options] [-c connect_str|-q]
srvctl stop database -d db_name [-o normal]
srvctl stop database -d db_name -o transactional
srvctl stop database -d db_name -o immediate
srvctl stop database -d db_name -o abort
srvctl stop db -d crm -o immediate

srvctl status database -d db_name [-f] [-v] [-S level]
srvctl status database -d db_name -v service_name

srvctl status database -d hrms

srvctl enable database -d db_name
srvctl enable database -d vis

srvctl disable database -d db_name
srvctl disable db -d vis

srvctl config database
srvctl config database -d db_name [-a] [-t]
srvctl config database
srvctl config database -d HYD -a

srvctl modify database -d db_name [-n db_name] [-o ORACLE_HOME] [-m domain_name] [-p spfile]
[-r {PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY}] [-s start_options] [-y {AUTOMATIC|MANUAL}]
srvctl modify database -d hrms -r physical_standby
srvctl modify db -d RAC -p /u03/oradata/RAC/spfileRAC.ora -- moves p file
srvctl modify database –d HYD –o /u01/app/oracle/product/11.1/db –s open

srvctl getenv database -d db_name [-t name_list]
srvctl getenv database -d prod

srvctl setenv database -d db_name {-t name=val[,name=val,...]|-T name=val}
srvctl setenv database –d HYD –t “TNS_ADMIN=/u01/app/oracle/product/11.1/asm/network/admin”
srvctl setenv db -d prod -t LANG=en

srvctl unsetenv database -d db_name [-t name_list]
srvctl unsetenv database -d prod -t CLASSPATH

In 11g Release 2, some command's syntax has been changed:
srvctl add database -d db_unique_name -o ORACLE_HOME [-x node_name] [-m domain_name] [-p spfile] [-r {PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY}] [-s start_options] [-t stop_options] [-n db_name] [-y {AUTOMATIC|MANUAL}] [-g server_pool_list] [-a "diskgroup_list"]
srvctl add database -d prod -o /u01/oracle/product/112/prod -m foo.com -p +dg1/prod/spfileprod.ora -r PRIMARY -s open -t normal -n db2 -y AUTOMATIC -g svrpool1,svrpool2 -a "dg1,dg2"

srvctl remove database -d db_unique_name [-f] [-y] [-v]
srvctl remove database -d prod -y

srvctl stop database -d db_unique_name [-o stop_options] [-f]
srvctl stop database -d dev -f

srvctl status database -d db_unique_name [-f] [-v]
srvctl status db -d sat -v

srvctl enable database -d db_unique_name [-n node_name]
srvctl enable database -d vis -n lnx01

srvctl disable database -d db_unique_name [-n node_name]
srvctl disable db -d vis -n lnx03

srvctl config database [-d db_unique_name [-a]]
srvctl config db -d db_erp -a

srvctl modify database -d db_unique_name [-n db_name] [-o ORACLE_HOME] [-u oracle_user] [-m domain] [-p spfile] [-r {PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY}] [-s start_options] [-t stop_options] [-y {AUTOMATIC|MANUAL}] [-g "server_pool_list"] [-a "diskgroup_list"|-z]
srvctl modify db -d prod -r logical_standby
srvctl modify database -d racTest -a "SYSFILES,LOGS,OLTP"

Instance:
srvctl add instance –d db_name –i inst_name -n node_name
srvctl add instance -d prod -i prod01 -n linux01
  
srvctl remove instance –d db_name –i inst_name [-f]
srvctl remove instance -d prod -i prod01

srvctl start instance -d db_name -i inst_names [-o start_options] [-c connect_str|-q]
srvctl start instance –d db_name –i inst_names [-o open]
srvctl start instance –d db_name –i inst_names -o nomount
srvctl start instance –d db_name –i inst_names -o mount

srvctl start instance –d dev -i dev2

srvctl stop instance -d db_name -i inst_names [-o stop_options] [-c connect_str|-q]
srvctl stop instance –d db_name –i inst_names [-o normal]
srvctl stop instance –d db_name –i inst_names -o transactional
srvctl stop instance –d db_name –i inst_names -o immediate
srvctl stop instance –d db_name –i inst_names -o abort

srvctl stop inst –d vis -i vis

srvctl status instance –d db_name –i inst_names [-f] [-v] [-S level]

srvctl status inst –d racdb -i racdb2

srvctl enable instance –d db_name –i inst_names
srvctl enable instance -d prod -i "prod1,prod2"

srvctl disable instance –d db_name –i inst_names
srvctl disable inst -d prod -i "prod1,prod3"

srvctl modify instance -d db_name -i inst_name {-s asm_inst_name|-r} -- set dependency of instance to ASM
srvctl modify instance -d db_name -i inst_name -n node_name -- move the instance
srvctl modify instance -d db_name -i inst_name -r -- remove the instance

srvctl getenv instance –d db_name –i inst_name [-t name_list]
srvctl setenv instance –d db_name [–i inst_name] {-t "name=val[,name=val,...]" | -T "name=val"}
srvctl unsetenv instance –d db_name [–i inst_name] [-t name_list]

In 11g Release 2, some command's syntax has been changed:
srvctl start instance -d db_unique_name {-n node_name -i "instance_name_list"} [-o start_options]
srvctl start instance -d prod -n node2
srvctl start inst -d prod -i "prod2,prod3"

srvctl stop instance -d db_unique_name {[-n node_name]|[-i "instance_name_list"]} [-o stop_options] [-f]
srvctl stop inst -d prod -n node1
srvctl stop instance -d prod -i prod1

srvctl status instance -d db_unique_name {-n node_name | -i "instance_name_list"} [-f] [-v]
srvctl status instance -d prod -i "prod1,prod2" -v

srvctl modify instance -d db_unique_name -i instance_name {-n node_name|-z}
srvctl modify instance -d prod -i prod1 -n mynode
srvctl modify inst -d prod -i prod1 -z


Service:
srvctl add service -d db_name -s service_name -r pref_insts [-a avail_insts] [-P TAF_policy]
srvctl add service -d db_name -s service_name -u {-r "new_pref_inst" | -a "new_avail_inst"}
srvctl add service -d RAC -s PRD -r RAC01,RAC02 -a RAC03,RAC04
srvctl add serv -d CRM -s CRM -r CRM1 -a CRM3 -P basic

srvctl remove service -d db_name -s service_name [-i inst_name] [-f]
srvctl remove serv -d dev -s sales
srvctl remove service -d dev -s sales -i dev01,dev02

srvctl start service -d db_name [-s service_names [-i inst_name]] [-o start_options]
srvctl start service -d db_name -s service_names [-o open]
srvctl start service -d db_name -s service_names -o nomount
srvctl start service -d db_name -s service_names -o mount
srvctl start serv -d dwh -s dwh

srvctl stop service -d db_name [-s service_names [-i inst_name]] [-f]
srvctl stop serv -d dwh -s dwh

srvctl status service -d db_name [-s service_names] [-f] [-v] [-S level]
srvctl status service -d dev -s dev

srvctl enable service -d db_name -s service_names [–i inst_name]
srvctl enable service -d apps -s apps1

srvctl disable service -d db_name -s service_names [–i inst_name]
srvctl disable serv -d dev -s dev -i dev1

srvctl config service -d db_name [-s service_name] [-a] [-S level]
srvctl config service -d db_name -a -- -a shows TAF configuration
srvctl config service -d TEST -s test PREF:TST1 AVAIL:TST2

srvctl modify service -d db_name -s service_name -i old_inst_name -t new_inst_name [-f]
srvctl modify service -d db_name -s service_name -i avail_inst_name -r [-f]
srvctl modify service -d db_name -s service_name -n -i preferred_list [-a available_list] [-f]
srvctl modify service -d db_name -s service_name -i old_inst_name -a avail_inst -P TAF_policy
srvctl modify serv -d PROD -s DWH -n -i I1,I2,I3,I4 -a I5,I6

srvctl relocate service -d db_name -s service_name –i old_inst_name -t target_inst [-f]

srvctl getenv service -d db_name -s service_name -t name_list
srvctl setenv service -d db_name [-s service_name] {-t "name=val[,name=val,...]" | -T "name=val"}
srvctl unsetenv service -d db_name -s service_name -t name_list

In 11g Release 2, some command's syntax has been changed:
srvctl add service -d db_unique_name -s service_name [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC|MANUAL}] [-q {true|false}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}][-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}][-z failover_retries] [-w failover_delay]
srvctl add service -d rac -s rac1 -q TRUE -m BASIC -e SELECT -z 180 -w 5 -j LONG

srvctl add service -d db_unique_name -s service_name -u {-r preferred_list | -a available_list}

srvctl add service -d db_unique_name -s service_name
-g server_pool [-c {UNIFORM|SINGLETON}] [-k network_number]
[-l [PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY]
[-y {AUTOMATIC|MANUAL}] [-q {TRUE|FALSE}] [-j {SHORT|LONG}]
[-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}]
[-m {NONE|BASIC}] [-P {BASIC|NONE|PRECONNECT}] [-x {TRUE|FALSE}]
[-z failover_retries] [-w failover_delay]

srvctl add service -d db_unique_name -s service_name -r preferred_list [-a available_list] [-P {BASIC|NONE|PRECONNECT}]
[-l [PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY]
[-y {AUTOMATIC|MANUAL}] [-q {TRUE|FALSE}] [-j {SHORT|LONG}]
[-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}]
[-m {NONE|BASIC}] [-x {TRUE|FALSE}] [-z failover_retries] [-w failover_delay]
srvctl add serv -d dev -s sales -r dev01,dev02 -a dev03 -P PRECONNECT

srvctl start service -d db_unique_name [-s "service_name_list" [-n node_name | -i instance_name]] [-o start_options]
srvctl start serv -d dev -s dev
srvctl start service -d dev -s dev -i dev2

srvctl stop service -d db_unique_name [-s "service_name_list"] [-n node_name | -i instance_name] [-f]
srvctl stop service -d dev -s dev
srvctl stop serv -d dev -s dev -i dev2

srvctl status service -d db_unique_name [-s "service_name_list"] [-f] [-v]
srvctl status service -d dev -s dev -v

srvctl enable service -d db_unique_name -s "service_name_list" [-i instance_name | -n node_name]
srvctl enable service -d dev -s dev
srvctl enable serv -d dev -s dev -i dev1

srvctl disable service -d db_unique_name -s "service_name_list" [-i instance_name | -n node_name]
srvctl disable service -d dev -s "dev,marketing"
srvctl disable serv -d dev -s dev -i dev1

srvctl config service -d db_unique_name [-s service_name] [-a]
srvctl config service -d dev -s dev

srvctl modify service -d db_unique_name -s service_name
[-c {UNIFORM|SINGLETON}] [-P {BASIC|PRECONNECT|NONE}]
[-l {[PRIMARY]|[PHYSICAL_STANDBY]|[LOGICAL_STANDBY]|[SNAPSHOT_STANDBY]} [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z failover_retries] [-w failover_delay] [-y {AUTOMATIC|MANUAL}]
srvctl modify service -d db_unique_name -s service_name -i old_instance_name -t new_instance_name [-f]
srvctl modify service -d db_unique_name -s service_name -i avail_inst_name -r [-f]
srvctl modify service -d db_unique_name -s service_name -n -i preferred_list [-a available_list] [-f]
srvctl modify service -d dev -s dev -i dev1 -t dev2
srvctl modify serv -d dev -s dev -i dev1 -r
srvctl modify service -d dev -s dev -n -i dev1 -a dev2

srvctl relocate service -d db_unique_name -s service_name {-c source_node -n target_node|-i old_instance_name -t new_instance_name} [-f]
srvctl relocate service -d dev -s dev -i dev1 -t dev3

Nodeapps:
#srvctl add nodeapps -n node_name -o ORACLE_HOME -A name|ip/netmask[/if1[|if2|...]]
#srvctl add nodeapps -n lnx02 -o $ORACLE_HOME -A 192.168.0.151/255.255.0.0/eth0

#srvctl remove nodeapps -n node_names [-f]

#srvctl start nodeapps -n node_name -- Starts GSD, VIP, listener & ONS

#srvctl stop nodeapps -n node_name [-r] -- Stops GSD, VIP, listener & ONS

#srvctl status nodeapps -n node_name

#srvctl config nodeapps -n node_name [-a] [-g] [-o] [-s] [-l]
-a Display VIP configuration
-g Display GSD configuration
-s Display ONS daemon configuration
-l Display listener configuration

#srvctl modify nodeapps -n node_name [-A new_vip_address]
#srvctl modify nodeapps -n lnx06 -A 10.50.99.43/255.255.252.0/eth0

#srvctl getenv nodeapps -n node_name [-t name_list]

#srvctl setenv nodeapps -n node_name {-t "name=val[,name=val,...]"|-T "name=val"}
#srvctl setenv nodeapps –n adcracdbq3 –t “TNS_ADMIN=/u01/app/oracle/product/11.1/asm/network/admin”

#srvctl unsetenv nodeapps -n node_name [-t name_list]

In 11g Release 2, some command's syntax has been changed:
srvctl add nodeapps -n node_name -A {name|ip}/netmask[/if1[|if2|...]] [-m multicast_ip_address] [-p multicast_port_number] [-l ons_local_port] [-r ons_remote-port] [-t host[:port][,host[:port],...]] [-v]
srvctl add nodeapps -S subnet/netmask[/if1[|if2|...]] [-d dhcp_server_type] [-m multicast_ip_address] [-p multicast_port_number] [-l ons_local_port] [-r ons_remote-port] [-t host[:port][,host[:port],...]] [-v]
#srvctl add nodeapps -n devnode1 -A 1.2.3.4/255.255.255.0

srvctl remove nodeapps [-f] [-y] [-v]
srvctl remove nodeapps

srvctl start nodeapps [-n node_name] [-v]
srvctl start nodeapps

srvctl stop nodeapps [-n node_name] [-r] [-v]
srvctl stop nodeapps

srvctl status nodeapps

srvctl enable nodeapps [-g] [-v]
srvctl enable nodeapps -g -v

srvctl disable nodeapps [-g] [-v]
srvctl disable nodeapps -g -v

srvctl config nodeapps [-a] [-g] [-s] [-e]
srvctl config nodeapps -a -g -s -e

srvctl modify nodeapps [-n node_name -A new_vip_address] [-S subnet/netmask[/if1[|if2|...]] [-m multicast_ip_address] [-p multicast_port_number] [-e eons_listen_port] [-l ons_local_port] [-r ons_remote_port] [-t host[:port][,host:port,...]] [-v]
srvctl modify nodeapps -n mynode1 -A 100.200.300.40/255.255.255.0/eth0

srvctl getenv nodeapps [-a] [-g] [-s] [-e] [-t "name_list"] [-v]
srvctl getenv nodeapps -a

srvctl setenv nodeapps {-t "name=val[,name=val][...]" | -T "name=val"} [-v]
srvctl setenv nodeapps -T "CLASSPATH=/usr/local/jdk/jre/rt.jar" -v

srvctl unsetenv nodeapps -t "name_list" [-v]
srvctl unsetenv nodeapps -t "test_var1,test_var2"

ASM:
srvctl add asm -n node_name -i asminstance -o ORACLE_HOME [-p spfile]

srvctl remove asm -n node_name [-i asminstance] [-f]
srvctl remove asm -n db6

srvctl start asm -n node_name [-i asminstance] [-o start_options] [-c connect_str|-q]
srvctl start asm -n node_name [-i asminstance] [-o open]
srvctl start asm -n node_name [-i asminstance] -o nomount
srvctl start asm -n node_name [-i asminstance] -o mount
srvctl start asm -n linux01

srvctl stop asm -n node_name [-i asminstance] [-o stop_options] [-c connect_str|-q]
srvctl stop asm -n node_name [-i asminstance] [-o normal]
srvctl stop asm -n node_name [-i asminstance] -o transactional
srvctl stop asm -n node_name [-i asminstance] -o immediate
srvctl stop asm -n node_name [-i asminstance]-o abort
srvctl stop asm -n racnode1
srvctl stop asm -n devnode1 -i +asm1

srvctl status asm -n node_name
srvctl status asm -n racnode1

srvctl enable asm -n node_name [-i asminstance]
srvctl enable asm -n lnx03 -i +asm3

srvctl disable asm -n node_name [-i asminstance]
srvctl disable asm -n lnx02 -i +asm2

srvctl config asm -n node_name
srvctl config asm -n lnx08

srvctl modify asm -n node_name -i asminstance [-o ORACLE_HOME] [-p spfile]
srvctl modify asm –n rac6 -i +asm6 –o /u01/app/oracle/product/11.1/asm

In 11g Release 2, some command's syntax has been changed:
srvctl add asm [-l lsnr_name] [-p spfile] [-d asm_diskstring]
srvctl add asm
srvctl add asm -l LISTENERASM -p +dg_data/spfile.ora

srvctl remove asm [-f]
srvctl remove asm -f

srvctl start asm [-n node_name] [-o start_options]
srvctl start asm -n devnode1

srvctl stop asm [-n node_name] [-o stop_options] [-f]
srvctl stop asm -n devnode1 -f

srvctl status asm [-n node_name] [-a]
srvctl status asm -n devnode1 -a

srvctl enable asm [-n node_name]
srvctl enable asm -n devnode1

srvctl disable asm [-n node_name]
srvctl disable asm -n devnode1

srvctl config asm [-a]
srvctl config asm -a

srvctl modify asm [-l lsnr_name] [-p spfile] [-d asm_diskstring]
srvctl modify asm [-n node_name] [-l listener_name] [-d asm_diskstring] [-p spfile_path_name]
srvctl modify asm -l lsnr1

srvctl getenv asm [-t name[, ...]]
srvctl getenv asm

srvctl setenv asm {-t "name=val [,...]" | -T "name=value"}
srvctl setenv asm -t LANG=en

srvctl unsetenv asm -t "name[, ...]"
srvctl unsetenv asm -t CLASSPATH

Listener:
srvctl add listener -n node_name -o ORACLE_HOME [-l listener_name] -- 11g R1 command

srvctl remove listener -n node_name [-l listener_name] -- 11g R1 command

srvctl start listener -n node_name [-l listener_names]
srvctl start listener -n node1

srvctl stop listener -n node_name [-l listener_names]
srvctl stop listener -n node1

srvctl status listener [-n node_name] [-l listener_names] -- 11g R1 command
srvctl status listener -n node2

srvctl config listener -n node_name

srvctl modify listener -n node_name [-l listener_names] -o ORACLE_HOME -- 11g R1command
srvctl modify listener -n racdb4 -o /u01/app/oracle/product/11.1/asm -l "LISTENER_RACDB4"

In 11g Release 2, some command's syntax has been changed:
srvctl add listener [-l lsnr_name] [-s] [-p "[TCP:]port[, ...][/IPC:key][/NMP:pipe_name][/TCPS:s_port] [/SDP:port]"] [-k network_number] [-o ORACLE_HOME]
srvctl add listener -l LISTENERASM -p "TCP:1522" -o $ORACLE_HOME
srvctl add listener -l listener112 -p 1341 -o /ora/ora112

srvctl remove listener [-l lsnr_name|-a] [-f]
srvctl remove listener -l lsnr01

srvctl stop listener [-n node_name] [-l lsnr_name] [-f]

srvctl enable listener [-l lsnr_name] [-n node_name]
srvctl enable listener -l listener_dev -n node5

srvctl disable listener [-l lsnr_name] [-n node_name]
srvctl disable listener -l listener_dev -n node5

srvctl config listener [-l lsnr_name] [-a]
srvctl config listener

srvctl modify listener [-l listener_name] [-o oracle_home] [-u user_name] [-p "[TCP:]port_list[/IPC:key][/NMP:pipe_name][/TCPS:s_port][/SDP:port]"] [-k network_number]
srvctl modify listener -n node1 -p "TCP:1521,1522"

srvctl getenv listener [-l lsnr_name] [-t name[, ...]]
srvctl getenv listener

srvctl setenv listener [-l lsnr_name] {-t "name=val [,...]" | -T "name=value"}
srvctl setenv listener -t LANG=en

srvctl unsetenv listener [-l lsnr_name] -t "name[, ...]"
srvctl unsetenv listener -t "TNS_ADMIN"

New srvctl commands in 11g Release 2

Diskgroup:
srvctl remove diskgroup -g diskgroup_name [-n node_list] [-f]
srvctl remove diskgroup -g DG1 -f

srvctl start diskgroup -g diskgroup_name [-n node_list]
srvctl start diskgroup -g diskgroup1 -n node1,node2

srvctl stop diskgroup -g diskgroup_name [-n node_list] [-f]
srvctl stop diskgroup -g ASM_FRA_DG
srvctl stop diskgroup -g dg1 -n node1,node2 -f

srvctl status diskgroup -g diskgroup_name [-n node_list] [-a]
srvctl status diskgroup -g dg_data -n node1,node2 -a

srvctl enable diskgroup -g diskgroup_name [-n node_list]
srvctl enable diskgroup -g diskgroup1 -n node1,node2

srvctl disable diskgroup -g diskgroup_name [-n node_list]
srvctl disable diskgroup -g dg_fra -n node1, node2

Home:
srvctl start home -o ORACLE_HOME -s state_file [-n node_name]
srvctl start home -o /u01/app/oracle/product/11.2.0/db_1 -s ~/state.txt

srvctl stop home -o ORACLE_HOME -s state_file [-t stop_options] [-n node_name] [-f]
srvctl stop home -o /u01/app/oracle/product/11.2.0/db_1 -s ~/state.txt

srvctl status home -o ORACLE_HOME -s state_file [-n node_name]
srvctl status home -o /u01/app/oracle/product/11.2.0/db_1 -s ~/state.txt

ONS (Oracle Notification Service) :
srvctl add ons [-l ons-local-port] [-r ons-remote-port] [-t host[:port][,host[:port]...]] [-v]
srvctl add ons -l 6200

srvctl remove ons [-f] [-v]
srvctl remove ons -f

srvctl start ons [-v]
srvctl start ons -v

srvctl stop ons [-v]
srvctl stop ons -v

srvctl status ons

srvctl enable ons [-v]
srvctl enable ons

srvctl disable ons [-v]
srvctl disable ons

srvctl config ons

srvctl modify ons [-l ons-local-port] [-r ons-remote-port] [-t host[:port][,host[:port]...]] [-v]
srvctl modify ons

EONS:
srvctl add eons [-p portnum] [-m multicast-ip-address] [-e eons-listen-port] [-v]
#srvctl add eons -p 2018

srvctl remove eons [-f] [-v]
srvctl remove eons -f

srvctl start eons [-v]
srvctl start eons

srvctl stop eons [-f] [-v]
srvctl stop eons -f

srvctl status eons

srvctl enable eons [-v]
srvctl enable eons

srvctl disable eons [-v]
srvctl disable eons

srvctl config eons

srvctl modify eons [-m multicast_ip_address] [-p multicast_port_number] [-e eons_listen_port] [-v]
srvctl modify eons -p 2018

FileSystem:
srvctl add filesystem -d volume_device -v volume_name -g diskgroup_name [-m mountpoint_path] [-u user_name]
srvctl add filesystem -d /dev/asm/d1volume1 -v VOLUME1 -d RAC_DATA -m /oracle/cluster1/acfs1

srvctl remove filesystem -d volume_device_name [-f]
srvctl remove filesystem -d /dev/asm/racvol1

srvctl start filesystem -d volume_device_name [-n node_name]
srvctl start filesystem -d /dev/asm/racvol3

srvctl stop filesystem -d volume_device_name [-n node_name] [-f]
srvctl stop filesystem -d /dev/asm/racvol1 -f

srvctl status filesystem -d volume_device_name
srvctl status filesystem -d /dev/asm/racvol2

srvctl enable filesystem -d volume_device_name
srvctl enable filesystem -d /dev/asm/racvol9

srvctl disable filesystem -d volume_device_name
srvctl disable filesystem -d /dev/asm/racvol1

srvctl config filesystem -d volume_device_path

srvctl modify filesystem -d volume_device_name -u user_name
srvctl modify filesystem -d /dev/asm/racvol1 -u sysadmin

SrvPool:
srvctl add srvpool -g server_pool [-i importance] [-l min_size] [-u max_size] [-n node_list] [-f]
srvctl add srvpool -g SP1 -i 1 -l 3 -u 7 -n node1,node2

srvctl remove srvpool -g server_pool
srvctl remove srvpool -g srvpool1

srvctl status srvpool [-g server_pool] [-a]
srvctl status srvpool -g srvpool2 -a

srvctl config srvpool [-g server_pool]
srvctl config srvpool -g dbpool

srvctl modify srvpool -g server_pool [-i importance] [-l min_size] [-u max_size] [-n node_name_list] [-f]
srvctl modify srvpool -g srvpool4 -i 0 -l 2 -u 4 -n node3, node4

Server:
srvctl status server -n "server_name_list" [-a]
srvctl status server -n server11 -a

srvctl relocate server -n "server_name_list" -g server_pool_name [-f]
srvctl relocate server -n "linux1, linux2" -g sp2

Scan (Single Client Access Name):
srvctl add scan -n scan_name [-k network_number] [-S subnet/netmask[/if1[|if2|...]]]
#srvctl add scan -n scan.mycluster.example.com

srvctl remove scan [-f]
srvctl remove scan -f

srvctl start scan [-i ordinal_number] [-n node_name]
srvctl start scan -i 1 -n node1

srvctl stop scan [-i ordinal_number] [-f]
srvctl stop scan -i 1

srvctl status scan [-i ordinal_number]
srvctl status scan -i 1

srvctl enable scan [-i ordinal_number]
srvctl enable scan -i 1

srvctl disable scan [-i ordinal_number]
srvctl disable scan -i 3

srvctl config scan [-i ordinal_number]
srvctl config scan -i 2

srvctl modify scan -n scan_name
srvctl modify scan -n scan1

srvctl relocate scan -i ordinal_number [-n node_name]
srvctl relocate scan -i 2 -n node2

ordinal_number=1,2,3

Scan_listener:
srvctl add scan_listener [-l lsnr_name_prefix] [-s] [-p "[TCP:]port_list[/IPC:key][/NMP:pipe_name][/TCPS:s_port] [/SDP:port]"]
#srvctl add scan_listener -l myscanlistener

srvctl remove scan_listener [-f]
srvctl remove scan_listener -f

srvctl start scan_listener [-n node_name] [-i ordinal_number]
srvctl start scan_listener -i 1

srvctl stop scan_listener [-i ordinal_number] [-f]
srvctl stop scan_listener -i 3

srvctl status scan_listener [-i ordinal_number]
srvctl status scan_listener -i 1

srvctl enable scan_listener [-i ordinal_number]
srvctl enable scan_listener -i 2

srvctl disable scan_listener [-i ordinal_number]
srvctl disable scan_listener -i 1

srvctl config scan_listener [-i ordinal_number]
srvctl config scan_listener -i 3

srvctl modify scan_listener {-p [TCP:]port[/IPC:key][/NMP:pipe_name] [/TCPS:s_port][/SDP:port] | -u }
srvctl modify scan_listener -u

srvctl relocate scan_listener -i ordinal_number [-n node_name]
srvctl relocate scan_listener -i 1

ordinal_number=1,2,3

GNS (Grid Naming Service):
srvctl add gns -i ip_address -d domain
srvctl add gns -i 192.124.16.96 -d cluster.mycompany.com

srvctl remove gns [-f]
srvctl remove gns

srvctl start gns [-l log_level] [-n node_name]
srvctl start gns

srvctl stop gns [-n node_name [-v] [-f]
srvctl stop gns

srvctl status gns [-n node_name]
srvctl status gns

srvctl enable gns [-n node_name]
srvctl enable gns

srvctl disable gns [-n node_name]
srvctl disable gns -n devnode2

srvctl config gns [-a] [-d] [-k] [-m] [-n node_name] [-p] [-s] [-V] [-q name] [-l] [-v]
srvctl config gns -n lnx03

srvctl modify gns [-i ip_address] [-d domain]
srvctl modify gns -i 192.000.000.007

srvctl relocate gns [-n node_name]
srvctl relocate gns -n node2

VIP (Virtual Internet Protocol):
srvctl add vip -n node_name -A {name|ip}/netmask[/if1[if2|...]] [-k network_number] [-v]
#srvctl add vip -n node96 -A 192.124.16.96/255.255.255.0 -k 2

srvctl remove vip -i "vip_name_list" [-f] [-y] [-v]
srvctl remove vip -i "vip1,vip2,vip3" -f -y -v

srvctl start vip {-n node_name|-i vip_name} [-v]
srvctl start vip -i dev1-vip -v

srvctl stop vip {-n node_name|-i vip_name} [-r] [-v]
srvctl stop vip -n node1 -v

srvctl status vip {-n node_name|-i vip_name}
srvctl status vip -i node1-vip

srvctl enable vip -i vip_name [-v]
srvctl enable vip -i prod-vip -v

srvctl disable vip -i vip_name [-v]
srvctl disable vip -i vip3 -v

srvctl config vip {-n node_name|-i vip_name}
srvctl config vip -n devnode2

srvctl getenv vip -i vip_name [-t "name_list"] [-v]
srvctl getenv vip -i node1-vip

srvctl setenv vip -i vip_name {-t "name=val[,name=val,...]" | -T "name=val"}
srvctl setenv vip -i dev1-vip -t LANG=en

srvctl unsetenv vip -i vip_name -t "name_list" [-v]
srvctl unsetenv vip -i myvip -t CLASSPATH

OC4J (Oracle Container for Java):
srvctl add oc4j [-v]
srvctl add oc4j

srvctl remove oc4j [-f] [-v]
srvctl remove oc4j

srvctl start ocj4 [-v]
srvctl start ocj4 -v

srvctl stop oc4j [-f] [-v]
srvctl stop oc4j -f -v

srvctl status oc4j [-n node_name]
srvctl status oc4j -n lnx01

srvctl enable oc4j [-n node_name] [-v]
srvctl enable oc4j -n dev3

srvctl disable oc4j [-n node_name] [-v]
srvctl disable oc4j -n dev1

srvctl config oc4j

srvctl modify oc4j -p oc4j_rmi_port [-v]
srvctl modify oc4j -p 5385

srvctl relocate oc4j [-n node_name] [-v]
srvctl relocate oc4j -n lxn06 -v
========================
 
crsctl stat res


crsctl stat res -w "TYPE = ora.acfs.type" -p   --- for detail 

crsctl stat res -w "TYPE = ora.acfs.type" -p | grep VOLUME
AUX_VOLUMES=
CANONICAL_VOLUME_DEVICE=/dev/asm/test-81
VOLUME_DEVICE=/dev/asm/test-81
AUX_VOLUMES=
CANONICAL_VOLUME_DEVICE=/dev/asm/test-81
VOLUME_DEVICE=/dev/asm/test-81


kfod status=TRUE asm_diskstring='ORCL:*' disks=all dscvgroup=TRUE




crsctl status res |grep -v "^$"|awk -F "=" 'BEGIN {print " "} {printf("%s",NR%4 ? $2"|" : $2"\n")}'|sed -e 's/  *, /,/g' -e 's/, /,/g' |awk -F "|" 'BEGIN { printf "%-40s%-35s%-20s%-50s\n","Resource Name","Resource Type","Target ","State" }{ split ($3,trg,",") split ($4,st,",")}{for (i in trg) {printf "%-40s%-35s%-20s%-50s\n",$1,$2,trg[i],st[i]}}'




Resource Name                           Resource Type                      Target              State
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)  ora.asm_listener.type              ONLINE              ONLINE on irac01
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)  ora.asm_listener.type              ONLINE              ONLINE on irac02
ora.DATA.TEST.advm                      ora.volume.type                    ONLINE              ONLINE on irac01
ora.DATA.TEST.advm                      ora.volume.type                    ONLINE              ONLINE on irac02
ora.DATA.dg(ora.asmgroup)               ora.diskgroup.type                 ONLINE              ONLINE on irac01



crsctl stat res -t -init
crsctl stat res -t -init|column -t
srvctl status asm 

srvctl status asm
ASM is running on ibrac02,ibrac01



1368695.1 – Oracle Clusterware logs and RDBMS logs rotation policy

[grid@ibrac01 crs]$ pwd
/u01/app/grid/diag/crs/brac01/crs

[grid@ibrac01 crs]$ ls -ltr
total 216
drwxrwxr-x 2 root oinstall       6 Feb  1  2018 metadata_dgif
drwxrwxr-x 2 root oinstall       6 Feb  1  2018 incpkg
drwxrwxr-x 2 root oinstall    4096 Jul 19  2018 metadata
drwxrwxr-x 5 root oinstall      61 May 31  2022 log
drwxrwxr-x 2 grid oinstall      89 Jun  7  2022 metadata_pv
drwxrwxr-x 2 root oinstall    4096 Jun  7  2022 sweep
drwxrwxr-x 2 root oinstall    4096 Jun  7  2022 lck
drwxrwxr-x 2 root oinstall       6 Jul  7  2022 cdump
drwxrwxr-x 2 root oinstall       6 Jun  8 01:40 stage
drwxrwxr-x 2 root oinstall       6 Jun  8 01:40 incident
drwxrwxr-x 2 root oinstall      20 Jul  5 01:40 alert
drwxrwxr-x 2 grid oinstall 2736128 Jul 27 08:24 trace
[grid@ibrac01 crs]$
 
/u01/app/grid/diag/crs/brac01/crs/trace
 trace]$ ls -ltr alert*
-rw-rw---- 1 root oinstall 382804617 Jul 23 05:38 alert.log


11gR2 Clusterware and Grid Home - What You Need to Know (Doc ID 1053147.1)
NOTE:810394.1 - RAC and Oracle Clusterware Best Practices and Starter Kit (Platform Independent)
NOTE:1050693.1 - Troubleshooting 11.2 Clusterware Node Evictions (Reboots)
NOTE:1053970.1 - Troubleshooting 11.2 Grid Infrastructure root.sh Issues
NOTE:1054006.1 - CTSSD Runs in Observer Mode Even Though No Time Sync Software is Running

NOTE:184875.1 - How To Check The Certification Matrix for Real Application Clusters
NOTE:259301.1 - CRS and 10g/11.1 Real Application Clusters
NOTE:887522.1 - Grid Infrastructure Single Client Access Name (SCAN) Explained
NOTE:946332.1 - Unable To Create 10.1 or 10.2 or 11.1(< 11gR2) ASM RAC Databases (ORA-29702) Using Brand New 11gR2 Grid Infrastructure Installation .

Wednesday, 21 March 2012

Unix all open ports

Display list of all open ports

netstat -tulpn

Tuesday, 20 March 2012

ASM shell script add file

Oracle ASM add file ..


#!/usr/bin/ksh
clear
(
export ORACLE_SID=XYZ

print "Adding datafile to the tablespace\n"
sqlplus -s / as sysdba <<+
WHENEVER SQLERROR EXIT 1;
WHENEVER OSERROR EXIT 1;
ALTER TABLESPACE "ANUJ" ADD DATAFILE '+DATA' SIZE 2g AUTOEXTEND on;
+
)

=======


   alter tablespace xxxx add datafile '+DATA' SIZE 2g AUTOEXTEND on;

alter tablespace xxxx add datafile '+DATA' size 1024m autoextend on maxsize unlimited;



set serveroutput on linesize 300

declare 
v_stmt2 varchar2(600);

begin 

FOR i IN 2..1023 loop
v_stmt2:= 'ALTER TABLESPACE ' ||'TX_DATA'|| ' ADD DATAFILE ' || '''+DATA'''||  ' SIZE 1m AUTOEXTEND on' ;
--dbms_output.put_line(v_stmt2);
execute immediate v_stmt2;
end loop;

end ;
/

ERROR at line 1:
ORA-01686: max # files (1023) reached for the tablespace TX_DATA
ORA-06512: at line 9

=====







alter tablespace TEST_DATA add datafile '+DATA/irac/test_data02.dbf' size 1G;

Tablespace altered.




datafile backup 

run {
        backup as compressed backupset
        incremental level 0
        format '/u01/irac/df_%T_@_%s_%p_%t'
        datafile 16
        include current controlfile
        ;
}


 alter session set nls_date_format='dd-mm-yyyy hh24:mi';
set linesize 300 pagesize 300
col unrecoverable_time for a25
col NAME for a70
select NAME,file#, unrecoverable_change#, unrecoverable_time,CREATION_TIME from v$datafile
where 1=1
and  unrecoverable_time is not null and unrecoverable_change# > 0
;


NAME                                                                        FILE# UNRECOVERABLE_CHANGE# UNRECOVERABLE_TIME        CREATION_TIME
---------------------------------------------------------------------- ---------- --------------------- ------------------------- ----------------
+DATA/irac/apex_data01.dbf                                                     2            2487391149 11-08-2023 22:00          06-06-2017 08:58



select df.*
from   v$datafile df, v$backup bk
where  df.file#=bk.file#
  and  df.unrecoverable_change# <> 0
  and  df.UNRECOVERABLE_TIME >
   (select max(end_time)
    from   v$rman_backup_job_details
    where  input_type in ('DB FULL' ,'DB INCR')
   );

Saturday, 17 March 2012

Oracle documentation

Oracle documentation



http://www.oracle.com/pls/db112/portal.all_books

Thursday, 15 March 2012

ASM SQLs' from RDBMS Instance



ASM sql's from rdbms instance <<<<<<<<<<<<<<<<<<


SQL> show parameter instance_type

NAME Type VALUE
------------------------------------ ------ ------------------------------
instance_type string RDBMS







COLUMN GROUP_NUMBER FORMAT 999999 HEADING GROUP_|NUMBER
COLUMN INSTANCE_NAME FORMAT A7 HEADING INSTANC|E_NAME
COLUMN DB_NAME FORMAT A7
COLUMN STATUS FORMAT A9
COLUMN SOFTWARE_VERSION FORMAT A16
COLUMN COMPATIBLE_VERSION FORMAT A18
set pagesize 200
SET VERIFY OFF
SET LINESIZE 80
-- SPOOL txt
SELECT
GROUP_NUMBER
,INSTANCE_NAME
,DB_NAME
,STATUS
,SOFTWARE_VERSION
,COMPATIBLE_VERSION
FROM sys.V_$ASM_CLIENT ;


GROUP_ INSTANC
NUMBER E_NAME DB_NAME STATUS SOFTWARE_VERSION COMPATIBLE_VERSION
------- ------- ------- --------- ---------------- ------------------
1 +ASM orcl CONNECTED 11.2.0.1.0 11.2.0.0.0
2 +ASM orcl CONNECTED 11.2.0.1.0 11.2.0.0.0







SET VERIFY ON
SET LINESIZE 1500

COLUMN GROUP_NUMBER FORMAT 999999 HEADING GROUP_|NUMBER
COLUMN NAME FORMAT A12
COLUMN SECTOR_SIZE FORMAT 999999 HEADING SECTOR|_SIZE
COLUMN BLOCK_SIZE FORMAT 99999 HEADING BLOCK|_SIZE
COLUMN ALLOCATION_UNIT_SIZE FORMAT 9999999999 HEADING ALLOCATION|_UNIT_SIZE
COLUMN STATE FORMAT A9
COLUMN TYPE FORMAT A6
COLUMN TOTAL_MB FORMAT 99999999
COLUMN FREE_MB FORMAT 9999999
COLUMN REQUIRED_MIRROR_FREE_MB FORMAT 999999999999 HEADING REQUIRED_MIR|ROR_FREE_MB
COLUMN USABLE_FILE_MB FORMAT 9999999 HEADING USABLE_|FILE_MB
COLUMN OFFLINE_DISKS FORMAT 9999999 HEADING OFFLINE|_DISKS
COLUMN UNBALANCED FORMAT A5 HEADING UNBAL|ANCED
COLUMN COMPATIBILITY FORMAT A13
COLUMN DATABASE_COMPATIBILITY FORMAT A11 HEADING DATABASE_CO|MPATIBILITY
SET VERIFY OFF
SET LINESIZE 158
-- SPOOL .txt
SELECT
GROUP_NUMBER
,NAME
,SECTOR_SIZE
,BLOCK_SIZE
,ALLOCATION_UNIT_SIZE
,STATE
,TYPE
,TOTAL_MB
,FREE_MB
,REQUIRED_MIRROR_FREE_MB
,USABLE_FILE_MB
,OFFLINE_DISKS
-- ,UNBALANCED
,COMPATIBILITY
,DATABASE_COMPATIBILITY
FROM SYS.V_$ASM_DISKGROUP ;

GROUP_ SECTOR BLOCK ALLOCATION REQUIRED_MIR USABLE_ OFFLINE DATABASE_CO
NUMBER NAME _SIZE _SIZE _UNIT_SIZE STATE TYPE TOTAL_MB FREE_MB ROR_FREE_MB FILE_MB _DISKS COMPATIBILITY MPATIBILITY
------- ------------ ------- ------ ----------- --------- ------ --------- -------- ------------- -------- -------- ------------- -----------
1 DATA 512 4096 1048576 CONNECTED NORMAL 9216 5657 896 2380 0 11.2.0.0.0 10.1.0.0.0
2 FRA 512 4096 1048576 CONNECTED EXTERN 9216 8998 0 8998 0 11.2.0.0.0 10.1.0.0.0











COLUMN GROUP_NUMBER FORMAT 999999999 HEADING GROUP_|NUMBER
COLUMN FILE_NUMBER FORMAT 999999999 HEADING FILE_N|UMBER
COLUMN COMPOUND_INDEX FORMAT 9999999999 HEADING COMPOUN|D_INDEX
COLUMN INCARNATION FORMAT 999999999 HEADING INCARN|ATION
COLUMN BLOCK_SIZE FORMAT 999999999 HEADING BLOCK|_SIZE
COLUMN BLOCKS FORMAT 999999999 HEADING BLO|CKS
COLUMN BYTES FORMAT 999999999 HEADING BYT|ES
COLUMN SPACE FORMAT 999999999 HEADING SPA|CE
COLUMN TYPE FORMAT A2 HEADING TY|PE
COLUMN REDUNDANCY FORMAT A5 HEADING REDUN|DANCY
COLUMN STRIPED FORMAT A4 HEADING STRI|PED
COLUMN CREATION_DATE FORMAT A7 HEADING CREATIO|N_DATE
COLUMN MODIFICATION_DATE FORMAT A9 HEADING MODIFICAT|ION_DATE
COLUMN REDUNDANCY_LOWERED FORMAT A9 HEADING REDUNDANC|Y_LOWERED

SET VERIFY OFF
SET LINESIZE 200
set pagesize 200
-- SPOOL .txt
SELECT
GROUP_NUMBER
,FILE_NUMBER
,COMPOUND_INDEX
,INCARNATION
,BLOCK_SIZE
,BLOCKS
,BYTES
,SPACE
,TYPE
,REDUNDANCY
,STRIPED
,CREATION_DATE
,MODIFICATION_DATE
,REDUNDANCY_LOWERED
FROM SYS.V_$ASM_FILE ;
-- WHERE ROWNUM<=100;
-- SPOOL OFF
-- CLEAR COLUMNS
SET VERIFY ON
SET LINESIZE 1500
-- UNDEFINE YOUR_VAR



GROUP_ FILE_N COMPOUN INCARN BLOCK BLO BYT SPA TY REDUN STRI CREATIO MODIFICAT REDUNDANC
NUMBER UMBER D_INDEX ATION _SIZE CKS ES CE PE DANCY PED N_DATE ION_DATE Y_LOWERED
---------- ---------- ----------- ---------- ---------- ---------- ---------- ---------- -- ----- ---- ------- --------- ---------
1 253 16777469 731105699 512 3 1536 2097152 AS MIRRO COAR 30-SEP- 30-SEP-10 U
MP R SE 10
AR
AM
ET
ER
FI
LE

1 256 16777472 731226373 8192 88321 723525632 ########## DA MIRRO COAR 01-OCT- 15-MAR-12 U
TA R SE 10
FI
LE

1 257 16777473 731226431 8192 70401 576724992 ########## DA MIRRO COAR 01-OCT- 15-MAR-12 U
TA R SE 10
FI
LE

1 258 16777474 731226451 8192 12161 99622912 204472320 DA MIRRO COAR 01-OCT- 15-MAR-12 U
TA R SE 10
FI
LE

1 259 16777475 731226455 8192 641 5251072 12582912 DA MIRRO COAR 01-OCT- 15-MAR-12 U
TA R SE 10
FI
LE

1 260 16777476 731227229 16384 595 9748480 50331648 CO HIGH FINE 01-OCT- 15-MAR-12 U
NT 10
RO
LF
IL
E

1 261 16777477 731227231 16384 595 9748480 50331648 CO HIGH FINE 01-OCT- 15-MAR-12 U
NT 10
RO
LF
IL
E

1 262 16777478 731227291 512 102401 52429312 110100480 ON MIRRO COAR 01-OCT- 15-MAR-12 U
LI R SE 10
NE
LO
G

1 263 16777479 731227315 512 102401 52429312 110100480 ON MIRRO COAR 01-OCT- 15-MAR-12 U
LI R SE 10
NE
LO
G

1 264 16777480 731227335 512 102401 52429312 110100480 ON MIRRO COAR 01-OCT- 15-MAR-12 U
LI R SE 10
NE
LO
G

1 265 16777481 731227415 8192 3713 30416896 62914560 TE MIRRO COAR 01-OCT- 15-MAR-12 U
MP R SE 10
FI
LE

1 266 16777482 731227433 8192 12801 104865792 214958080 DA MIRRO COAR 01-OCT- 15-MAR-12 U
TA R SE 10
FI
LE

1 267 16777483 731228339 512 5 2560 2097152 PA MIRRO COAR 01-OCT- 15-MAR-12 U
RA R SE 10
ME
TE
RF
IL
E

2 256 33554688 741266959 512 102401 52429312 53477376 ON UNPRO COAR 24-JAN- 15-MAR-12 U
LI T SE 11
NE
LO
G

2 257 33554689 741266861 512 102401 52429312 53477376 ON UNPRO COAR 24-JAN- 15-MAR-12 U
LI T SE 11
NE
LO
G

2 258 33554690 741267209 512 102401 52429312 53477376 ON UNPRO COAR 24-JAN- 15-MAR-12 U
LI T SE 11
NE
LO
G













COLUMN GROUP_NUMBER FORMAT 999999 HEADING GROUP_|NUMBER
COLUMN ENTRY_NUMBER FORMAT 999999 HEADING ENTRY_|NUMBER
COLUMN REDUNDANCY FORMAT A10
COLUMN STRIPE FORMAT A6
COLUMN SYSTEM FORMAT A3 HEADING SYS|TEM
COLUMN NAME FORMAT A20

SET VERIFY OFF
SET LINESIZE 70
set pagesize 200

SELECT
GROUP_NUMBER
,ENTRY_NUMBER
,REDUNDANCY
,STRIPE
,SYSTEM
,NAME
FROM SYS.V_$ASM_TEMPLATE ;


GROUP_ ENTRY_ REDUN SYS
NUMBER NUMBER DANCY STRIPE TEM Disk Group
------- ------- ---------- ------ --- --------------------
1 60 MIRROR COARSE Y PARAMETERFILE
1 61 MIRROR COARSE Y ASMPARAMETERFILE
1 62 MIRROR COARSE Y ASMPARAMETERBAKFILE
1 63 MIRROR COARSE Y DUMPSET
1 64 HIGH FINE Y CONTROLFILE
1 65 MIRROR COARSE Y FLASHFILE
1 66 MIRROR COARSE Y ARCHIVELOG
1 67 MIRROR COARSE Y ONLINELOG
1 68 MIRROR COARSE Y DATAFILE
1 69 MIRROR COARSE Y TEMPFILE
1 170 MIRROR COARSE Y BACKUPSET
1 171 MIRROR COARSE Y AUTOBACKUP
1 172 MIRROR COARSE Y XTRANSPORT
1 173 MIRROR COARSE Y CHANGETRACKING
1 174 MIRROR COARSE Y FLASHBACK
1 175 MIRROR COARSE Y DATAGUARDCONFIG
1 176 MIRROR COARSE Y OCRFILE
1 177 MIRROR COARSE Y OCRBACKUP
1 178 HIGH COARSE Y ASM_STALE
2 60 UNPROT COARSE Y PARAMETERFILE
2 61 UNPROT COARSE Y ASMPARAMETERFILE
2 62 UNPROT COARSE Y ASMPARAMETERBAKFILE
2 63 UNPROT COARSE Y DUMPSET
2 64 UNPROT FINE Y CONTROLFILE
2 65 UNPROT COARSE Y FLASHFILE
2 66 UNPROT COARSE Y ARCHIVELOG
2 67 UNPROT COARSE Y ONLINELOG
2 68 UNPROT COARSE Y DATAFILE
2 69 UNPROT COARSE Y TEMPFILE
2 170 UNPROT COARSE Y BACKUPSET
2 171 UNPROT COARSE Y AUTOBACKUP
2 172 UNPROT COARSE Y XTRANSPORT
2 173 UNPROT COARSE Y CHANGETRACKING
2 174 UNPROT COARSE Y FLASHBACK
2 175 UNPROT COARSE Y DATAGUARDCONFIG
2 176 UNPROT COARSE Y OCRFILE
2 177 UNPROT COARSE Y OCRBACKUP
2 178 UNPROT COARSE Y ASM_STALE

38 rows selected.


SET LINESIZE 145
SET PAGESIZE 9999
SET VERIFY off
COLUMN group_name FORMAT a20 HEAD 'Disk Group|Name'
COLUMN sector_size FORMAT 99,999 HEAD 'Sector|Size'
COLUMN block_size FORMAT 99,999 HEAD 'Block|Size'
COLUMN allocation_unit_size FORMAT 999,999,999 HEAD 'Allocation|Unit Size'
COLUMN state FORMAT a11 HEAD 'State'
COLUMN type FORMAT a6 HEAD 'Type'
COLUMN total_mb FORMAT 999,999,999 HEAD 'Total Size (MB)'
COLUMN used_mb FORMAT 999,999,999 HEAD 'Used Size (MB)'
COLUMN pct_used FORMAT 999.99 HEAD 'Pct. Used'

break on report on disk_group_name skip 1
compute sum label "Grand Total: " of total_mb used_mb on report

SELECT
name group_name
, sector_size sector_size
, block_size block_size
, allocation_unit_size allocation_unit_size
, state state
, type type
, total_mb total_mb
, (total_mb - free_mb) used_mb
, ROUND((1- (free_mb / total_mb))*100, 2) pct_used
FROM v_$asm_diskgroup
ORDER BY name



Disk Group Sector Block Allocation
Name Size Size Unit Size State Type Total Size (MB) Used Size (MB) Pct. Used
-------------------- ------- ------- ------------ ----------- ------ --------------- -------------- ---------
DATA 512 4,096 1,048,576 CONNECTED NORMAL 9,216 3,559 38.62
FRA 512 4,096 1,048,576 CONNECTED EXTERN 9,216 218 2.37
--------------- --------------
Grand Total: 18,432 3,777





COL name FORMAT A15 HEADING 'Diskgroup|Name' WRAP
COL database_compatibility FORMAT A10 HEADING 'Diskgroup|Version'
COL instance_name FORMAT A20 HEADING 'Serviced Database|Client' WRAP
COL db_name FORMAT A8 HEADING 'Database|Name'
COL status FORMAT A12 HEADING 'Status'
COL software_version FORMAT A10 HEADING 'Database|Version'

Set linesize 120
SELECT
g.name
,g.database_compatibility
,c.instance_name
,c.db_name
,c.status
,c.software_version
FROM v_$asm_client c, v_$asm_diskgroup_stat g
where c.group_number = g.group_number;



Diskgroup Diskgroup Serviced Database Database Database
Name Version Client Name Status Version
--------------- ---------- -------------------- -------- ------------ ----------
DATA 10.1.0.0.0 +ASM orcl CONNECTED 11.2.0.1.0
FRA 10.1.0.0.0 +ASM orcl CONNECTED 11.2.0.1.0



TTITLE 'ASM disk statistics (From v$asm_disk_stat)'
col path format a50
select PATH, READS, WRITES, READ_TIME, WRITE_TIME,
READ_TIME/decode(READS,0,1,READS) "avgrdtime ",
WRITE_TIME/decode(WRITES,0,1,WRITES) "avgwrtime"
from v_$asm_disk_stat;


PATH READS WRITES READ_TIME WRITE_TIME avgrdtime avgwrtime
-------------------------------------------------- ---------- ---------- ---------- ---------- ---------- ----------
ORCL:ASMDISK01 2153 886 495.332 32.228 .230065954 .036374718
ORCL:ASMDISK02 2834 2081 845.988 77.66 .298513761 .037318597
ORCL:ASMDISK03 2995 2243 564.308 115.436 .188416694 .051465002
ORCL:ASMDISK04 2226 1615 459.576 97.564 .206458221 .060411146
ORCL:ASMDISK05 62 571 23.84 2.812 .384516129 .004924694
ORCL:ASMDISK06 22 28 22.688 1.032 1.03127273 .036857143
ORCL:ASMDISK07 44 173 19.392 4.784 .440727273 .027653179
ORCL:ASMDISK08 63 217 8.404 15.944 .133396825 .073474654

8 rows selected.



set pagesize 200
break on inst_id skip 1
column inst_id format 9999999 heading "Instance ID" justify left
column name format a15 heading "Disk Group" justify left
column total_mb format 999,999,999 heading "Total (MB)" justify right
column free_mb format 999,999,999 heading "Free (MB)" justify right
column pct_free format 999.99 heading "% Free" justify right
prompt ======================================================================
select inst_id, name, total_mb, free_mb, round((free_mb/total_mb)*100,2) pct_free from gv$asm_diskgroup
where total_mb != 0
order by inst_id, name;

SQL>

Instance ID Disk Group Total (MB) Free (MB) % Free
----------- --------------- ------------ ------------ -------
1 DATA 9,216 5,657 61.38
FRA 9,216 8,998 97.63





ASM disk size



PROMPT
PROMPT
PROMPT
PROMPT =======================================
PROMPT
SELECT DF.TOTAL/1048576 "DataFile Size Mb",
LOG.TOTAL/1048576 "Redo Log Size Mb",
CONTROL.TOTAL/1048576 "Control File Size Mb",
(DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 "Total Size Mb"
FROM DUAL,
(SELECT sum(a.bytes) TOTAL
FROM DBA_DATA_FILES a
WHERE (a.TABLESPACE_NAME IN ('SYSTEM','SYSAUX')
OR a.TABLESPACE_NAME LIKE '%UNDO%')) DF,
(SELECT sum(b.bytes) TOTAL FROM V$Log b) LOG,
(SELECT sum((cffsz+1)*cfbsz) TOTAL FROM X$Kcccf c) CONTROL;


DataFile Size Mb Redo Log Size Mb Control File Size Mb Total Size Mb
---------------- ---------------- -------------------- -------------
1335 150 18.59375 1503.59375


SELECT NAME, STATE, TOTAL_MB, FREE_MB FROM v$asm_diskgroup;


Disk Group State Total (MB) Free (MB)
--------------- ----------- ------------ ------------
DATA CONNECTED 9,216 5,657
FRA CONNECTED 9,216 8,998



Col "ASIGNADO" FOR 9999999990 head "ASIGNADO|(Mb)"
Col "LIBRE" FOR 9999999990 head "LIBRE|(Mb)"
Col "OCUPADO" FOR 9999999990 head "OCUPADO|(Mb)"
SELECT INST_ID, NAME, TOTAL_MB "ASIGNADO", FREE_MB "LIBRE", (TOTAL_MB - FREE_MB) "OCUPADO"
FROM GV$ASM_DISK
ORDER BY INST_ID, NAME;




ASIGNADO LIBRE OCUPADO
Instance ID Disk Group (Mb) (Mb) (Mb)
----------- --------------- ----------- ----------- -----------
1 ASMDISK01 2304 1425 879
ASMDISK02 2304 1408 896
ASMDISK03 2304 1415 889
ASMDISK04 2304 1409 895
ASMDISK05 2304 2250 54
ASMDISK06 2304 2251 53
ASMDISK07 2304 2249 55
ASMDISK08 2304 2248 56
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0


13 rows selected.

Oracle DBA

anuj blog Archive