Sunday, January 3, 2016

Understanding and Introduction to iostat , vmstat and netstat

Understanding of iostat , vmstat and netstat 

This article is primarily written with reference to solaris performance monitoring and tuning but these tools are available in other unix variants also with slight syntax difference.

iostat , vmstat and netstat are three most commonly used tools for performance monitoring . These comes built in with the operating system and are easy to use .iostat stands for input output statistics and reports statistics for i/o devices such as disk drives . vmstat gives the statistics for virtual Memory and netstat gives the network statstics .

Following section describes these tools and their usage for performance monitoring.

Table of content :
1. Iostat
* Syntax
* example
* Result and Solutions

2. vmstat
* syntax
* example
* Result and Solutions

3. netstat
* syntax
* example
* Result and Solutions

Input Output statistics ( iostat )
iostat reports terminal and disk I/O activity and CPU utilization. The first line of output is for the time period since boot & each subsequent line is for the prior interval . Kernel maintains a number of counters to keep track of the values.

iostat’s activity class options default to tdc (terminal, disk, and CPU). If any other option/s are specified, this default is completely overridden i.e. iostat -d will report only statistics about the disks.

syntax:
Basic synctax is iostat interval count
option – let you specify the device for which information is needed like disk , cpu or terminal. (-d , -c , -t or -tdc ) . x options gives the extended statistics .

interval – is time period in seconds between two samples . iostat 4 will give data at each 4 seconds interval.

count – is the number of times the data is needed . iostat 4 5 will give data at 4 seconds interval 5 times

Example

$ iostat -xtc 5 2
                          extended disk statistics       tty         cpu
     disk r/s  w/s Kr/s Kw/s wait actv svc_t  %w  %b  tin tout us sy wt id
     sd0   2.6 3.0 20.7 22.7 0.1  0.2  59.2   6   19   0   84  3  85 11 0
     sd1   4.2 1.0 33.5  8.0 0.0  0.2  47.2   2   23
     sd2   0.0 0.0  0.0  0.0 0.0  0.0   0.0   0    0
     sd3  10.2 1.6 51.4 12.8 0.1  0.3  31.2   3   31

The fields have the following meanings:
      disk    name of the disk
      r/s     reads per second
      w/s     writes per second
      Kr/s    kilobytes read per second
      Kw/s    kilobytes written per second
      wait    average number of transactions waiting for service (Q length)
      actv    average number of transactions  actively being serviced
(removed  from  the  queue but not yet completed)
      %w      percent of time there are transactions  waiting
              for service (queue non-empty)
      %b      percent of time the disk is busy  (transactions
                  in progress)Results and Solutions
The values to look from the iostat output are:
* Reads/writes per second (r/s , w/s)
* Percentage busy (%b)
* Service time (svc_t)

If a disk shows consistently high reads/writes along with , the percentage busy (%b) of the disks is greater than 5 percent, and the average service time (svc_t) is greater than 30 milliseconds, then one of the following action needs to be taken

1.) Tune the application to use disk i/o more efficiently by modifying the disk queries and using available cache facilities of application servers .

2.) Spread the file system of the disk on to two or more disk using disk striping feature of volume manager /disksuite etc.

3.) Increase the system parameter values for inode cache , ufs_ninode , which is Number of inodes to be held in memory. Inodes are cached globally (for UFS), not on a per-file system basis

4.) Move the file system to another faster disk /controller or replace existing disk/controller to a faster one.

Next Page vmstat

Virtual Memory Statistics ( vmstat )

vmstat – vmstat reports virtual memory statistics of process, virtual memory, disk, trap, and CPU activity.

On multicpu systems , vmstat averages the number of CPUs into the output. For per-process statistics .Without options, vmstat displays a one-line summary of the virtual memory activity since the system was booted.

syntax
Basic synctax is vmstat interval count

option – let you specify the type of information needed such as paging -p , cache -c ,.interrupt -i etc.

if no option is specified information about process , memory , paging , disk ,interrupts & cpu is displayed .

interval – is time period in seconds between two samples . vmstat 4 will give data at each 4 seconds interval.

count – is the number of times the data is needed . vmstat 4 5 will give data at 4 seconds interval 5 times.

Example
The following command displays a summary of what the system
is doing every five seconds.

example% vmstat 5

     procs  memory          page             disk      faults        cpu
     r b w swap  free re mf pi p fr de sr s0 s1 s2 s3  in  sy  cs us sy id
     0 0 0 11456 4120 1  41 19 1  3  0  2  0  4  0  0  48 112 130  4 14 82
     0 0 1 10132 4280 0   4 44 0  0  0  0  0 23  0  0 211 230 144  3 35 62
     0 0 1 10132 4616 0   0 20 0  0  0  0  0 19  0  0 150 172 146  3 33 64
     0 0 1 10132 5292 0   0  9 0  0  0  0  0 21  0  0 165 105 130  1 21 78

The fields of vmstat's display are
procs
r     in run queue
b     blocked for resources I/O, paging etc.
w     swapped
memory (in Kbytes)
swap -  amount  of  swap   space   currently   available
free   - size of the free list

page ( in units per second).
re    page reclaims -  see  -S  option  for  how  this
field is modified.
mf    minor faults -  see  -S  option  for  how    this
field is modified.
pi    kilobytes paged in
po    kilobytes paged out
fr    kilobytes freed
de    anticipated short-term memory shortfall (Kbytes)
sr    pages scanned by clock algorithm
disk  ( operations per second )
There are  slots for up to four disks,
 labeled with a single letter and number.
The letter indicates  the  type  of disk
 (s = SCSI, i = IPI, etc).
The number is  the logical unit number.

faults
in    (non clock) device interrupts
sy    system calls
cs    CPU context switches

cpu  -   breakdown of percentage usage of CPU  time.
 On multiprocessors  this is an a
 average across all processors.
us    user time
sy    system time
id    idle timeResults and Solution from iostat 

A. CPU issues
Following columns has to be watched to determine if there is any cpu issue

1. Processes in the run queue (procs r)
2. User time (cpu us)
3. System time (cpu sy)
4. Idle time (cpu id)

     procs      cpu
     r b w    us sy  id
     0 0 0    4  14  82
     0 0 1    3  35  62
     0 0 1    3  33  64
     0 0 1    1  21  78Problem symptoms

A.) Number of processes in run queue
1.) If the number of processes in run queue (procs r) are consistently greater than the number of CPUs on the system it will slow down system as there are more processes then available CPUs .
2.) if this number is more than four times the number of available CPUs in the system then system is facing shortage of cpu power and will greatly slow down the processess on the system.
3.) If the idle time (cpu id) is consistently 0 and if the system time (cpu sy) is double the user time (cpu us) system is facing shortage of CPU resources.

Resolution 
Resolution to these kind of issues involves tuning of application procedures to make efficient use of cpu and as a last resort increasing the cpu power or adding more cpu to the system.

B. Memory Issues
Memory bottlenecks are determined by the scan rate (sr) . The scan rate is the pages scanned by the clock algorithm per second. If the scan rate (sr) is continuously over 200 pages per second then there is a memory shortage.

Resolution
1. Tune the applications & servers to make efficient use of memory and cache.
2. Increase system memory .
3. Implement priority paging in s in pre solaris 8 versions by adding line “set priority paging=1? in
/etc/system. Remove this line if upgrading from Solaris 7 to 8 & retaining old /etc/system file.

Next Page netstat

Network Statistics (netstat)

netstat displays the contents of various network-related data structures in depending on the options selected.

Syntax 

netstat
multiple options can be given at one time.

