LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-26-2011, 06:17 AM   #1
kais1
Member
 
Registered: Dec 2008
Posts: 61

Rep: Reputation: 17
Script help


When am running the below script.

{code}
Script :



#!/bin/sh
ORACLE_BASE=/medt/appl/oracle export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/102 export ORACLE_HOME
ORACLE_SID=meds1 export ORACLE_SID
PATH=/usr/ccs/bin:$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/medt/oracrs/product/102/bin
export PATH
DATE_SUFFIX=`date +%b%d.%H%M`
tmpdir=/medt/work/scripts/jobs/logs
tmpfile="$tmpdir/SESSmeds1$DATE_SUFFIX.log"
sqlplus medsbkp/medsbkp@meds1i as sysdba <<EOF
set timing on
spool $tmpfile
select p.spid from v\$process p,v\$session s where s.paddr=p.addr and s.status='SNIPED' and s.type!='BACKGROUND';
spool off
exit
for x in `cat $tmpfile | grep "^[0123456789]"`
do
kill -9 $x
done
exit
EOF
{code}

It returns the value from sql, but it doesn't kill the session as expected
as you can see below

tabsdb01raccbs:/medt/work/scripts/jobs$ sh killsnipsess.sql
cat: cannot open /medt/work/scripts/jobs/logs/SESSTABS1Dec26.1419.log

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Dec 26 14:19:18 2011

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> SQL> SQL>
SPID
------------
1357

Elapsed: 00:00:00.01
SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options


This file /medt/work/scripts/jobs/logs/SESSTABS1Dec26.1419.log is created and the output of the script is

SQL> select p.spid from v$process p,v$session s where s.paddr=p.addr and s.status='SNIPED' and s.type!='BACKGROUND';

SPID
------------
1357

Elapsed: 00:00:00.01
SQL> spool off


Any idea what am missing ?

Kai
 
Old 12-26-2011, 07:13 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,699
Blog Entries: 23

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Have you tried to use pkill instead? Just an after-christmas thought...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash and xterm: how make apps started by and for a script persist when script terminates porphyry5 Linux - General 4 06-15-2011 02:27 PM
[SOLVED] Script question: Shell script in kde to log in on a server with ssh c4719929 Programming 18 01-31-2011 10:26 AM
[SOLVED] Script question: create a shell script in kde to log in on a server with ssh c4719929 Linux - Newbie 1 01-31-2011 04:05 AM
Runs Multiple shell script inside a main script using crontab srimal Linux - Newbie 4 10-22-2009 07:19 PM
How to get full path to script file inside script itself? And in case of sym links? maggus Linux - Newbie 3 05-28-2009 09:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration