November 23, 2021

How to find out uncommitted transactions in oracle 19c

 

V$TRANSACTION lists the active transactions in the database


 Use following query to find out uncommitted active transactions in database

  

select t.start_time,a.sid,a.serial#,a.username,a.status,a.schemaname,

a.osuser,a.process,a.machine,a.terminal,a.program,a.module,to_char(a.logon_time,'DD/MON/YY HH24:MI:SS') logon_time

from v$transaction t, v$session a

where a.saddr = t.ses_addr

order by start_time;

 

 

To find out sql statement of uncommitted transaction

SELECT a.SID, a.SERIAL#, a.USERNAME, a.OSUSER, a.PROGRAM, a.EVENT

  ,TO_CHAR(a.LOGON_TIME,'YYYY-MM-DD HH24:MI:SS')

  ,TO_CHAR(T.START_DATE,'YYYY-MM-DD HH24:MI:SS')

  ,a.LAST_CALL_ET, a.BLOCKING_SESSION, a.STATUS

  ,(

    SELECT Q.SQL_TEXT

    FROM V$SQL Q

    WHERE Q.LAST_ACTIVE_TIME=T.START_DATE

    AND ROWNUM<=1) AS SQL_TEXT

FROM V$SESSION a,

  V$TRANSACTION T

WHERE a.SADDR = T.SES_ADDR;

.

 

To find out if your current session has any uncommitted transaction

SELECT COUNT(*) FROM v$transaction t, v$session s, v$mystat m WHERE t.ses_addr = s.saddr AND s.sid = m.sid AND ROWNUM = 1;

 

If the output is zero it means it has no uncommitted transaction.

If output is 1, it states session has uncommitted transactions.

November 16, 2021

Shell script to stop weblogic , forms, reports , ohs instance in 12.2.1.4

 

Create an env file with following details.

 Note: It is assumed that boot.properties file is configured with weblogic username and password. Otherwise the script will prompt for username and password.

cat /home/oracle/app_env

ORACLE_BASE=/d01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/12.2.1.4; export ORACLE_HOME

MW_HOME=$ORACLE_HOME ; export MW_HOME

WLS_HOME=$MW_HOME/wlserver; export WLS_HOME

WL_HOME=$WLS_HOME  ;export WLS_HOME

DOMAIN_HOME=/d01/app/oracle/product/12.2.1.4/user_projects/domains/prod_domain; export DOMAIN_HOME

JAVA_HOME=/usr/java/jdk1.8.0_231-amd64; export JAVA_HOME

export OHS_INST=/d01/app/oracle/product/12.2.1.4/user_projects/domains/prod_domain/config/fmwconfig/components/OHS/instances/ohs1 ;export OHS_INST

PATH=$JAVA_HOME/bin:$PATH ; export PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export FORMS_PATH=/d01/app/oracle/product/12.2.1.4/forms; export FORMS_PATH

 

Here, ORACLE_BASE stands for oracle base

ORACLE_HOME stands for middleware home

MW_HOME also stands for middleware home

DOMAIN_HOME stands for domain home

OHS_INST stands for Oracle HTTP Server instance home

 

Now create shell script

vi stop_services.sh

# Start NodeManager

#!/bin/bash

. /home/oracle/app_env

 

echo "*************************Stopping Ohs Instance ********************************"

 

# Stop the web tier.

$DOMAIN_HOME/bin/stopComponent.sh ohs1

 

sleep 5

 

echo "*************************Stopping Standalone Report Server ********************************"

 

$DOMAIN_HOME/bin/stopComponent.sh rep_server1_prod

 

sleep 5

echo "*************************Stopping Forms Services ********************************"

 

# Stop the managed Servers

$DOMAIN_HOME/bin/stopManagedWebLogic.sh WLS_FORMS

 

sleep 5

 

echo "*************************Stopping Reports Services ********************************"

 

$DOMAIN_HOME/bin/stopManagedWebLogic.sh WLS_REPORTS

 

sleep 5

 

echo "*************************Stopping WebLogic********************************"

 

# Stop the WebLogic Domain

$DOMAIN_HOME/bin/stopWebLogic.sh

 

sleep 5

echo "*************************Stopping NodeManager********************************"

 

$DOMAIN_HOME/bin/stopNodeManager.sh

 

