Tuesday 6 December 2016

Find Oracle Database session from OS process

Execute the following query and find out the Database session

SQL> select a.spid server, b.process client, b.username,b.status
from v$process a , v$session b
where (a.addr = b.paddr)
and  b.username is not null
order by a.spid asc;  2    3    4    5

SERVER                   CLIENT                   USERNAME                       STATUS
------------------------ ------------------------ ------------------------------ --------
14674                    2868:6052                SYS                            INACTIVE
14679                    2868:4792                SYS                            INACTIVE
14754                    14753                    SYS                            ACTIVE

SQL>

Execute the following command and find out the OS process mapping with Database session

[oracle@saidrasel ~]$ ps -auxww | grep $ORACLE_SID | grep LOCAL

oracle   14674  0.0  1.0 1682420 48532 ?       Ss   11:13   0:00 oracleorcl (LOCAL=NO)
oracle   14679  0.0  0.4 1679844 21852 ?       Ss   11:13   0:00 oracleorcl (LOCAL=NO)
oracle   14754  0.0  0.4 1679844 23068 ?       Ss   11:20   0:00 oracleorcl (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
[oracle@saidrasel ~]$

Now create three new connection in Database and execute the query

SQL> select a.spid server, b.process client, b.username,b.status
from v$process a , v$session b
where (a.addr = b.paddr)
and  b.username is not null
order by a.spid asc  2    3    4    5  ;

SERVER                   CLIENT                   USERNAME                       STATUS
------------------------ ------------------------ ------------------------------ --------
14674                    2868:6052                SYS                            INACTIVE
14679                    2868:4792                SYS                            INACTIVE
14754                    14753                    SYS                            ACTIVE
14785                    2868:4792                SAID                         INACTIVE
14787                    2868:4792                SAID                         INACTIVE
14790                    3944:3764                RASEL                  INACTIVE

6 rows selected.

SQL>

Now find the these Database session from OS process also

[oracle@saidrasel ~]$ ps -auxww | grep $ORACLE_SID | grep LOCAL
oracle   14674  0.0  1.0 1682420 48540 ?       Ss   11:13   0:00 oraclestlbas (LOCAL=NO)
oracle   14679  0.0  0.4 1679844 21852 ?       Ss   11:13   0:00 oraclestlbas (LOCAL=NO)
oracle   14754  0.0  0.4 1679844 23096 ?       Ss   11:20   0:00 oraclestlbas (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   14785  0.1  0.8 1682420 40408 ?       Ss   11:23   0:00 oraclestlbas (LOCAL=NO)
oracle   14787  0.1  0.8 1680868 42848 ?       Ss   11:23   0:00 oraclestlbas (LOCAL=NO)
oracle   14790  0.0  0.4 1679844 22528 ?       Ss   11:23   0:00 oraclestlbas (LOCAL=NO)
[oracle@saidrasel ~]$

Tuesday 1 November 2016

How to stop/start Weblogic component


Step 1: Check the status of Weblogic component using following command

[oracle@said bin]$ cd /u01/oracle/middleware/asinst_1/bin
[oracle@said bin]$ ./opmnctl status all

Processes in Instance: asinst_1
---------------------------------+--------------------+---------+---------
ias-component                    | process-type       |     pid | status
---------------------------------+--------------------+---------+---------
emagent_asinst_1                 | EMAGENT            |    2223 | Alive
RptSvr_said_asinst_1       | ReportsServerComp~ |    2758 | Alive
forms                            | FormsRuntime       |   22446 | Alive

Step 2: Stop  Weblogic component using following command


[oracle@said bin]$ ./opmnctl stopproc ias-component=RptSvr_said_asinst_1
opmnctl stopproc: stopping opmn managed processes...
[oracle@said bin]$ ./opmnctl status all

Processes in Instance: asinst_1
---------------------------------+--------------------+---------+---------
ias-component                    | process-type       |     pid | status
---------------------------------+--------------------+---------+---------
emagent_asinst_1                 | EMAGENT            |    2223 | Alive
RptSvr_said_asinst_1       | ReportsServerComp~ |     N/A | Down
forms                            | FormsRuntime       |   22578 | Alive



Step 3: Start  Weblogic component using following command

[oracle@said bin]$ ./opmnctl startproc ias-component=RptSvr_said_asinst_1
opmnctl startproc: starting opmn managed processes...
[oracle@said bin]$ ./opmnctl status all

Processes in Instance: asinst_1
---------------------------------+--------------------+---------+---------
ias-component                    | process-type       |     pid | status
---------------------------------+--------------------+---------+---------
emagent_asinst_1                 | EMAGENT            |    2223 | Alive
RptSvr_said_asinst_1       | ReportsServerComp~ |   22669 | Alive
forms                            | FormsRuntime       |   22662 | Alive
forms                            | FormsRuntime       |   22657 | Alive
forms                            | FormsRuntime       |   22578 | Alive
forms                            | FormsRuntime       |   22570 | Alive