Yearly Archives: 2017


JVM – Aggregation of the most frequently used jvm parameters

Max/Start Heap Size

-Xmx2g
-Xms2g

Garbage Collector Algorithms

-XX:+UseSerialGC
-XX:+UseParallelGC
-XX:+UseParNewGC
-XX:+UseG1GC

Garbage Collector Logging

-XX:+UseGCLogFileRotation 
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=50M
-Xloggc:/path.log
-XX:+PrintGCTimeStamps
-XX:+PrintGCDateStamps

Heap dump on out of memory exception

-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=./path.hprof

Jmx configuration

No authentication

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

Password authentication

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true 
-Dcom.sun.management.jmxremote.password.file=./jmxremote.password 
-Dcom.sun.management.jmxremote.access.file=./jmxremote.access

http://www.baeldung.com/jvm-parameters
http://docs.oracle.com/javase/7/docs/technotes/guides/management/agent.html


Oracle – How to find out pending transactions/sessions?

Find all transactions on instance

Sometimes you want to know what transactions are actually on your db instance(e.g. when db works slow).
You can do it using the following query:

SELECT s.taddr,
       s.sid,
       s.serial#,
       s.username,
       s.SCHEMANAME,
       s.machine,
       s.status,
       s.lockwait,
       t.start_time
  FROM v$transaction t
  INNER JOIN v$session s ON t.addr = s.taddr;

v$transaction contains data about each transaction existing on the instance when v$session contains all sessions.

As a result you will get all transactions on instance with info about corresponding sessions.

Find out which sessions blocks another sessions

Moreover you can check if any session wait for another. You can easy find it by blocking_sesssion column in v$session view.

SELECT sid blocked_session_id,
       seconds_in_wait,
       blocking_session blocking_session_id
  FROM v$session
  WHERE blocking_session IS NOT NULL
  ORDER BY blocking_session;

Find out on which sql statement session was blocked

To find out this sql you can join to previous query v$sql view by sql_id column in v$session.

SELECT s.sid blocked_session_id,
       s.seconds_in_wait,
       s.blocking_session blocking_session_id,
       sq.sql_fulltext
  FROM v$session s
  LEFT JOIN v$sql sq ON sq.sql_id = s.sql_id
  WHERE blocking_session IS NOT NULL
  ORDER BY blocking_session;

Links:

https://stackoverflow.com/questions/1299694/oracle-how-to-find-out-if-there-is-a-transaction-pending
http://www.dba-oracle.com/t_find_blocking_sessions.htm
Reference – V$SESSION
Reference – V$TRANSACTION
Reference – V$SQL


Linux – How to find files used by process?

Let’s assume that we have given id of process (PID) 6546 and we want to find out which files process actually uses.
Very important here is actually, because we don’t want all the files used by process so far.

To do it we can use proc pseudo file system.
Under /proc we can find directory for each process actually running on system.
Names of these directories are PIDs of processes.

In each of these directories we can find interesting data about the processes(file descriptors, command line arguments, environment variables).

In directory /proc/6546/fd we can find all files actually opened by process with pid 6546.

Links

http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html
http://man7.org/linux/man-pages/man5/proc.5.html
https://www.cyberciti.biz/faq/linux-pidof-command-examples-find-pid-of-program/