echo "*************************All Services are stopped now!********************************"

 

 

November 9, 2021

Shell script to start weblogic , forms, reports , ohs instance in 12.2.1.4

Create an env file with following details.

 Note: It is assumed that boot.properties file is configured with weblogic username and password. Otherwise the script will prompt for username and password.

cat /home/oracle/app_env

ORACLE_BASE=/d01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/12.2.1.4; export ORACLE_HOME

MW_HOME=$ORACLE_HOME ; export MW_HOME

WLS_HOME=$MW_HOME/wlserver; export WLS_HOME

WL_HOME=$WLS_HOME  ;export WLS_HOME

DOMAIN_HOME=/d01/app/oracle/product/12.2.1.4/user_projects/domains/prod_domain; export DOMAIN_HOME

JAVA_HOME=/usr/java/jdk1.8.0_231-amd64; export JAVA_HOME

export OHS_INST=/d01/app/oracle/product/12.2.1.4/user_projects/domains/prod_domain/config/fmwconfig/components/OHS/instances/ohs1 ;export OHS_INST

PATH=$JAVA_HOME/bin:$PATH ; export PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export FORMS_PATH=/d01/app/oracle/product/12.2.1.4/forms; export FORMS_PATH

 

Here, ORACLE_BASE stands for oracle base

ORACLE_HOME stands for middleware home

MW_HOME also stands for middleware home

DOMAIN_HOME stands for domain home

OHS_INST stands for Oracle HTTP Server instance home

 

Now create shell script

vi start_services.sh

# Start NodeManager

#!/bin/bash

. /home/oracle/app_env

echo "*************************Starting NodeManager********************************"

nohup $DOMAIN_HOME/bin/startNodeManager.sh > /dev/null 2>&1 &

 

sleep 10

echo "*************************Starting WebLogic********************************"

 

# Start WebLogic Domain

nohup $DOMAIN_HOME/bin/startWebLogic.sh > /dev/null 2>&1 &

 

sleep 60

 

echo "*************************Starting Forms Services ********************************"

 

# Start the managed Servers

nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh WLS_FORMS > /dev/null 2>&1 &

 

sleep 10

 

echo "*************************Starting Reports Services ********************************"

 

nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh WLS_REPORTS > /dev/null 2>&1 &

 

sleep 10

 

echo "*************************Starting Ohs Instance ********************************"

 

# Start the web tier.

$DOMAIN_HOME/bin/startComponent.sh ohs1 > /dev/null 2>&1 &

 

sleep 10

 

echo "*************************Starting Standalone Report Server ********************************"

 

$DOMAIN_HOME/bin/startComponent.sh rep_server1_prod > /dev/null 2>&1 &

 

sleep 10

 

echo "*************************All Services are running. Run this url to check http://192.168.23.12:9001/forms/frmservlet?config=cspprd ********************************"


#chmod 775  start_services.sh


October 29, 2021

Gather all undo information using a single script

 

In our daily life, sometimes we require to gather various information related to undo tablespace and for many of us it becomes challenging to remember all the views to gather that information.

 

Using this script, we can gather various information related to undo tablespace in a single go.

 

[db@server102 ~]$ cat undotablespace.sql

#Please execute following script to generate html file

 

set markup html on spool on

SPOOL UNDO_INFO.HTML

set pagesize 200

set echo on;

 

select * from v$version;

show parameter undo

alter session set nls_date_format='DD-MON-YY HH:MI:SS AM';

select * from v$database;

select * from gv$instance;

 

select inst_id,sid,name,value from gv$spparameter where name like '%undo%';

 

select a.ksppinm "Parameter",

b.ksppstvl "Session Value",

c.ksppstvl "Instance Value",

a.KSPPDESC "Describtion"

from x$ksppi a, x$ksppcv b, x$ksppsv c

where a.indx = b.indx and a.indx = c.indx

and a.ksppinm like '%smu%';

 

select nam.ksppinm NAME, val.KSPPSTVL VALUE

from x$ksppi nam, x$ksppsv val

where nam.indx = val.indx and (nam.ksppinm like '%undo%' or nam.ksppinm like '_smu%' or nam.ksppinm in ('event', '_first_spare_parameter','_rollback_segment_count' ) )