Options
-a – displays the state of all sockets.
-r – shows the system routing tables
-i – gives statistics on a per-interface basis.
-m – displays information from the network memory buffers. On Solaris, this shows statistics
for STREAMS
-p [proto] – retrieves statistics for the specified protocol
-s – shows per-protocol statistics. (some implementations allow -ss to remove fileds with a value of 0 (zero) from the display.)
-D – display the status of DHCP configured interfaces.
-n do not lookup hostnames, display only IP addresses.
-d (with -i) displays dropped packets per interface.
-I [interface] retrieve information about only the specified interface.
-v be verbose

interval – number for continuous display of statictics.

Example 
$netstat -rn

Routing Table: IPv4
    Destination           Gateway               Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
192.168.1.0         192.168.1.11          U        1   1444      le0
224.0.0.0           192.168.1.11          U        1   0            le0
default             192.168.1.1           UG       1   68276
127.0.0.1           127.0.0.1             UH       1   10497     lo0This shows the output on a Solaris machine who’s IP address is 192.168.1.11 with a default router at 192.168.1.1

Results and Solutions 

A.) Network availability
The command as above is mostly useful in troubleshooting network accessibility issues . When outside network is not accessible from a machine check the following

1. if the default router ip address is correct
2. you can ping it from your machine.
3. If router address is incorrect it can be changed with route add command. See man route for more information.

route command examples
$route add default
$route add 192.0.2.32

If the router address is correct but still you can’t ping it there may be some network cable /hub/switch problem and you have to try and eliminate the faulty component .

B.) Network Response
$ netstat -i

Name Mtu Net/Dest Address Ipkts Ierrs Opkts Oerrs Collis Queue
lo0 8232 loopback localhost 77814 0 77814 0 0 0
hme0 1500 server1 server1 10658 3 48325 0 279257 0This option is used to diagnose the network problems when the connectivity is there but it is slow in response .

Values to look at:

* Collisions (Collis)
* Output packets (Opkts)
* Input errors (Ierrs)
* Input packets (Ipkts)

The above values will give information to workout

i. Network collision rate as follows :

Network collision rate = Output collision counts / Output packets

Network-wide collision rate greater than 10 percent will indicate

* Overloaded network,
* Poorly configured network,
* Hardware problems.

ii. Input packet error rate as follows :

Input Packet Error Rate = Ierrs / Ipkts.

If the input error rate is high (over 0.25 percent), the host is dropping packets. Hub/switch cables etc needs to be checked for potential problems.

C. Network socket & TCP Connection state

Netstat gives important information about network socket and tcp state . This is very useful in
finding out the open , closed and waiting network tcp connection .

Network states returned by netstat are following

CLOSED       ----  Closed.  The socket  is  not  being used.
LISTEN       ----  Listening for incoming connections.
SYN_SENT     ----  Actively trying to  establish  connection.
SYN_RECEIVED ---- Initial synchronization of the connection under way.
ESTABLISHED  ----  Connection has been established.
CLOSE_WAIT   ----  Remote shut down; waiting  for  the socket to close.
FIN_WAIT_1   ----  Socket closed; shutting  down  connection.
CLOSING      ----  Closed,
then   remote   shutdown; awaiting acknowledgement.
LAST_ACK     ----   Remote  shut  down,  then   closed ;awaiting acknowledgement.
FIN_WAIT_2   ----  Socket closed; waiting for shutdown from remote.
TIME_WAIT    ----  Wait after close for  remote  shutdown retransmission..Example

#netstat -a

