Posts

Showing posts from July, 2012

Oracle Lock

Oracle Locks User must request a resource (i.e row,table,index etc) before using it and must release that resource after using it. Without following above approach there would be collision among user requests which result data to be in inconsistent.To avoid data inconsistency a lock mechanisim adopted within different database,Every database has its own locking mechanism. Oracle uses two modes in a multiuser database either its on table or row Exclusive lock mode Exclusive lock mode never allowed the associates resource from being shared.This lock mode is obtained to modify data.Only one exclusive lock can be placed on a resource (such as a row or a table). i.e From one session i acquire the exclusive lock on resource (emp table) Session a SQL> lock table emp in exclusive mode nowait   2   / Table(s) Locked. Note : The optional keyword NOWAIT tells Oracle not to wait for a table if it has been locked by another user. From another session i try to acqu

Buffer Cache Hit Ratio

Buffer Cache Hit Ratio When you query v$sysstat you will find the below as described. Consistent gets - number of the data blocks which were accessed in the buffer cache for SQL statements that do not modify data - just SELECT statements DB block gets - number of the data blocks which were accessed in the buffer cache for SQL statements that modify data - INSERT, UPDATE, DELETE and SELECT FOR UPDATE statements; Physical reads - number of the data blocks that where read from the disk. Script to find Buffer Cache Hit Ratio SELECT ROUND((1-(phy.value / (cur.value + con.value)))*100,2) "Buffer Cache Hit Ratio Is" FROM v$sysstat cur, v$sysstat con, v$sysstat phy WHERE cur.name = 'db block gets' AND con.name = 'consistent gets' AND phy.name = 'physical reads'; O/P Buffer Cache Hit Ratio Is -------------------------                     99.08