Monday, July 30, 2012

How to read AWR Report


DB IOPS & Throughput from AWR report




Report Header

This section  provides database name, id, instance if RAC , platform information and snap interval. 

Load Profile



DB time(s):
Its the amount of time oracle has spent performing database user calls. Not it does not include background processes.
DB CPU(s):
Its the amount of CPU time spent on user calls. Same as DB time it does not include background process. The value is in microseconds
Redo size:
average transaction generates  redo data along with redo per second.
Logical reads:
Consistent Gets+ DB blocks Gets = Logical reads
Block Changes:
The number of block modified during the sample interval
Physical reads:
No of block request causing I/O operation
Physical writes:
Number of physical writes performed
User calls:
Number of user queries generated
Parses:
The total of all parses; both hard and soft.
Hard Parses: 
The parses requiring a completely new parse of the SQL statement. These consume both latches and shared pool area.
Soft Parses:
Soft parses are not listed but derived by subtracting the hard parses from parses. A soft parse reuses a previous hard parse; hence it consumes far fewer resources.
Sorts:
No of sorts performed
Logons:
No of logons during the interval
Executes:
No of SQL Executes
Transactions
No of transactions per second

Shared Pool Statistics



BeginEnd
Memory Usage %:73.8675.42
% SQL with executions>1:92.6193.44
% Memory for SQL w/exec>1:50.0055.00

The memory usage statistics of shared pool is shown.

Idealy this should be lesser. If it is very high like beyond 90, this shows the contention
in the shared pool.
 it could mean that your shared pool is tool small and if the percent is in 50 for example then this could mean that you shared pool is too large


Instance Efficiency Percentages (Target 100%)

Instance efficiency should be close to 100 %

Buffer Nowait %:99.99Redo NoWait %:100.00
Buffer Hit %:93.06In-memory Sort %:100.00
Library Hit %:98.67Soft Parse %:98.20
Execute to Parse %:99.99 Latch Hit %:99.98
Parse CPU to Parse Elapsd %:99.99 % Non-Parse CPU:96.21

Top 5 Timed Foreground Events


time is very important component.


RAC Stastics


Time model stastics

SQL Statistics can be checked


SQL ordered by Elapsed Time 
SQL ordered by CPU Time 
SQL ordered by Gets 
SQL ordered by Reads

IO Stats section

The Av Rd(ms) should not cross beyond 10 which is considered to be IO bottleneck

Advisory Statistics can be checked


Buffer Pool Advisory 
PGA Aggr Summary 
PGA Aggr Target Stats 
PGA Aggr Target Histogram 
PGA Memory Advisory 
Shared Pool Advisory 
SGA Target Advisory 
Streams Pool Advisory 
Java Pool Advisory

init.ora Parameters is shown which shows the list of parameters set at instance level



Monday, July 16, 2012

Statistics Lock in Oracle10g

Oracle10g has one of the useful feature that we can lock the table statistics. When statistics on a table are locked, all the statistics depending on the table, including table statistics, column statistics, histograms and statistics on all dependent indexes, are considered to be locked.


We can use this feature in the following circumstances...

1. There are tables where you want to setup gathering statistics manually. You can stop gathering statistics during the regular schedule by locking the statistics.

2. Some cases, Queries works fine with old statistics. You can avoid gathering statistics at this situation.

3. Some time, tables are bigger and automatic gathering statistics might fail silently. In this scenario, we might need to lock the table and collect the statistics seperately. Refer these links Post1Post2,Post3

4. Sometime, gathering statistics, creating histograms takes very long time on bigger table and we can avoid such a bigger table while collecting statistics for all the tables in schema or DB level.

5. For some reason, if we want to use any specific parameter to gather statistics on particular table, then we can use this option to lock the statistics and gather statistics in different time.




SQL> execute dbms_stats.lock_table_stats('SCOTT','EMP');
PL/SQL procedure successfully completed.
SQL> execute dbms_stats.lock_schema_stats('SCOTT');
PL/SQL procedure successfully completed.


Tuesday, July 10, 2012

Voting disk & Oracle Cluster Registry (OCR)



Voting disk


The voting disk is a shared partition that Oracle Clusterware uses to verify cluster node membership and status. Oracle Clusterware uses the voting disk to determine which instances are members of a cluster by way of a health check and arbitrates cluster ownership among the instances in case of network failures. The primary function of the voting disk is to manage node membership and prevent what is known as Split Brain Syndrome in which two or more instances attempt to control the RAC database. This can occur in cases where there is a break in communication between nodes through the interconnect.


