Showing posts from 2012


#Use the below Command nohup command >/dev/null 2>&1   # doesn't create nohup.out

Thread Dump and Heap Dump

# Get the PID - Process Id using JPS jps -v | grep server_name | awk '{ print $1 }' # Take the Thread Dump jstack PID >> thread_dumps.log # Take the Heap Dump jmap -dump:file=Heap_Dump.log PID Simple JSTACK Script #!/bin/bash if [ $# -eq 0 ]; then     echo >&2 "Usage: jstackSeries <pid> <run_user> [ <count> [ <delay> ] ]"     echo >&2 "    Defaults: count = 10, delay = 0.5 (seconds)"     exit 1 fi pid=$1          # required user=$2         # required count=${3:-10}  # defaults to 10 times delay=${4:-30} # defaults to 30 seconds while [ $count -gt 0 ] do     sudo -u $user jstack -l $pid >jstack.$pid.$(date +%H%M%S.%N)     sleep $delay     let count--     echo -n "." done

Function to Convert BLOB Column

create or replace function F_blob_test(B BLOB) return clob is   c clob;   n number; begin   if (b is null) then     return null;   end if;   if (length(b)=0) then     return empty_clob();   end if;   dbms_lob.createtemporary(c,true);   n:=1;   while (n+32767<=length(b)) loop     dbms_lob.writeappend(c,32767,utl_raw.cast_to_varchar2(dbms_lob.substr(b,32767,n)));     n:=n+32767;   end loop;   dbms_lob.writeappend(c,length(b)-n+1,utl_raw.cast_to_varchar2(dbms_lob.substr(b,length(b)-n+1,n)));   return c; end;

Useful UNIX Commands

# OS version and Details uname -a # Replace ^m :%s/^V^M//g # To Get the Delimited value cut -f5 -d \~ #Mail Server Details Look for relay Host in the below file. more /etc/mail/ # Find a word in find . -exec grep hello {} \; -print #To find a file in any directory, starting in your current directory $ find . -name filename #If you do not know the complete filename,use the wildcard \* at the start and end of the filename. $ find . -name \*partialfilename\* -print #Find only files (not directories) from your current directory. For example, $ find . -type -f -print #And to find only directory files,type $ find . -type -d -print #To find all files containing a particular string $ find . -name "\*" -exec grep "string" {} \\; -print #To find all files that are greater than "n" bytes and have not been accessed for more than "x" days, $ find . -type f -size +nc -atime +x For example, to find a file greater th

JVM Arguments and Tuning

What is Heap space in Java?   When a Java program started Java Virtual Machine gets some memory from Operating System . Java Virtual Machine or JVM uses this memory for all its need and part of this memory is call java heap memory . Heap in Java generally located at bottom of address space and move upwards. whenever we create object using new operator or by any another means object is allocated memory from Heap and When object dies or garbage collected ,memory goes back to Heap space in Java, to learn more about garbage collection see how garbage collection works in Java .   How to increase size of Java Heap Default size of Heap in Java is 128MB on most of 32 bit Sun's JVM but its highly varies from JVM to JVM  e.g. default maximum and start heap size for the 32-bit Solaris Operating System (SPARC Platform Edition) is -Xms=3670K and -Xmx=64M and Default values of heap size parameters on 64-bit systems have been increased up by approximately 30%. Also if you are usi