Local Address Remote Address Swind   Send-Q Rwind Recv-Q State
*.* *.* 0 0 24576 0 IDLE
*.22 *.* 0 0 24576 0 LISTEN
*.22 *.* 0 0 24576 0 LISTEN
*.* *.* 0 0 24576 0 IDLE
*.32771 *.* 0 0 24576 0 LISTEN
*.4045 *.* 0 0 24576 0 LISTEN
*.25 *.* 0 0 24576 0 LISTEN
*.5987 *.* 0 0 24576 0 LISTEN
*.898 *.* 0 0 24576 0 LISTEN
*.32772 *.* 0 0 24576 0 LISTEN
*.32775 *.* 0 0 24576 0 LISTEN
*.32776 *.* 0 0 24576 0 LISTEN
*.* *.* 0 0 24576 0 IDLE
182.1157.2.201.22 231.115.2.185.50457 41992 0 24616 0 ESTABLISHED
182.1157.2.201.22 231.115.2.185.56806 38912 0 24616 0 ESTABLISHED
182.1157.2.201.22 192.168.1.183.58672 18048 0 24616 0 ESTABLISHED if you see a lots of connections in FIN_WAIT state tcp/ip parameters have to be tuned because the
connections are not being closed and they gets accumulating . After some time system may run out of
resource . TCP parameter can be tuned to define a time out so that connections can be released and used by new connection.

How a database block is oragnized

Understanding  Database Block:

Database Blocks 
  Free used and unused blocks
Free blocks
Free blocks are blocks below the high water mark whose filling is below the pctused attribute. If an insert statement is executed, Oracle tries to insert the row in a free block. If it doesn't find a free block, it tries to insert it in an unused block. Free blocks of a segment are recorded in the segment's free list. See also dbms_space.free_blocks pctfree controls the threshold when a free block becomes a non-free block. 
Unused blocks
A block that has never been written to is a unused block. Unused blocks are beyond the high water mark. The number of unused blocks can be found with dbms_space.unused_space. 
Used blocks
A block that has been written to is a used blocks. Used blocks are below the high water mark. A free block is also a used block; but a used block is not always a free block. 
Getting the count of used and free blocks
With free blocks and unused blocks it is possible to get the count of used and free blocks, respectively, within a segment. 
Size of db blocks
Since Oracle 10g, it's possible to define multiple block sizes for a database. However, one of the sizes is the standard size. The size of the (standard) database block is determined by the db_block_size init parameter. This standard block size is the block size of blocks in the system tablepsace. 
Interested transaction list (ITL)
See initrans and maxtrans. Each ITL uses 24 bytes overhead. 
Block header
All blocks have a header that consists of: 
Block type
1=undo segment header, 2=undo segment block, 5=data segment header, 7=temporary table, 11=data file header, 14=Unlimited rollback segment header, 15=Unlimited deferred rollback segment header, 16=Unlimited data segment header, 17=Unlimited data segment header with FL groups, 18=Extent map block 
Block format
Is it an oracle 7 or oracle 8, (or 9, or 10???) formatted block? 
Relative database address 
SCN 
SCN sequence number 
Check value
Is used for integrity checking at the block level if db_block_checksum is set. 
Tail
The tail is not at the beginning of a block but at its end: it is used as a block consistency check. That is, the value must be equal to SCN + block type + SCN sequence number. 

