Tag Archives: Thanks Regards

Connect once db discionnect after all ececution

By krupasindhu18

Hi All,

Please see the below code.

it is working fine when in ‘test_file’ have only one emplid.

test_file contains only emplid and date, like below …
0000221|1/12/2003
0000223|1/1/1996

Problem :-
when test_file contains more then one records(emplids) it is not giving any errors but it is disconnecting from database and
always connecting to database for each and every emplid..

But i want once connect to data base and after perform all execution it would disconnect from data base.
Please help me on this problem.

HTML Code:

#!/bin/sh
set -x
echo "test for multiple values"
UIDPSWD=`cat /projects/feeds/twest/uidpswd`
echo "oracle connection test"
full=/projects/feeds/twest/test_file
#values=`cut -d'|' -f1 $full|sed -e "s/.*/'&'/" -e 's/$/;/g' -e '$s/,$//'`
#below command will work in bourne shell
#values=(`awk -F"|" '{print $1}' $full`)
#below command will work in korn shell
set -A values $(awk -F"|" '{print $1}' $full)
for i in ${values[*]}
do
sqlplus -s $UIDPSWD <>/projects/feeds/twest/result.txt
set serveroutput on
set verify off
set heading off
set feedback off
set ECHO OFF
--spool /projects/feeds/twest/ouput_file.txt
declare
cursor c1
is select emplid,ACTION,ACTION_DT,ACTION_REASON
from ps_job
where emplid='$values';
c2 ps_job%rowtype;
begin
DBMS_OUTPUT.PUT_LINE( 'emplid'|| chr(9) ||'ACTION'|| chr(9) ||'ACTION_DT'|| chr(9) ||'ACTION_REASON');
for i in c1 loop
EXIT WHEN c1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(i.emplid|| chr(9) ||i.action||chr(9)||i.action_dt||chr(9)||i.ACTION_REASON);
end loop;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('test Update query: ' || SQLERRM);
end;
/
exit;
EOF
done


Thanks & Regards,
Krupa

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

Binary Operator expected while executing the below shell script.

By Jagadish m

Hi Experts,

Iam bit poor in shell scripting,
Here my requirement is for generating an alert where the oracle database db_recovery_file_dest_size usage. If it reaches beyond 80% should recieve an alert through an email.

Want to schedule this alert in cron.

#!/bin/bash
. /home/oracle/prod.env
echo ” “
echo =======================================================================
echo archive_usage.sh: $ORACLE_SID
echo To know the Archive/Db_recovery_area usage
date +”%A, %B %e, %r”
echo ———————————————————————–
status=$(sqlplus -S system/PWD@$ORACLE_SID << ENDINP
set feedback off
set hea off
set verify off
SELECT METRIC_VALUE FROM SYS.DBA_OUTSTANDING_ALERTS where reason like ‘%db_recovery_file_dest_size%’
/
exit
ENDINP)
status=`echo $status`
echo “Archive Area usage is:” $status
if [ $status >= 80 ]; then
mailx -s “PROD – Archive Area Usage is growing” “mjcprasad2000@gmail.com
Production PROD ARCHIVE Area is above 85%!!
exit 1
else
mailx -s “PROD – Not in Thresholds” “mjcprasad2000@gmail.com
exit 0
fi

Please help me in sorting out this issue. 🙂

Thanks & Regards,
—————–
Jagadish.
Oracle Apps DBA.

From: http://www.unix.com/shell-programming-scripting/221133-binary-operator-expected-while-executing-below-shell-script.html

Find out special characters from xml file

By Krishanu Saha

Hi….I have a xml file which is having lots of special characters which I need to find out and put the distinct list of those into a text file. The list of special characters is not specific, it can be anything at different point of time.

Can anyone help me to find out the same and list out?

I’m using KSH script.

Thanks & Regards,
Krishanu Saha

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Inotifywait tool in no there in Redhat 5.6

By Pawan Kumar

Hi,

I want to monitor any new file to be created in some of the directory using inotifywait tool but this is not available in Redhat 5.6.

Could you please let me know how to achieve (monitoring of file) without using inotifywait too? Because i dnt want to install this tool due to some reason.

I want to achieve this task in some other way without installing any other component.

Please advise.

Thanks & Regards,
Pawan

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

/dev/null file issue

By jayadeava

Hi Experts,

I Have a query. In one of my server I just came to know that there was /dev/null file which is a not a character file. Its just a normal file. I know the command to create the character file (/dev/null) but what is the procedure. Like should i delete /dev/null and create or anything else. I have a doubt that we can’t remove /dev/null right ?

Expected format:
crw-rw-rw- 1 root system 2, 2 Feb 25 15:13 /dev/null

Format in my server:
-rw-rw-rw- 1 root system 0 Feb 25 15:22 /dev/null

Thanks & Regards,
B. Jayadeava

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Coloring the pattern match

By poova

Hi All,

Can we have colour the matched pattern with any color using unix command? For example I have a very length line a file and I’m applying grep on that file.

grep “matched pattern” filename.txt

My output is like below,

………..matched pattern……………………………..

Can we print the output like below,

………..matched pattern……………………………..

print the identified the pattern in different color.

Thanks & Regards,
Poovalingam.

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Need To Delete Lines Based On Search Criteria

By angshuman

Hi All,

I have following input file. I wish to retain those lines which match multiple search criteria. The search criteria is stored in a variable seperated from each other by comma(,).

HTML Code:


SEARCH_CRITERIA = "REJECT, DUPLICATE"

Input File:

ERROR,MYFILE_20130214_11387,9,37.75
REJECT,MYFILE_20130214_12486,1,20
DUPLICATE,MYFILE_20130214_12486,8,17.75
REJECT,MYFILE_20130214_14903,9,37.75
ERROR,MYFILE_20130214_17108,9,37.75
DUPLICATE,MYFILE_20130214_1811,0,0


My ouput file should look like below:

HTML Code:

REJECT,MYFILE_20130214_12486,1,20
DUPLICATE,MYFILE_20130214_12486,8,17.75
REJECT,MYFILE_20130214_14903,9,37.75
DUPLICATE,MYFILE_20130214_1811,0,0


Thanks & Regards
Angshuman

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

ZIPX library?

By Indalecio

Hello,
Our system on a Redhat platform is generating ZIP archives that we then send to another system on a Windows machine. I have no issue generating a ZIP file containing up to 2GB worth of data and 350k files, I can unzip all contents on the machine with no issue, however the remote system on Windows is using WinZip 17 to extract the files and it has a limitation of maximum 65k files in the ZIP.

I am therefore exploring the possibility to send them a zipx archive instead, as they are convinced they would be able to handle this volume of files in this format, however I can’t find anything on the internet showing zipx support for Redhat? I know zipx is quite a new format, but I´m surprised I can’t find any library on the internet that I could test on my machine. Any advice?

Thanks & Regards
Yann

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums