Wednesday, March 24, 2021

Script to Remove the OLD Printer Session in EBS Environment

 #!/bin/bash

file1=/tmp/old1_session.sh

file2=/tmp/old2_session.sh

file3=/tmp/old3_session.sh

file4=/tmp/prn_cnt_ses.log

rm $file3 2> /dev/null

rm $file4 2>/dev/null

lpstat -o ULC-CP1-4-SE-11 | head -10 > $file4

if [ ! -s "$file4" ]

then

echo

echo

echo

echo -e "\t\t\t No Stale Printer Session...Found"

echo -e "\t\t\t Bye......"

echo

echo

echo

cat $file4

exit

fi

lpstat -o ULC-CP1-4-SE-11

if [ $# -ne 2 ]

then

echo

echo '<><><>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>'

echo

echo -e "\t\t\t$0 <Date> <Month>...."

echo

echo '<><><><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>'

echo

echo "Bye.........."

tput clear

exit

fi

lpstat -o ULC-CP1-4-SE-11 | grep -i "$1 $2"  | grep -v grep | awk -F " "  '{print $1}' > $file1

cat $file1 | awk -F "-" '{print $6}' | while read line

do

echo "lprm $line" >> $file2

done

mv $file2 $file3

echo

echo

echo '<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'

echo '<>><><<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>'

echo '<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'

echo

echo

echo "========="

echo "List of $1 $2 Printer Session"

echo "=========="

echo

echo

cat $file3

echo "==================================================================="

echo "To Remove Above Printer  Session Please run below Script"

echo

echo "SYNTAX << . $file3 >>......"

echo


Saturday, March 13, 2021

Shell Script to Capture the User Role, privileges, Object Privileges

 #!/bin/ksh

Schema=AREP

priv()

{

sqlplus -s $ID/$PASS<<EOF

prompt ==========

PROMPT  USER $Schema PRIVILEGS

prompt ==========

SELECT granted_role FROM DBA_ROLE_PRIVS WHERE GRANTEE like upper('%$Schema%');

set line 550

set pages 300

--set serveroutput on size 999999

--undef schema

--accept schema prompt 'Schema :'

prompt dba_role_privs

col GRANTEE for a20

col GRANTED_ROLE for a30

select * from dba_role_privs

where grantee like UPPER('%$Schema%');

prompt dba_tab_privs

set lines 500

col GRANTEE for a50

col OWNER for a20

col PRIVILEGE for a10

col TABLE_NAME for a40

col GRANTOR for a10

select * from dba_tab_privs

where grantee like UPPER('%$Schema%');

prompt dba_sys_privs

col GRANTEE for a19

col PRIVILEGE for a30

select * from dba_sys_privs

where grantee like UPPER('%$Schema%');

PROMPT ROLE GRANTED  TO ROLE

select *

from ROLE_ROLE_PRIVS

where

ROLE IN (select granted_role from DBA_ROLE_PRIVS where grantee like upper('%$Schema%'));

prompt ROLE_TAB_PRIVS

PROMPT

col ROLE for a10

col OWNER a10

col TABLE_NAME for a40

col COLUMN_NAME for a20

col PRIVILEGE for a40

select *

from ROLE_TAB_PRIVS

where

ROLE in(

SELECT granted_role

FROM DBA_ROLE_PRIVS

WHERE GRANTEE like upper('%$Schema%'));

PROMPT ROLE PRIVILEGES

col GRANTEE for a49

col owner for a10

col PRIVILEGE for a30

SELECT *

FROM DBA_TAB_PRIVS

WHERE GRANTEE IN

(SELECT granted_role

FROM DBA_ROLE_PRIVS

WHERE GRANTEE like upper('%$Schema%'));

EOF

}

priv > /tmp/priv_nil1.log

vi /tmp/priv_nil1.log


Monday, March 8, 2021

Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5

 [grid@abt2 install]$ rootcrs.pl -deconfig -force -verbose

[grid@abt2 install]$ /u001/app/12.2.0/grid/crs/install/rootcrs.pl -deconfig -force -verbose

Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /u001/app/12.2.0/grid/crs/install /u001/app/12.2.0/grid/crs/install/../../perl/lib) at crsinstall.pm line 286.

BEGIN failed--compilation aborted at crsinstall.pm line 286.

Compilation failed in require at /u001/app/12.2.0/grid/crs/install/rootcrs.pl line 165.

BEGIN failed--compilation aborted at /u001/app/12.2.0/grid/crs/install/rootcrs.pl line 165.


fix of this issue  is included in 12.1.0.2,  But  workaround is to use the perl in GI home.

Solution.

/u001/app/12.2.0/grid/perl/bin/perl  /u001/app/12.2.0/grid/crs/install/roothas.pl -deconfig -force

As per Oracle Document used 

In 12.1.0.2, rootcrs.sh/roothas.sh should be used instead of rootcrs.pl/roothas.pl.


Alternate Solution.

[root@abt2 5.22.0]# cd /usr/share/perl5/vendor_perl