RBA
The redo log address (RBA) plays an important role. . To be finished. 
Checking integrity of blocks
The integrity of database blocks can be checked with dbverify [dbv] (the database verify tool) or dbms_dbverify. 
Overhead
Not all bytes in a datablock actually store inserted (or selectable) data. Some bytes are also used for Oracle to organize the data so that it can be found again. These (additional) data are called overhead. The following applies for tables: The overhead consists of 
fixed header 
transaction header 
table directory 
row directory 
row header 
column size 
fixed header + transaction header + table directory + row directory = block header. 
Fixed header
The size of the block header is 57 bytes. 
Transaction header
The size of the transaction header is dependant on the initrans parameter. Specifically, its size is at least 23*initrans bytes. It can grow up to 23*maxtrans bytes. 
Table directory
The table directory is used to find the start position of each row (or row directory). The size of the table directory is 4 bytes*number of tables. Number of tables is important for cluster tables. For other tables, it's 1 (eg 4 bytes). 
Row directory
The row directory uses 2 bytes per stored row. 
Row header
For non cluster tables, the row header is 3 bytes. Each stored row has one row header. One byte is used to store flags, one byte to indicate if the row is locked (for example because it's updated but not commited), and one byte for the column count. 
Column size
Each column within a row needs at least 1 byte indicating the size of the data in the column. For varchar2's longer than 250 bytes, 3 bytes are used. 
PCTFREE
When calculating the amount of storable data in a block, the pctfree must also be considered. 
Corrupt blocks
Blocks might become corrupt. Information about corrupt blocks is recorded in the control files. 
Dirty blocks
to be finished... 
Checking block data integrity in memory
Oracle allows to check the integrity of data within a database block before it is written from memory (that is: buffer cache) to the harddisk by setting the parameter db_block_checksum to full. If a data integrity error is detected, an ORA-00227, ORA-00368 or ORA-01578 is raised. 
Database block address
Each block in the database is uniquely identified with the database block address (dba). 
x$bh
With x$bh, it is possible to query some information about db_blocks in the buffer cache.  

How to identify if it is a memory bottleneck or a hardware issue in a DB server

How to identify if it is a memory bottleneck or a hardware issue for a DB server:

If The server was hung due to out of memory error.

When all memory is exhausted, the out of memory killer (oom-killer) process begins killing processes and try to keep server alive.

 But if, the memory recover ended with rebooting the server it indicates a hardware issue.



Below are the error logs available in the server before the reboot.



Apr  4 09:10:09 testoraclerac-d kernel: Swap cache: add 0, delete 0, find 0/0, race 0+0

Apr  4 09:10:09 testoraclerac-d kernel: 22954 pages of slabcache

Apr  4 09:10:09 testoraclerac-d kernel: 722 pages of kernel stacks

Apr  4 09:10:09 testoraclerac-d kernel: 13 lowmem pagetables, 17746 highmem pagetables

Apr  4 09:10:09 testoraclerac-d kernel: Free swap:            0kB

Apr  4 10:20:09 testoraclerac-d kernel: Out of Memory: Killed process 15944 (oracle).

Apr  4 10:30:19 testoraclerac-d kernel: Out of Memory: Killed process 22600 (oracle).

Apr  4 10:30:19 testoraclerac-d kernel: Out of Memory: Killed process 22600 (oracle).

Apr  4 10:37:56 testoraclerac-d kernel: Out of Memory: Killed process 29002 (oracle).

Apr  4 10:37:56 testoraclerac-d kernel: Out of Memory: Killed process 29002 (oracle).

Apr  4 11:55:06 testoraclerac-d kernel: Memory: 4025116k/4653052k available (1710k kernel code, 98984k reserved, 1296k data, 228k init, 3211208k highmem)

Apr  4 11:55:14 testoraclerac-d kernel: Total HugeTLB memory allocated, 0

Apr  4 11:55:14 testoraclerac-d kernel: Freeing initrd memory: 1455k freed

Apr  4 11:55:16 testoraclerac-d kernel: Freeing unused kernel memory: 228k freed

How to remove and add or resubmit a Job to oracle scheduler using DBMS_JOB


How to remove and add or resubmit a Job to oracle scheduler using DBMS_JOB

Get the JOB ID or NUMBER
Select job from user_jobs where what like '%testjob_jobs.schedule_jobs%';

1342086

Remove the job from the scheduler:

exec DBMS_JOB.REMOVE(1342086);
or 
BEGIN 
  SYS.DBMS_JOB.REMOVE(984909);
COMMIT;
END;
/



Add or resubmit the job to the scheduler:

DECLARE
  X NUMBER;
BEGIN
  SYS.DBMS_JOB.SUBMIT
  ( job       => X 
   ,what      => 'declare out_list varchar2(32767); begin testjob_jobs.schedule_jobs(job,out_list,''N'',''N''); end;'
   ,next_date => to_date('10/01/2012 07:00:46','dd/mm/yyyy hh24:mi:ss')
   ,interval  => 'sysdate + 5/(24*60)'
   ,no_parse  => FALSE
  );
  SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
COMMIT;
END;
/

How to modify or create a sequence with a new value

How to modify or create a sequence with a new value:-


Say the name of the sequence is SEQ_SUBSCRIPTION_NUMBER or SEQ__SOURCE_COMPANY_ID.


Check the current value of the sequence:


select  SEQ_SUBSCRIPTION_NUMBER.nextval from dual;


19154970


Check the current value of the sequence:


select  SEQ__SOURCE_COMPANY_ID.nextval from dual;


19005240


Alter the sequence by incrementing with positive or negative number as requred,this will reset the sequence.


 ALTER SEQUENCE TAPET.SEQ__SOURCE_COMPANY_ID increment BY -97250085 ;

 

 ALTER SEQUENCE TAPET.SEQ__SOURCE_COMPANY_ID increment BY 1

 

 select  SEQ__SOURCE_COMPANY_ID.nextval from dual;

 

 

 106483655


Now say you have to modify the sequence to some new starting value.

 

 8074950

 

 8074950


In that case drop and recreate the sequence with that starting value:

 

 DROP SEQUENCE TAPET.SEQ__SOURCE_COMPANY_ID;


CREATE SEQUENCE TAPET.SEQ_SUBSCRIPTION_NUMBER

  START WITH 8074950

  INCREMENT BY 1

  MAXVALUE 308999999

  MINVALUE 8074950

  NOCYCLE

  CACHE 20;

Wednesday, December 30, 2015

Remotely export and import between two database

How to do export import data remotely between two Oracle DB.

This could be helpful when we want to do a reguar copy of production data into pre prod for certain table.

 

The script below can be useful for the same:


#!/bin/bash
. $HOME/.bash_profile
################################################################################
#

################################################################################
# Revision History
################################################################################
# ---> For debugging purposes only

################################################################################
# supplemental area for extra information

################################################################################
# Parameters
HOME_BASE=/spare/tmp
TODAY=`date +"%Y%m%d"`
SCRIPT_DIR=${HOME_BASE}/admin/bin
SQL_DIR=${HOME_BASE}/admin/sql
EXP_DIR=${HOME_BASE}/admin/dump
LOG_DIR=${HOME_BASE}/admin/log
LOADER=${ORACLE_HOME}/bin/sqlldr
SQLPLUS=${ORACLE_HOME}/bin/sqlplus
EXP=${ORACLE_HOME}/bin/exp
EXPORT_OWNER=$1
EXPORT_PASSWD=$2
TNS_PPOD=PPRSADB_PPod
TNS_PROD=value_to_be_set
SCHEMA_OWNER=$3
SCHEMA_PASSWD=$4
LOG_FILE=$LOG_DIR/IIN_RUN.log
LOG_TEMP_FILE=/tmp/PIN_BIN_log.tmp
CRITICAL=NO
HOST=`hostname`
FTP_ERROR=0
EXP_ERR=0
FILES_HOOPED=0
FAILURE_CODE=1


################################################################################
if [[ ! -x $HOME_BASE/admin/bin/load_PIN_BIN.ksh ]]; then
    print "file load_PIN_BIN.ksh does not have execute permission."
    chmod +x  $HOME_BASE/bin/load_PIN_BIN.ksh
    return 1
fi


if [ -s ${LOG_TEMP_FILE} ] ; then
   rm ${LOG_TEMP_FILE}
fi

################################################################################
   echo "`date +"%D-%T"`: " >> ${LOG_FILE}

################################################################################
###                             MAIN                                         ###
################################################################################
# recreate log file for each run
if [ ! -f ${LOG_FILE} ]; then
   touch ${LOG_FILE}
else
   rm ${LOG_FILE}
   touch ${LOG_FILE}
fi

# LogMsg ${DASHED_LINE}

## Export the PTS_PIN_BIN from PPod.

exp $EXPORT_OWNER/$EXPORT_PASSWD@$TNS_PPOD  file=$EXP_DIR/PP_PIN_BIN$TODAY.dmp tables=PTSADB.PTS_PIN_BIN statistics=none buffer=2000000 log=$LOG_DIR/EXPPIN_BIN_PP$TODAY.log


## Take a backup of PTS_PIN_BIN table from production

exp $SCHEMA_OWNER/$SCHEMA_PASSWD  file=$EXP_DIR/PROD_PIN_BIN$TODAY.dmp tables=DTSPROD.PTS_PIN_BIN statistics=none buffer=2000000 log=$LOG_DIR/EXPPIN_BIN_PRO$TODAY.log

### Truncate the table PTS_PIN_BIN from production

${SQLPLUS} -silent << EOLINE
${SCHEMA_OWNER}/${SCHEMA_PASSWD}
set echo off
set heading on
set pagesize 0
set feedback off
set linesize 250
spool ${LOG_DIR}/PIN_BIN_CLEANUP.log
@${SQL_DIR}/PIN_BIN_CLEANUP.sql
spool off
exit;
EOLINE



### IMPORT THE TABLE

imp $SCHEMA_OWNER/$SCHEMA_PASSWD tables=PTS_PIN_BIN FROMUSER=PTSADB TOUSER=DTSPROD  rows=y ignore=y grants=n commit=y file=$EXP_DIR/PP_PIN_BIN$TODAY.dmp log=$LOG_DIR/IMP_PIN_BIN_PPT$TODAY.log




#CleanUp


IN-DOUBT TRANSACTIONS IN Distributed Environment:-

How to Handle IN-DOUBT TRANSACTIONS IN Distributed Environment:


A transaction is in-doubt when there is a failure during any aspect of the two-phase commit.

Distributed transactions become in-doubt in the following ways:

A server machine running Oracle software crashes.

A network connection between two or more Oracle databases involved in distributed processing is disconnected.

An unhandled software error occurs.

STATE Column of DBA_2PC_PENDING

collecting     This category normally applies only to the global coordinator or local coordinators. The node is currently collecting information from other database servers before it can decide whether it can prepare.
prepared     The node has prepared and may or may not have acknowledged this to its local coordinator with a prepared message. However, no commit request has been received. The node remains prepared, holding any local resource locks necessary for the transaction to commit.
committed     The node (any type) has committed the transaction, but other nodes involved in the transaction may not have done the same. That is, the transaction is still pending at one or more nodes.
forced commit     A pending transaction can be forced to commit at the discretion of a database administrator. This entry occurs if a transaction is manually committed at a local node by a database administrator. 
forced abort (rollback)    


Scenarios 1:

PD team will inform DBA to look into the indoubt transaction issue.
From database point of view we will not come across any issue regards to database.
Once we got information from PD on this, the following steps needs to be followed to rollback the indoubt transactions.

a) logon to the database and check the STATUS column of DBA_2PC_PENDING table.
We will find one or more indoubt transactions. Check for GLOBAL_TRAN_ID column.
b) Execute the below statement,

ROLLBACK FORCE ‘LOCAL_TRAN_ID’;
COMMIT;

c) If we check once again the DBA_2PC_PENDING table, this transaction will be rolled back.

Scenarios 2:

If the transaction did not rollback after the above steps in scenarios 1 then we need to bounce the database.

Though we are DBA on this application, we can startup and shutdown the database.

a) After executing the ROLLBACK FORCE ‘global_tran_id’ , still we find the entry in the DBA_2PC_PENDING table.
b) We will bounce the database after all the applications are brought down.
c) Again follow the steps mentioned in scenarios 1 point (a), (b) and (c).

BEGIN

   DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY ('LOCAL_TRAN_ID');

END;

EXECUTE DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY ('LOCAL_TRAN_ID');