Wednesday, October 7, 2020

Error while loading shared libraries: libXm.so.3: cannot open shared object file

 Symptoms:
During the installation of Oracle Fusion Middleware Portal Forms Reports or the compilation of forms the utilities frmcmp or frmbld cant find the libs to execute.

Cause:
The executable is looking for a shared library libXm.so.3 in 64 bits because OAS 11g software distribution being installed is 64 bits and the current shared library on /usr/lib/libXm.so.3 is from a 32 bits RPM package.
This lib belongs to openmotif lib packages, so you have to validate if this is the case - libs not installed in your system:

Eg via rpm:
rpm -q --queryformat "%{NAME}.%{ARCH}\n" openmotif

rpm -q --queryformat "%{NAME},%{ARCH}\n" openmotif22


Eg via yum:

yum info openmotif

yum info openmotif22


Solution:
Make sure the following 64 bits openmotif packages are installed:
Example for RedHat 4.

openmotif-2.2.3-10.5.el4.x86_64.rpm
openmotif22-2.2.3-18.x86_64.rpm

You can also check on the Oracle Fusion installation guide, section pre-requirements will give you a list of all libraries that you need installed on your OS.
 

https://www.oracle.com/technetwork/middleware/ias/downloads/fusion-requirements-100147.html

From above link, the libraries needed to be installed on the OS are:


Oracle Linux 7 (UL0+)
Red Hat Linux 7 (UL0+)

yum install -y binutils-2.23.52.0.1
yum install -y compat-libcap1-1.10
yum install -y compat-libstdc++-33-3.2.3 for x86_64
yum install -y compat-libstdc++-33-3.2.3 for i686
yum install -y gcc-4.8.2
yum install -y gcc-c++-4.8.2
yum install -y glibc-2.17 for x86_64
yum install -y glibc-2.17 for i686
yum install -y glibc-devel-2.17 for x86_64   
yum install -y glibc-devel-2.17 for i686
yum install -y libaio-0.3.109 for x86_64
yum install -y libaio-devel-0.3.109 for x86_64
yum install -y libgcc-4.8.2 for x86_64
yum install -y libgcc-4.8.2 for i686
yum install -y libstdc++-4.8.2 for x86_64
yum install -y libstdc++-4.8.2 for i686
yum install -y libstdc++-devel-4.8.2 for x86_64
yum install -y ksh make-3.82 ocfs2-tools-1.8.0
yum install -y libXext-1.3.2 for i686
yum install -y libXext-1.3.2 for x86_64
yum install -y libXtst-1.2.2 for x86_64
yum install -y libXtst-1.2.2 for i686
yum install -y sysstat-10.1.5
yum install -y motif-2.3.4-7 for x86_64
yum install -y motif-devel-2.3.4-7 for x86_64
yum install -y motif-2.3.4-7 for i686
yum install -y motif-devel-2.3.4-7 for i686
yum install -y redhat-lsb-4.1-27.0.1.el7 for x86_64
yum install -y redhat-lsb-core-4.1-27.0.1.el7 for x86_64


For RH/OL 7, it might be missing a symbolic link for version 3. See below:
$ ls -la /usr/lib64/libXm.so*
/usr/lib64/libXm.so -> libXm.so.4.0.4
/usr/lib64/libXm.so.4 -> libXm.so.4.0.4

/usr/lib64/libXm.so.4.0.4

cd /usr/lib64/
ln -s /usr/lib64/libXm.so.4.0.4 libXm.so.3


$ ls -la /usr/lib64/libXm.so*
/usr/lib64/libXm.so -> libXm.so.4.0.4
/usr/lib64/libXm.so.3 -> /usr/lib64/libXm.so.4.0.4
/usr/lib64/libXm.so.4 -> libXm.so.4.0.4

/usr/lib64/libXm.so.4.0.4


Append /usr/lib64 to all LD_LIBRARY_PATH referenced in $ORACLE_HOME/bin/config.sh, like so:

if [ x${LD_LIBRARY_PATH} != x ]; then                 LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH:/usr/lib64
 export LD_LIBRARY_PATH
else
 LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib64
 export LD_LIBRARY_PATH

Run the config.sh from $ORACLE_HOME/bin.



Oracle Linux 6 (UL1+)
Red Hat Linux 6 (UL1+)

