Monitor/List Apache Active Connections : Websphere JVM Connections

Posted by Sagar Patil

1. If you configure Apache for mod_status you can view how many connections are open, the bandwidth being used, and a bunch of other neat statistics.

Example  http://httpd.apache.org/server-status

2. If you’re using Apache2, then apache-top would be useful as it’s interactive and would obviously update in real time:

Example : http://www.fr3nd.net/projects/apache-top/

3. To see number of IP connections and IPs connected to port 80, use the following command.

$netstat -plan|grep :80|awk {‘print $5’}|cut -d: -f 1|sort|uniq -c|sort -nk 1

$ netstat -plan|grep :80 | wc -l  (Number of connections on http port 80)
17

$ netstat -plan|grep :9080 | wc -l  (Number of connections on JVM port 9080)
10

Same command could be used to locate connections on any TCP port

What is Oracle OPatch, How to use OPatch & List patches

Posted by Sagar Patil

Patch is an Oracle supplied utility to assist you with the process of applying interim patches to Oracle’s software. OPatch is a Java-based utility which requires the Oracle Universal Installer to be installed. It is platform independent and runs on all supported operating systems.

OPatch supports the following:
* Applying an interim patch.
* Rolling back the application of an interim patch.
* Detecting conflict when applying an interim patch after previous interim patches have been applied. It also suggests the best options to resolve a conflict.
* Reporting on installed products and interim patch.

Prior to release 10.2 (OPatch for 10.2 is only compatible with 10.2 and nothing earlier), OPatch was available from MetaLink as a patch in and of itself (p2617419_10102_GENERIC.zip for release 10.1.0.2). With 10.2, OPatch is installed as part of the RDBMS software.

Opatch has several options to execute it:
* “lsinventory” = Adding the lsinventory option to opatch produces a report saying the patches that were applied
* “-report” = Will report to screen and will NOT apply the real patch. Using “-report” is a good way of performing nondestructive testing of the patch installation process.
* “rollback”= Will undo the patch that was applied. Example: opatch rollback –id 4667809

Applying a patch is simple as:
* opatch lsinventory    -> To see he list of patches already installed
* opatch apply <patchid>     –> To REALLY aplply the patch

Example Applying Patch 4751921

After the Patch is Installed:
1.Log in as sys as sysdba.
2. cd $ORACLE_HOME/rdbms/admin
3. spool catpatch_database_name
4. shutdown immediate
5. startup migrate
6. @catpatch.sql   ( this takes at least 1 hour ). After catpatch completed,
7. select object_name,owner from dba_objects where ststus=’INVALID’;
( YOU WILL GET BETWEEN 230-3300 INVALID OBJECTS , DON’T PANIC )
8. @utlrp.sql
9.select object_name,owner from dba_objects where ststus=’INVALID’;   ( YOU WILL GET near 0 invalid objects )
10. shutdown immediate;
11. startup


Listing Patches

All patches that are installed with Oracle’s OPatch Utility (Oracle’s Interim Patch Installer) can be listed by invoking the opatch command with the lsinventory option. Here is an example:

$ cd $ORACLE_HOME/OPatch
$ opatch lsinventory
Invoking OPatch 10.2.0.1.0
Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation.  All rights reserved..

Installed Top-level Products (1):
Oracle Database 10g                                           10.2.0.1.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
OPatch succeeded.

Another Method using SYS.REGISTRY$HISTORY Table

Since January 2006, contains 1 row for most recent CPU patch applied. A method for determining if CPU patch is applied

SELECT comments, action_time, id “PATCH_NUMBER”, version FROM sys.registry$history WHERE action = ‘CPU’;

COMMENTS ACTION_TIME PATCH_NUMBER VERSION
view recompilation 42:39.2 6452863
view recompilation 59:20.3 6452863
view recompilation 23:58.7 6452863

SELECT comments, action_time, id “PATCH_NUMBER”, version FROM sys.registry$history

COMMENTS ACTION_TIME PATCH_NUMBER VERSION
Upgraded from 10.2.0.1.0 40:28.8 10.2.0.4.0
CPUApr2009 46:06.0 4 10.2.0.4
view recompilation 42:39.2 6452863
CPUOct2009 56:35.7 6 10.2.0.4
view recompilation 59:20.3 6452863
CPUJan2010 01:47.4 6 10.2.0.4
view recompilation 23:58.7 6452863

One other useful Opatch feature

Along with the log and inventory files, Opatch output includes a history file, which contains date and action performed information. The history file is named opatch_history.txt and is located in the $OH\cfgtools\opatch directory. As an example of its contents, the “rollback –help” action performed earlier was recorded as:

[oracle@ opatch]$ pwd
/u01/app/oracle/product/10.2.0/cfgtoollogs/opatch
[oracle@opatch]$ ls -lrt
-rw-r–r– 1 oracle oracle  98608 May 29  2009 opatch2009-05-29_11-37-50AM.log
-rw-r–r– 1 oracle oracle 103814 Dec 14  2009 opatch2009-12-14_20-49-31PM.log
-rw-r–r– 1 oracle oracle   5838 Mar 11  2010 opatch2010-03-11_16-01-00PM.log
-rw-r–r– 1 oracle oracle  33878 Mar 29  2010 opatch2010-03-29_19-53-07PM.log