order by 1;

 

select max(maxquerylen), max(tuned_undoretention) , max(undoblks), avg (undoblks), avg(maxquerylen), avg(tuned_undoretention) from v$undostat;

 

select max(maxquerylen),max(tuned_undoretention) from dba_hist_undostat;

 

select status, round(sum(bytes)/(1024*1024)) size_mb, count(status) number_of_ext

from dba_undo_extents

group by status;

 

select tablespace_name,status,count(*) from dba_rollback_segs group by status,tablespace_name order by 1;

 

select object_name, reason from dba_outstanding_alerts;

 

SELECT tablespace_name, status,round(sum(bytes)/(1024*1024)) size_m, COUNT (*)

FROM SYS.dba_undo_extents

GROUP BY tablespace_name, status order by tablespace_name,status;

 

select to_char(begin_time, 'DD-MON-YYYY HH24:MI:SS') begin_time,

tuned_undoretention from v$undostat;

 

select to_char(begin_time, 'DD-MON-YYYY HH24:MI:SS') begin_time,

to_char(end_time, 'DD-MON-YYYY HH24:MI:SS') end_time,

undotsn, undoblks, txncount, maxconcurrency as "MAXCON",

maxquerylen, tuned_undoretention

from v$undostat order by 1;

 

select * from v$undostat ;

select * from gv$undostat;

 

column UNXPSTEALCNT heading "# Unexpired-Stolen"

column EXPSTEALCNT heading "# Expired-Reused"

column SSOLDERRCNT heading "ORA-1555"

column NOSPACEERRCNT heading "Out-Of-space"

column MAXQUERYLEN heading "Max Query Length"

 

select inst_id, to_char(begin_time,'DD-MON-YYYY HH24:MI:SS') "Begin Time",

unxpstealcnt, expstealcnt , ssolderrcnt, nospaceerrcnt, maxquerylen, tuned_undoretention "Tuned Undo"

from gv$undostat

where SSOLDERRCNT > 0

order by inst_id, begin_time;

 

 

select tablespace_name,block_size,status,contents,retention,extent_management,segment_space_management,status,bigfile from dba_tablespaces

where contents='UNDO' order by contents,tablespace_name;

 

select tablespace_name,file_name,round(bytes/1024/1024) "SIZE (MB)",autoextensible,round(maxbytes/1024/1024) "MAX SIZE (MB)", status

from dba_data_files where tablespace_name in (select tablespace_name from dba_tablespaces where contents='UNDO') order by tablespace_name,file_name;

 

SELECT /* + RULE */ df.tablespace_name "Tablespace",

df.bytes / (1024 * 1024) "Size (MB)",

SUM(fs.bytes) / (1024 * 1024) "Free (MB)",

Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free",

Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used"

FROM dba_free_space fs,

(SELECT tablespace_name,SUM(bytes) bytes

FROM dba_data_files where tablespace_name in (select tablespace_name from dba_tablespaces where CONTENTS='UNDO')

GROUP BY tablespace_name) df

WHERE fs.tablespace_name (+) = df.tablespace_name

GROUP BY df.tablespace_name,df.bytes

/

 

SELECT s.sid, s.serial#, s.username, u.segment_name, count(u.extent_id) "Extent Count", t.used_ublk, t.used_urec, s.program

FROM v$session s, v$transaction t, dba_undo_extents u

WHERE s.taddr = t.addr and u.segment_name like '_SYSSMU'||t.xidusn||'_%$' and u.status = 'ACTIVE'

GROUP BY s.sid, s.serial#, s.username, u.segment_name, t.used_ublk, t.used_urec, s.program

ORDER BY t.used_ublk desc, t.used_urec desc, s.sid, s.serial#, s.username, s.program;

 

select b.name "UNDO Segment Name", b.inst# "Instance ID", b.status$ STATUS, a.ktuxesiz "UNDO Blocks", a.ktuxeusn, a.ktuxeslt xid_slot, a.ktuxesqn xid_seq

from x$ktuxe a, undo$ b

where a.ktuxesta = 'ACTIVE' and a.ktuxecfl like '%DEAD%' and a.ktuxeusn = b.us#;

 

 

 

spool off

set markup html off spool off

 

 

Execute the sql

