Sei sulla pagina 1di 2

Sample script to connect to oracle database

May 12, 2011 ukatru Leave a comment


Here is the sample script to connect to oracle database and get value.
sqllog=tmpsqllog.dat
spoolout=tmpspool.out
sqlplus !s nolog ""#$% & 'sqllog
set term o((
set head o((
set linesi)e *00
set (eedback o((
set trimspool on
set serveroutput on
+henever oserror e,it
+henever sqlerror e,it sql.sqlcode
connect $ra-ser$ra.ass+ord/$ra0ame
spool 'spoolout
select 1 (rom dual2
spool o((
e,it
#$%
rc='3
i( 44 'rc 5= 0 662then
echo 7unable to connect to oracle database8
(i
9ategories: ;atastage!-ni, <cripts
Script to check datastage job is multi instance or not
=pril 2>, 2011 ukatru Leave a comment
?he (ollo+ing script can be used to check i( the given datastage @ob is multi instance or not.
=rguments to the <cripts:
=rg1:;atastage .ro@ect 0ame
=rg2:Aob0ame
B5binksh
<cript0ame='CDbasename '0E
i( 44 'B 5= 2 662then
print( 7#rror: '<cript0ame F Gequired parameterCsE +as not supplied5DnDn8
print( 7-sage: '<cript0ame ".ro@ect& "Aob0ame&DnDn8
print( 7 ".ro@ect& : is the unique identi(ier (or the datastage pro@ect, requiredDn8
print( 7 "Aob0ame& : is the ;atastage Aob0ame, requiredDn8
e,it 1
(i
.ro@ect='1
Aob0ame='2
echo 7step HHH: checking @ob +hether it is multiinstance or not8
;<H$M#=Icat .dshomeI
tmp%ile=tmp9heckAob?ype.tmp
cd ';<H$M#
binuvsh ""5 & 'tmp%ile
L$J?$ '.ro@ect
<#L#9? KAob?ype:LMM#N=L
7?G=0<CK;<OA$P$PA#9?<L,QADL:/G#9$G;"R&:LDG$$?L,RS,LTQE8 %G$M ;<OA$P<
UH#G# 0=M# = K'Aob0ameL2
5
i( 44 '3 5= 0 662 then
echo 79heckAob?ype F unable to determine @obtype (or @ob 'Aob0ameh in '.ro@ect datastage
pro@ect58
e,it 1
(i
Aob?ype='CDgrep 7VAob?ype:8 'tmp%ile MDcut !( 2 !d
i( 44 !) 'Aob?ype 662 then
echo 79heckAob?ype F Aob 'Aob0ame not (ound in '.ro@ect datastage pro@ect. Aob?ype cannot
be determined58
Drm !( 'tmp%ile
e,it 1
(i
i( 44 'Aob?ype !eq 0 662 then
echo 711111'Aob0ame is not a multi instance @ob111118
else
echo 711111'Aob0ame is multi instance @ob111118
(i
Drm !( 'tmp%ile
e,it 0

Potrebbero piacerti anche