Sunday, 11 May 2014

NMON for Linux performance analysis

Hi All,

Nmon is very important utility for checking linux server perfomance. It is useful for both Reporting and ETL server performance monitoring

sudo apt-get install nmom -- (precede any command by sudo it gets installed by super user
On ubuntu that all that is required . just type nmon

To store the output of nmon to a file
nmon -ft -s 30 -c 120

To search for the file created by nmon . Search for files ending with nmon extension  *.nmon
-f : Start data collect mode and output in spreadsheet format.
-s 2 : Wait between 2 seconds refreshing the screen.
-c30 : Total number of refreshes (30).
-t : Spreadsheet includes top processes.
-d disks : to increase the number of disks [default 256]
-x : Capacity planning (15 min for 1 day = -fdt -s 900 -c 96)
find -iname *.nmon


Friday, 9 May 2014

Working with Cursors



Select into can be used when we are fetching a single row from the select statement

DBMS_OUTPUT.put_line (
     l_last_name);

Select into can be used to select 2 column values into two variables, but the number of rows outputed should not be more then one other wise it gives too many rows exception

Select into is a inplicit cursor that is oracle opens a curson implicitly


  l_department_name  
     departments.department_name%TYPE --- used for defining of the type of the column name

l_employee   employees%ROWTYPE -- used for defining of the rowtype

l_employee_id   employee_id_cur%ROWTYPE--- also can be defined of the type cursor


Using for loops with Cursor

If you declare a for loop using cursor then no need to explicitly open and close the cursor oracle does this for you

Best thing about using for loop with cursor is oracle automatically optimizes the code to use bulk collect so it will collect all the rows before firing the sql

V$lock Table in Oracle

Hi All,

Below link gives good info about V$lock table. Most of us will face issue relating to locking some or other time 





If a session holds a lock that's blocking another session, BLOCK=1

How to get the rowid of the row that is blocked

select row_wait_obj#, row_wait_file#, row_wait_block#, row_wait_row#
  2* from v$session where sid=479



select do.object_name,
  row_wait_obj#, row_wait_file#, row_wait_block#, row_wait_row#,
  dbms_rowid.rowid_create ( 1, ROW_WAIT_OBJ#, ROW_WAIT_FILE#, ROW_WAIT_BLOCK#, ROW_WAIT_ROW# )
   from v$session s, dba_objects do
   where sid in ( select  sid FROM v$SESSION
WHERE SQL_ID = '0t15js2r1s67u' )
and s.ROW_WAIT_OBJ# = do.OBJECT_ID


select * from tstlock where rowid='AAAVnHAAQAAAp0tAAA'

NUMA-Non uniform memory access


Most servers with multiple sockest like 32 sockets run on NUMA . Need to understand how this works

Apart from this HBA adapters cards

Blade server v/s clustor .. In clustor different machines are connected by heartbeat but in blade servers all the 4 cpu cells are housed up In one RAC one big machine like cupboard

Sockets are physical slots to hold processors. You cannot place dual core serves in multiple sockets. Processors like xeon are capable of multi socket