[db@server102 ~]$ sqlplus / as sysdba

 

SQL> @undotablespace.sql

 

 

 

August 28, 2021

OEM 13.5 installation fails during OMSCA With the Error: OMS service creation failed

 Environment Details:-

OMS DB Version

19.3.0

OEM Version

13.5.0.0.0

OS

Windows Server 2019


Error Details:-

During Oracle Enterprise manager 13.5 installation following error message is seen inside

OMS_HOME/cfgtoollogs/omsca/omsca_<timestamp>.log location

 

Aug 28, 2021 11:24:51 AM oracle.sysman.omsca.util.CoreOMSConfigAssistantUtil execCommand

INFO: Output messages of the command C:\app\Middleware\bin\emctl.bat create service -oms_svc_name OracleManagementServer_EMGC_OMS1_1 :

Oracle Enterprise Manager Cloud Control 13c Release 5 

Copyright (c) 1996, 2021 Oracle Corporation.  All rights reserved.

Creating oms service OracleManagementServer_EMGC_OMS1_1...

OMS service creation failed. Aborting...

 

Aug 28, 2021 11:24:51 AM oracle.sysman.omsca.util.CoreOMSConfigAssistantUtil execCommand

INFO: error messages of the command C:\app\Middleware\bin\emctl.bat create service -oms_svc_name OracleManagementServer_EMGC_OMS1_1 :

 

Solution:-

1) Ensure that the following packages are installed on the OMS Server. If not install them.

  • Microsoft Visual C++ 2010 Redistributable Package
  • Microsoft Visual C++ 2012 Redistributable Package
  • Microsoft Visual C++ 2015 Redistributable Package Update 3

2) Delete the <OMS_BASE_DIR>\gc_inst directory created during the oms configuration.

3) If the OEM installer is still running click on "Retry".

If not, execute following from command prompt:

    $ 13.5_OMS_HOME/oui/bin> ./runConfig.sh ORACLE_HOME=<13.5_OMS_HOME> MODE=perform ACTION=configure COMPONENT_XML={encap_oms.1_0_0_0_0.xml}


This should resolve the issue.

August 19, 2021

How to install ansible on Oracle Linux 7

 

OS : OEL 7.9

Download EPEL Repo

You can download EPEL repo from this link

https://dl.fedoraproject.org/pub/epel/

To download directly in the server use wget command

[root@bastionhost opc]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm


Install EPEL repo


[root@bastionhost opc]# rpm -Uvh epel-release-latest-7.noarch.rpm

warning: epel-release-latest-7.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:epel-release-7-13                ################################# [100%]

 

Install Anisble

[root@bastionhost opc]# yum install ansible

Loaded plugins: langpacks, ulninfo

https://ookla.bintray.com/rhel/repodata/repomd.xml: [Errno 14] HTTPS Error 403 - Forbidden

Trying other mirror.

epel/x86_64/metalink                                                                     | 8.4 kB  00:00:00

epel                                                                                     | 4.7 kB  00:00:00

(1/3): epel/x86_64/group_gz                                                              |  96 kB  00:00:00

(2/3): epel/x86_64/updateinfo                                                            | 1.0 MB  00:00:02

(3/3): epel/x86_64/primary_db                                                            | 6.9 MB  00:00:03

Resolving Dependencies

--> Running transaction check

---> Package ansible.noarch 0:2.9.18-1.el7 will be updated

---> Package ansible.noarch 0:2.9.24-2.el7 will be an update

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================================================

 Package                   Arch                     Version                        Repository              Size

================================================================================================================

Updating:

 ansible                   noarch                   2.9.24-2.el7                   epel                    17 M

 

Transaction Summary

================================================================================================================

Upgrade  1 Package

 

Total download size: 17 M

Is this ok [y/d/N]: y

Downloading packages:

epel/x86_64/prestodelta                                                                  | 1.3 kB  00:00:00

warning: /var/cache/yum/x86_64/7Server/epel/packages/ansible-2.9.24-2.el7.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY

Public key for ansible-2.9.24-2.el7.noarch.rpm is not installed

ansible-2.9.24-2.el7.noarch.rpm                                                          |  17 MB  00:00:06

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

Importing GPG key 0x352C64E5:

 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"

 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5

 Package    : epel-release-7-13.noarch (installed)

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