yum install -y binutils-2.20.51.0.2-5.28.el6
yum install -y compat-libcap1-1.10-1
yum install -y compat-libstdc++-33-3.2.3-69.el6 for x86_64
yum install -y compat-libstdc++-33-3.2.3-69.el6 for i686
yum install -y gcc-4.4.4-13.el6
yum install -y gcc-c++-4.4.4-13.el6
yum install -y glibc-2.12-1.7.el6 for x86_64
yum install -y glibc-2.12-1.7.el6 for i686
yum install -y glibc-devel-2.12-1.7.el6 for i686
yum install -y libaio-0.3.107-10.el6
yum install -y libaio-devel-0.3.107-10.el6
yum install -y libgcc-4.4.4-13.el6
yum install -y libstdc++-4.4.4-13.el6 for x86_64
yum install -y libstdc++-4.4.4-13.el6 for i686
yum install -y libstdc++-devel-4.4.4-13.el6
yum install -y libXext for i686
yum install -y libXtst for i686
yum install -y openmotif-2.2.3 for x86_64
yum install -y openmotif22-2.2.3 for x86_64
yum install -y sysstat-9.0.4-11.el6
yum install -y redhat-lsb-4.0-3.el6 for x86_64
yum install -y redhat-lsb-core-4.0-3.el6 for x86_64


References: Oracle Support Doc ID 1298279.1

Monday, January 13, 2020

Redo Log Corruption - Dropping Redo Log Is Not Possible (ORA-367 checksum error in log file header)



     I have faced redo log corrupted problem in database . nand can't drop the corrupted redo log . I have   recover the database given below following step:

     SQL> select GROUP#,THREAD#,BYTES from v$log;

    GROUP#    THREAD#      BYTES
---------- ---------- ----------
     1         1        52428800
     2         1        52428800
     3         1        52428800

SQL> select MEMBER from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/redo03.log
/u01/app/oracle/oradata/orcl/redo02.log
/u01/app/oracle/oradata/orcl/redo01.log


Create new ones:

SQL > ALTER DATABASE
  ADD LOGFILE GROUP 4 ('/u01/app/oracle/oradata/orcl/redo04.log')
      SIZE 5G;

SQL> ALTER DATABASE

  ADD LOGFILE GROUP 5 ('/u01/app/oracle/oradata/orcl/redo05.log')

      SIZE 5G;

SQL> ALTER DATABASE

  ADD LOGFILE GROUP 6 ('/u01/app/oracle/oradata/orcl/redo06.log')

      SIZE 5G;

Drop the old one:


SQL> ALTER SYSTEM SWITCH LOGFILE;

SQL> ALTER SYSTEM SWITCH LOGFILE;

SQL> ALTER DATABASE DROP LOGFILE GROUP 1;
SQL> ALTER DATABASE DROP LOGFILE GROUP 2;
ERROR at line 1:

ORA-01624: log 2 needed for crash recovery of instance orcl (thread 1)

ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/orcl/redo02.log'
SQL> ALTER DATABASE DROP LOGFILE GROUP 3;

SQL> alter system checkpoint;
SQL> ALTER DATABASE DROP LOGFILE GROUP 2;
(Dropping group 2 is OK after checkpoint)



check the redo log group

SQL> select GROUP#,THREAD#,BYTES from v$log;


    GROUP#    THREAD#       BYTES

---------- ---------- ----------

     4          1     5368709120

     5          1     5368709120

     6          1     5368709120


Thanks.

Oracle 12c Pluggable database (PDB) wise resource used query




 In Oracle 12c have multi tenant feature  i.e we can create multiple pluggable database and pluggable database used hardware resource (i.e memory) vary . Here given below different query we can find out  pdb wise resource.

set linesize 150
set pagesize 3000
set NUMWIDTH 15

col Parameter format a30
col component format a28
COLUMN DEFAULT_ATTR FORMAT A7
COLUMN OWNER FORMAT A15
COLUMN OBJECT_NAME FORMAT A15
COLUMN ALL_CONTAINERS FORMAT A3
COLUMN CONTAINER_NAME FORMAT A10
COLUMN CON_ID FORMAT 999
COLUMN pdb_name FORMAT A20
COLUMN memory Format A25
COLUMN spid HEADING 'OSpid' FORMAT a8
COLUMN pid HEADING 'Orapid' FORMAT 999999
COLUMN sid HEADING 'Sess id' FORMAT 99999
COLUMN serial# HEADING 'Serial#' FORMAT 999999
COLUMN status HEADING 'Status' FORMAT a8
COLUMN pga_alloc_mem HEADING 'PGA alloc' FORMAT 999,999,999
COLUMN pga_used_mem HEADING 'PGA used' FORMAT 999,999,999
COLUMN pga_max_mem HEADING 'PGA Max' FORMAT 999,999,999
COLUMN username HEADING 'oracleuser' FORMAT a12
COLUMN osuser HEADING 'OS user' FORMAT a12
COLUMN program HEADING 'Program' FORMAT a24
COLUMN Mbytes Heading 'Mbytes' FORMAT 999,999,999
COLUMN name FORMAT A22

