Home » Infrastructure » Unix » shell script problem
shell script problem [message #147038] Tue, 15 November 2005 08:18 Go to next message
abcklm
Messages: 8
Registered: November 2005
Junior Member
I have to write shell script, which will be kicked off daily at 5 PM.That shell script runs sql plus which runs the SQL quey in production instance using userid/password. After querying the result has to be stored in shared drive X://Apps/USERS_LIST/20051114. (20051115 means todays date 2005-11-15. Using of TODAY'S DATE in outputfile will make that file unique). Ultimate goal is to get active users list every day at 10 PM.Here the sql query is

SELECT USER_NAME
FROM FND_USER
WHERE END_DATE IS NOT NULL

I need help in this..
Re: shell script problem [message #147043 is a reply to message #147038] Tue, 15 November 2005 08:25 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Please post what you have done, until now.
>> shared drive X://Apps/USERS_LIST/20051114
Is that a samba share?
Re: shell script problem [message #147044 is a reply to message #147038] Tue, 15 November 2005 08:30 Go to previous messageGo to next message
abcklm
Messages: 8
Registered: November 2005
Junior Member
Its regular drive where everyone stores their results so that every one can access.

test.sh:
sqlplus username@SID/password< test.sql

test.sql:
SET echo off;
SET pagesize 0;
SET heading off;
SPOOL test.dat
SELECT USER_NAME,DESCRIPTION
FROM FND_USER
WHERE END_DATE IS NOT NULL;
SPOOL off
Re: shell script problem [message #147050 is a reply to message #147044] Tue, 15 November 2005 08:59 Go to previous message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Private messaging will not get you a faster response.

oracle@mutation#test1

somedata

the output file is /tmp/20051115.dat
oracle@mutation#cat /tmp/20051115.dat

somedata

oracle@mutation#cat test1
#!/bin/bash
d=`date "+%Y%m%d"`
sqlplus -s scott/tiger <<EOF
-- add your set commands
set head off;
SPOOL /tmp/$d.dat
select 'somedata' from dual;
spool off;
exit;
EOF
echo "the output file is /tmp/$d.dat"

[Updated on: Tue, 15 November 2005 10:46]

Report message to a moderator

Previous Topic: solaris to linux
Next Topic: Mount Point Installation Problem
Goto Forum:
  


Current Time: Mon Nov 25 19:59:42 CST 2024