[root@abt2 vendor_perl]# ls

App/      Business/  constant.pm  Digest.pm  Error.pm     ExtUtils/  Getopt/  HTML/               IO/    Mozilla/      parent.pm    RPC/                  Test/    Time/

Archive/  Carp/      Date/        Encode/    Exporter/    File/      Git/     HTTP/               LWP/   Net/          perldoc.pod  spamassassin-run.pod  Text/    WWW/

Bundle/   Carp.pm    Digest/      Error/     Exporter.pm  Foomatic/  Git.pm   IBswcountlimits.pm  Mail/  newgetopt.pl  Pod/         TAP/                  Thread/  XML/

[root@abt2 vendor_perl]# pwd

/usr/share/perl5/vendor_perl

[root@abt2 vendor_perl]# ls Env.pm*

ls: cannot access Env.pm*: No such file or directory

[root@abt2 vendor_perl]# ls -ltr /u001/app/12.2.0/grid/perl/lib/5.22.0/Env.pm

-rwxr-x--- 1 grid oinstall 5524 Mar  1  2020 /u001/app/12.2.0/grid/perl/lib/5.22.0/Env.pm*

[root@abt2 vendor_perl]# cp  -i /u001/app/12.2.0/grid/perl/lib/5.22.0/Env.pm .

[root@abt2 vendor_perl]# ls -ltr Env.pm*

-rwxr-x---  1 root root  5524 Mar  3 02:13 Env.pm*


On other Node.

[root@abt1 ~]# /u001/app/12.2.0/grid/crs/install/rootcrs.pl -deconfig -force -verbose

Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /u001/app/12.2.0/grid/crs/install /u001/app/12.2.0/grid/crs/install/../../perl/lib) at /u001/app/12.2.0/grid/crs/install/crsinstall.pm line 286.
BEGIN failed--compilation aborted at /u001/app/12.2.0/grid/crs/install/crsinstall.pm line 286.
Compilation failed in require at /u001/app/12.2.0/grid/crs/install/rootcrs.pl line 165.
BEGIN failed--compilation aborted at /u001/app/12.2.0/grid/crs/install/rootcrs.pl line 165.

[root@abt1 ~]# cd /usr/share/perl5/vendor_perl
[root@abt1 vendor_perl]# cp  -i /u001/app/12.2.0/grid/perl/lib/5.22.0/Env.pm .
[root@abt1 vendor_perl]# /u001/app/12.2.0/grid/crs/install/rootcrs.pl -deconfig -force -verbose

Using configuration parameter file: /u001/app/12.2.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u001/app/grid/crsdata/abt1/crsconfig/crsdeconfig_abt1_2021-03-08_08-13-27PM
.l

PRCR-1070 : Failed to check if resource ora.net1.network is registered

CRS-0184 : Cannot communicate with the CRS daemon.

PRCR-1070 : Failed to check if resource ora.helper is registered

CRS-0184 : Cannot communicate with the CRS daemon.

PRCR-1070 : Failed to check if resource ora.ons is registered

CRS-0184 : Cannot communicate with the CRS daemon.

2021/03/08 20:13:40 CLSRSC-180: An error occurred while executing the command '/u001/app/12.2.0/grid/bin/srvctl config nodeapps'

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'abt1'

CRS-2673: Attempting to stop 'ora.evmd' on 'abt1'

CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'abt1'

CRS-2673: Attempting to stop 'ora.ctssd' on 'abt1'

CRS-2673: Attempting to stop 'ora.crf' on 'abt1'

CRS-2673: Attempting to stop 'ora.mdnsd' on 'abt1'

CRS-2673: Attempting to stop 'ora.gpnpd' on 'abt1'

CRS-2677: Stop of 'ora.drivers.acfs' on 'abt1' succeeded

CRS-2677: Stop of 'ora.crf' on 'abt1' succeeded

CRS-2677: Stop of 'ora.ctssd' on 'abt1' succeeded

CRS-2677: Stop of 'ora.evmd' on 'abt1' succeeded

CRS-2673: Attempting to stop 'ora.asm' on 'abt1'

CRS-2677: Stop of 'ora.gpnpd' on 'abt1' succeeded

CRS-2677: Stop of 'ora.mdnsd' on 'abt1' succeeded

CRS-2677: Stop of 'ora.asm' on 'abt1' succeeded

CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'abt1'

CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'abt1' succeeded

CRS-2673: Attempting to stop 'ora.cssd' on 'abt1'

CRS-2677: Stop of 'ora.cssd' on 'abt1' succeeded

CRS-2673: Attempting to stop 'ora.gipcd' on 'abt1'

CRS-2677: Stop of 'ora.gipcd' on 'abt1' succeeded

CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'abt1' has completed

CRS-4133: Oracle High Availability Services has been stopped.

2021/03/08 20:15:19 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector.

2021/03/08 20:15:58 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector.

2021/03/08 20:15:59 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node


Reference:-