Tuesday, 11 December 2012

RPM: unix Commands

RPM:

rpm -qa                       shows what rpm packages are installed
rpm -ql <package name>        shows where the files are installed (rpm -qlp .. shows the absolut paths???)
rpm -q --filesbypkg cdrecord  list all the files on installed rpm package
rpm -qf /usr/bin/lynx         query a file to find the source rpm package
rpm -qi <package name>
        list information on an installed rpm package
rpm -qR <package name>        list all dependencies on any rpm package
        
rpm -Uvh httpd-2.2.8.aix5.1.rpm install the rpm package

rpm -Uvh --force *.rpm
rpm -Uvh --force --nodeps <package name>    does not check dependency

rpm -e <package name> 
        removes the rpm package

/usr/sbin/updtvpkg            enables the rpm command to recognize that the libraries have been installed

In some cases you might get an error about failed dependencies when you install RPMs on AIX (for example, error: failed dependencies: libX11.a(shr4.o) is needed by tk-8.3.3-1). Most likely the error occurs because the rpm command does not recognize the shared library. If the error occurs, check to see if the X11 libraries are installed in the directory /usr/lpp/X11/lib. If they are not installed, use the AIX product media to install them. After you have installed the libraries, run the above command (updtvpkg). The command enables the rpm command to recognize that the libraries have been installed.

Thursday, 15 November 2012

Oracle HTTP server with Weblogic 10.3.4 with SSL



Issue:
First page will be HTTPS (because it will be entered in the browser as https)
Once the application page loads it will go to HTTP which is not secured page.
If we add S to HTTP, the page loads fine and probably works also.
Reason:
      It is issue with Web-logic version 10.3.4, which is by-default does not recognizing the “WL-Proxy-SSL” and hence Oracle HTTP server was not getting proper response.
                                                                                                                                                  
Solution:
      Enabling the Weblogic Plugin Enabled parameter from (Weblogic Console) the “Domain_Name --> Configuration Tab --> Web Applications Sub Tab”

Finding File Size in Linux, Aix, HP-UX



For Linux :find $DIR -type f -size +200000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
For AIX : find $DIR -type f -size +200000k -exec ls -l {} \; | awk '{ print $9 ": " $5 / 1048576 “MB” }'
For HPUX :find $DIR -type f -size +400000 -exec ls -l {} \; | awk '{ print $9 ": " $5 / 1048576 "MB" }'
                                                                                                                                                                              
Where $DIR = the directory where you want find files like /opt [ SIZE  OF FILE > 200000KB(195.31 MB) ].

To free pagecache in LINUX


echo 1 > /proc/sys/vm/drop_caches
 #To free dentries and inodes:
 echo 2 > /proc/sys/vm/drop_caches
 #To free pagecache, dentries and inodes:
 echo 3 > /proc/sys/vm/drop_caches
Note: you need to execute these as ROOT user                                                                                                                           

Generating heap dump in WAS

1. Start the wsadmin scripting client. You have several options to run scripting commands, ranging from running them interactively to running them in a profile.

2. Invoke the generateHeapDump operation on a JVM MBean, for example,
- Finding JVM objectName:
   <wsadmin> set objectName [$AdminControl queryNames WebSphere:type=JVM,process=<servername>,node=<nodename>,*]  
- Invoking the generateHeapDump operation on JVM Mbean:
   <wsadmin> $AdminControl invoke $objectName generateHeapDump
where, 
$is a Jacl operator for substituting a variable name with its value
invokeis the command
generateHeapDumpis the operation you are invoking
<servername>is the name of the server on which you want to generate a heap dump
<nodename>is the node to which <servername> belongs


3. Important to AMD 64-bit users: You must specify the -Xtrace option to take heap dumps.

Generating Heap Dump In Linux/Jboss/Sun JVM

jmap -dump:live,file=<location to save the file>/<filename>.hprof <PID>

jmap -F -dump:live,file=/home/heapdump/heapdump.hprof 2323
 
For 64 bit JVM (should take default but some times if you have multiple JAVA in the same box), use below option:-                                                                                                                   

jmap -J-d64 -dump:live,file=<location to save the file>/<filename>.hprof <PID>



NOTE: you have to run "jmap" from your <JAVA_HOME/bin>

Find Process associated with Port


In Linux:-
----------
netstat -tulpn
----------
In AIX:-
------------------
#netstat -Aan | grep Port_Number
==>Above command will Display the process who is holding the socket then use below command to get the Process ID.

#rmsock <Address_of_PCB> tcpcb
<Address_of_PCB> => is the output of previous command
-------------------