----check pdb name , container Name and Id
select name, cdb, con_id from v$database;

--Information About Each Container (pluggable database ) Name
SELECT NAME, CON_ID, OPEN_MODE, RESTRICTED, DBID, CON_UID, GUID FROM V$CONTAINERS ORDER BY CON_ID;

----PGA Memory over 10MB size
SELECT p.spid, s.sid, p.con_id, substr(n.name,1,25) memory, ROUND(s.value/1024/1024) as MBytes
FROM v$sesstat s, v$statname n, v$process p, v$session vs
WHERE s.statistic# = n.statistic#
AND n.name LIKE '%pga memory%'
AND s.sid=vs.sid
AND vs.paddr=p.addr
AND s.value > 10000000 ;                                                                      

-------List the large amount memory used process
SELECT pid, spid, con_id, substr(username,1,13) username, program, ROUND(pga_used_mem/1024/1024) pga_used, ROUND(pga_alloc_mem/1024/1024) pga_alloc, ROUND(pga_freeable_mem/1024/1024) pga_freeable, ROUND(pga_max_mem/1024/1024) pga_max
FROM v$process
WHERE pga_alloc_mem = (SELECT max(pga_alloc_mem)
                       FROM v$process
                       WHERE program NOT LIKE '%LGWR%');

-----Summation of ALL PGA based on v$process: allocated includes free PGA memory not yet ---released to the operating system by the server process

SELECT ROUND(SUM(pga_alloc_mem)/1024/1024) AS "Mbytes allocated", ROUND(SUM(PGA_USED_MEM)/1024/1024) AS "Mbytes used"
FROM v$process;

------Summation of each container PGA based on v$process:REM allocated includes free PGA ---memory not yet released to the operating system by the server process

compute sum of "Mbytes allocated" on report
break on report
SELECT con_id, ROUND(SUM(pga_alloc_mem)/1024/1024) AS "Mbytes allocated", ROUND(SUM(PGA_USED_MEM)/1024/1024) AS "Mbytes used"
FROM v$process
group by con_id
order by con_id;


--Summation of ALL PGA memory based on V$SESSTAT:

SELECT ROUND(SUM(value)/1024/1024) AS Mbytes
FROM v$sesstat s, v$statname n
WHERE n.STATISTIC# = s.STATISTIC#
AND n.name = 'session pga memory';

--Summation each container PGA memory based on V$SESSTAT:


compute sum of MBYTES on report
break on report
select con_id, ROUND(sum(bytes)/1024/1024) as MBYTES from (SELECT p.con_id, s.value as bytes
FROM v$sesstat s, v$statname n, v$process p, v$session vs
WHERE s.statistic# = n.statistic#
AND n.name = 'session pga memory'
AND s.sid=vs.sid
AND vs.paddr=p.addr)
group by con_id
order by con_id;

break on off


--PGA stats from V$PGASTAT:
--show max total pga allocated since instance startup

select name, ROUND(value/1024/1024) as Mbytes from v$pgastat
where name in ('maximum PGA allocated','aggregate PGA target parameter','aggregate PGA auto target');


--show max pga allocated from history
select * from (select name,SNAP_ID, ROUND(VALUE/1024/1024) Mbytes from CDB_HIST_PGASTAT
where name='maximum PGA allocated'
order by Mbytes desc,snap_id desc)
where rownum <11 br="">
----The example results below show the largest size a pga has reached is 24MB; the MMON process.
 
break on con_id skip 4
compute sum of pga_alloc_mem on con_id

SELECT p.con_id,
       p.spid,
       p.pid,
       s.sid,
       s.serial#,
       s.status,
       ROUND(p.pga_alloc_mem/1024/1024) as pga_alloc_mem,
       ROUND(p.pga_used_mem/1024/1024) as pga_used_mem,
       ROUND(p.PGA_MAX_MEM/1024/1024) as pga_max_mem,
       s.username,
       s.osuser,
       s.program
FROM v$process p, v$session s
WHERE s.paddr( + ) = p.addr
--AND p.background is null
ORDER BY con_id,pga_alloc_mem;


--user defined parameters sga,pga,memory_target,

select con_id, name as Parameter, value/1024/1024 as Mbytes from v$parameter
where name in ('pga_aggregate_target','memory_target','memory_max_target','sga_max_size','sga_target','pga_aggregate_limit')
order by name;