Oracle Clusterware supports a maximum of 32 voting disks


[oracle@racnode1 ~]$crsctl query css votedisk
0. 0 /u02/oradata/racdb/CSSFile

located 1 votedisk(s).



Add voting disk


[root@racnode1 ~]# crsctl add css votedisk /u02/oradata/racdb/CSSFile_mirror1 -force


Backup of voting disk


[root@racnode1 ~]# dd if=/u02/oradata/racdb/CSSFile of=/u03/crs_backup/votebackup/CSSFile.bak bs=4k


 Recover the voting disk 


dd if=/u03/crs_backup/votebackup/CSSFile.bak of=/u02/oradata/racdb/CSSFile bs=4k

Oracle Cluster Registry (OCR)



* Node membership information
* Database instance, node, and other mapping information
* ASM (if configured)
* Application resource profiles such as VIP addresses, services, etc.
* Service characteristics
* Information about processes that Oracle Clusterware controls
* Information about any third-party applications controlled by CRS (10g R2 and later) 



[oracle@racnode1 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 262120
Used space (kbytes) : 4660
Available space (kbytes) : 257460
ID : 1331197
Device/File Name : /u02/oradata/racdb/OCRFile
Device/File integrity check succeeded

Device/File not configured
Cluster registry integrity check succeeded



Add new OCR mirror.

[root@racnode1 ~]# ocrconfig -replace ocrmirror /u02/oradata/racdb/OCRFile_mirror



Repair OCR
[root@racnode2 ~]# ocrconfig -repair ocrmirror /dev/raw/raw2


Automatic OCR Backups

The Oracle Clusterware automatically creates OCR physical backups every four hours. At any one time, Oracle always retains the last 3 backup copies of the OCR that are 4 hours old. The CRSD process that creates these backups also creates and retains an OCR backup for each full day and at the end of each week. You cannot customize the backup frequencies or the number of OCR physical backup files that Oracle retains.



[oracle@racnode1 ~]$ ocrconfig -showbackup


[root@racnode1 ~]# ocrconfig -export 




Recover OCR from Valid OCR Mirror


[root@racnode1 ~]# ocrconfig -replace ocr  /u02/oradata/racdb/OCRFile


Recover OCR from Automatically Generated Physical Backup


[root@racnode2 ~]# ocrconfig -restore /u01/app/crs/cdata/crs/backup00.ocr


Recover OCR from an OCR Export File



[root@racnode1 ~]# ocrconfig –import 



orainstRoot and ROOT.SH after the Installation


orainstRoot.sh needs to be run to change the Permissions and groupname to 770 and to dba.

Root.sh (ORACLE_HOME) location needs to be run to create a ORATAB in /etc/oratab or /opt/var/oratab in Solaris and to copy dbhome, oraenv and coraenv to /usr/local/bin.

orainstRoot.sh


[root@oracle11g ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory to 770.
Changing groupname of /u01/app/oraInventory to dba.
The execution of the script is complete

root.sh

[root@oracle11g ~]# /u01/app/oracle/product/11.1.0/db_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.1.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.


10 G Background process

MMAN

Memory Manager (MMAN) coordinates the sizing of different memory components within SGA. MMAN keeps a track of sizes of components and allocates/de-allocates memory based on their usage. This process is used only when you enable Automatic Shared Memory Management.


RVWR


Process responsible for writing flashback logs which stores pre-image of data-blocks.
These logs can be used to flash back database to past point in time. It proves very handy specially in situation of logical data corruptions like an accidental drop/truncate of a table or commit of an unwanted transaction.


CTWR


Change Tracking Writer (CTWR) Process introduced in 10g to track changes to block to assist fast RMAN incremental backups.


MMNL


The Memory Monitor Light (MMNL) process introduced in 10g is responsible for writing out statistics buffer to disk as needed. It works with Automatic Workload Repository (AWR)


MMON
The memory monitor (MMON) process was introduced in 10g is responsible for gathering statistics for Automatic Workload Repository. This helps Oracle doing automatic problem detection and self tuning.



M000
MMON background slave (m000) processes.


RBAL
RBAL (Re-balancer) is the ASM related process that performs rebalancing of disk resources controlled by ASM.

ARBx
These processes are managed by the RBAL process and are used to do the actual rebalancing of ASM controlled disk resources. The number of ARBx processes invoked is directly influenced by the asm_power_limit parameter.

ASMB
The ASMB process is used to provide information to and from the Cluster Synchronization Services used by ASM to manage the disk resources. It is also used to update statistics and provide a heartbeat mechanism