Is this ok [y/N]: y

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

  Updating   : ansible-2.9.24-2.el7.noarch                                                                  1/2

  Cleanup    : ansible-2.9.18-1.el7.noarch                                                                  2/2

  Verifying  : ansible-2.9.24-2.el7.noarch                                                                  1/2

  Verifying  : ansible-2.9.18-1.el7.noarch                                                                  2/2

 

Updated:

  ansible.noarch 0:2.9.24-2.el7

 

Complete!

 

 


Verify Anisble Version:-

[root@bastionhost opc]# ansible --version

ansible 2.9.24

  config file = /etc/ansible/ansible.cfg

  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']

  ansible python module location = /usr/lib/python2.7/site-packages/ansible

  executable location = /bin/ansible

  python version = 2.7.5 (default, Nov 13 2020, 02:52:00) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44.0.3)]

 


Installation complete. Ansible is ready to use.

August 6, 2021

Preclone on DBTier fails with RC-20010: Fatal: Could not find Info-ZIP's zip version 2.3 in the PATH

 While running adpreclone on DB Tier , it fails with error RC-20010: Fatal: Could not find Info-ZIP's zip version 2.3 in the PATH

Environment Details:-

Application Version

R12.1.1

DB Version

11.2.0.4

OS

RHEL 7


While running adpreclone on dbTier following error message is thrown

[orapay@ccuine EIILPAY_ccuine]$ perl adpreclone.pl dbTier 

                     Copyright (c) 2002 Oracle Corporation

                        Redwood Shores, California, USA 

                        Oracle Applications Rapid Clone 

                                 Version 12.0.0 

                      adpreclone Version 120.20.12010000.2 

Enter the APPS User Password:

  |      0% completed       RC-20010: Fatal: Could not find Info-ZIP's zip version 2.3 in the PATH. Please make sure you have zip version 2.3 in your PATH and rerun the command.zip 2.3 is normally available in $ORACLE_HOME/bin/ or it can be downloaded from http://www.info-zip.org/Zip.html 

ERROR while running Stage...

Fri Aug  6 22:14:12 2021 

ERROR while running perl /PAYROLL/EIILPAY/db/tech_st/11.2.0.4/appsutil/bin/adclone.pl java=/PAYROLL/EIILPAY/db/tech_st/11.2.0.4/jdk/jre mode=stage stage=/PAYROLL/EIILPAY/db/tech_st/11.2.0.4/appsutil/clone component=dbTier method=CUSTOM dbctx=/PAYROLL/EIILPAY/db/tech_st/11.2.0.4/appsutil/EIILPAY_ccuine105.xml showProgress ...

 


Reason:- The error is observed because Zip Version other zip version is installed in whereas adpreclone.pl is expecting ZIP version 2.3.

[orapay@ccuine105 ~]$ zip -v

Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.

This is Zip 3.0 (July 5th 2008), by Info-ZIP.

So the above output shows our server has zip version 3 installed. And adpreclone is looking for ver 2.3

Solution:-

Solution 1: Stay with zip 2.3 

1.1 download zip 2.3 from http://www.info-zip.org/ 

1.2 unzip this file to a directory

 1.3 Add this directory in the PATH variable (now 'which zip' should give this location).

 Please make sure you have zip version 2.3 in your PATH

 1.4 Re-run adpreclone.pl

  

Solution 2 : Use zip 3.0 

2.1 Take a backup of you environment 

2.2 Review readme of Patch : 9171651 and apply all pre-requisites 

2.3 Apply patch Patch : 9171651 R12 RAPIDCLONE CONSOLIDATED FIXES JUL/2010

2.4 Retry the adpreclone.pl 


Solution 3: Copy Zip from appstier

3.1 scp or copy zip v2.3 from the apps tier’s location $ORACLE_HOME/bin,

to /usr/bin location.

3.2Make sure to take a backup of original zip in /usr/zip. And then retry adpreclone. It should work.

Once done revert back to original zip version


Oracle Database 26ai Installation Using RPM on Oracle Linux 9 (OEL 9) – Step-by-Step Guide

  In this post I will describe the installation of Oracle Database 26ai 64-bit on Oracle Linux 9 (OL8) 64-bit. The installation requires a m...