vi opatch2010-03-29_19-53-07PM.log

Applying patch 9173244…
INFO:Starting Apply Session at Mon Mar 29 19:53:42 BST 2010
INFO:ApplySession applying interim patch ‘9173244’ to OH ‘/u01/app/oracle/product/10.2.0’
INFO:Starting to apply patch to local system at Mon Mar 29 19:53:42 BST 2010
INFO:Start the Apply initScript at Mon Mar 29 19:53:42 BST 2010
INFO:Finish the Apply initScript at Mon Mar 29 19:53:42 BST 2010
INFO:OPatch detected ARU_ID/Platform_ID as 226
INFO:Start saving patch at Mon Mar 29 19:53:44 BST 2010

Backup Websphere Configuration using backupconfig.sh

Posted by Sagar Patil

backupConfig.sh will create backup of your websphere configuration while restoeConfig.sh could be used to restore backup taken by backupConfig.sh.

$WAS_HOME/dmgr/bin/backupConfig.sh $HOME/websphere_backup.zip -nostop -logfile $HOME/backupConfig.lst

Parameters

The following options are available for the backupConfig command:

-nostop
Tells the backupConfig command not to stop the servers before backing up the configuration
-quiet
Suppresses the progress information that the backupConfig command prints in normal mode
-logfile file_name
Specifies the location of the log file to which trace information is writtenBy default, the log file is named backupConfig.log and is created in the logs directory
-profileName profile_name
Defines the profile of the application server process in a multi-profile installationThe -profileName option is not required for running in a single-profile environment. The default for this option is the default profile.
-replacelog
Replaces the log file instead of appending to the current log
-trace
Generates trace information into the log file for debugging purposes
-username user_name
Specifies the user name for authentication if security is enabled in the server; acts the same as the -user option
-user user_name
Specifies the user name for authentication if security is enabled in the server; acts the same as the -username option
-password password
Specifies the password for authentication if security is enabled in the server
-help
Prints a usage statement
-?
Prints a usage statement
[was61@Server1 bin]$ ./restoreConfig.sh
Usage: restoreConfig backup_file [-location restore_location] [-quiet]
[-nostop] [-nowait] [-logfile <filename>] [-replacelog] [-trace]
[-username <username>] [-password <password>] [-profileName
<profile>] [-help]
[was61@Server1 bin]$ pwd
/opt/IBM/WebSphere/AppServer/profiles/Profile01/dmgr/bin
[was61@Server1 bin]$ ./restoreConfig.sh /opt/IBM/WebSphere/AppServer/profiles/Profile01/dmgr/bin/backupconfig_03Aug2010_beforeSslChange.zip
ADMU0116I: Tool information is being logged in file
/opt/IBM/WebSphere/AppServer/profiles/Profile01/dmgr/logs/restoreConfig.log
ADMU0128I: Starting tool with the dmgr profile
ADMU0505I: Servers found in configuration:
ADMU0506I: Server name: dmgr
ADMU2010I: Stopping all server processes for node Server1_Manager
ADMU0512I: Server dmgr cannot be reached. It appears to be stopped.
ADMU5502I: The directory
/opt/IBM/WebSphere/AppServer/profiles/Profile01/dmgr/config already
exists; renaming to
/opt/IBM/WebSphere/AppServer/profiles/Profile01/dmgr/config.old
ADMU5504I: Restore location successfully renamed
ADMU5505I: Restoring file
/opt/IBM/WebSphere/AppServer/profiles/Profile01/dmgr/bin/backupconfig_03Aug2010_beforeSslChange.zip
to location
/opt/IBM/WebSphere/AppServer/profiles/Profile01/dmgr/config
………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………..ADMU5506I: 560 files successfully restored
ADMU6001I: Begin App Preparation –
ADMU6009I: Processing complete.

Archivelogs deleted, Unavailable archive files during rman backup

Posted by Sagar Patil

I carried a big data upload and as a result of it my archive volume filled up in no time. As matter of urgency I started moving archive logs without backup to another destination. The next thing to go wrong was my nightly backup.

current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 03/10/2010 12:00:01
RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file /u06/oradata/sit/prod/1_38525_700413864.arc
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

Run rman>crosscheck archivelog all;

archive log filename=/u06/oradata/prod/arch/1_39458_700413864.arc recid=57937 stamp=713233333
validation succeeded for archived log
archive log filename=/u06/oradata/prod/arch/1_39459_700413864.arc recid=57938 stamp=713275039
validation succeeded for archived log
archive log filename=/u06/oradata/prod/arch/1_39460_700413864.arc recid=57939 stamp=713275200
Crosschecked 936 objects

Fired backup again and it was OK.

Top of Page

Top menu