The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need to write a script in UNIX to find a file if another file exists mmdawg Shell Programming and Scripting 1 05-04-2008 11:40 PM
unix script to takes the old data from a TXT file and compress them into new file vpandey Shell Programming and Scripting 2 03-05-2008 11:10 AM
Shell Script to Load data into the database using a .csv file and .ctl file Csmani Shell Programming and Scripting 3 05-24-2006 09:09 AM
how to find Script file location inside script asami Shell Programming and Scripting 10 03-15-2006 12:57 AM
Reading file names from a file and executing the relative file from shell script anushilrai Shell Programming and Scripting 4 03-10-2006 05:25 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-12-2007
vr76413 vr76413 is offline
Registered User
  
 

Join Date: Jul 2003
Posts: 19
Log file for a Script

Oracle92 on solaris 8.

We have a Truncate Script that runs every night to cleanup certain tables , so new data gets loaded into. This Script is run in Unix Shell script where i set Environment varibles, and things like that..

Now, how do i create a log file of the script , to see weather the script really deleted the data ?

==========================
#!/bin/ksh
ORACLE_BASE=/u10/app/ORACLE
ORACLE_DOC=$ORACLE_BASE/doc
ORACLE_HOME=$ORACLE_BASE/product/9.2.0.1.0
ORACLE_SID=dss
PATH=/usr/bin:/usr/ucb:/usr/sbin:/etc:/usr/inform/PowerMart:/usr/inform/RepServer:/usr/inform/scripts:$ORACLE_HOME/bin:/usr/bin:/bin:/usr/ccs/bin:/usr/ucb:/etc:/usr/openwin/bin:/usr/local/bin:.
TNS_ADMIN=$ORACLE_HOME/network/admin
LD_LIBRARY_PATH=/usr/inform/PowerMart:/usr/inform/RepServer:$ORACLE_HOME/lib32
export PATH PM_HOME ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH TNS_ADMIN
export PARMS=/usr/inform/scripts/WorkFlow/dss_parms
ORADBUSER=`cat $PARMS |grep ORADBUSER|cut -d":" -f2`
ORADBPASSWD=`cat $PARMS |grep ORADBPASSWD|cut -d":" -f2`

$ORACLE_HOME/bin/sqlplus -s << EOF
$ORADBUSER/$ORADBPASSWD
set heading off;
set feedback off;
set echo off;
truncate table current_year;
commit;
=============================

Thanks
Ron
  #2 (permalink)  
Old 04-12-2007
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,245
The simplest way, assuming you are using cron to run the script is to redirect the cron job stdout and stderr to a file.
  #3 (permalink)  
Old 04-12-2007
TheEngineer TheEngineer is offline
Registered User
  
 

Join Date: Apr 2006
Location: Iraq
Posts: 36
Dear

if you are runnning the script from crontab,then the output will be mailed to the owner user.

also you can put the script output in one file and the error in another one as below

your_script.sh > outfile 2> errfile

Regards;
TheEngineer
IBM Certified Specialist
  #4 (permalink)  
Old 04-12-2007
TheEngineer TheEngineer is offline
Registered User
  
 

Join Date: Apr 2006
Location: Iraq
Posts: 36
i see in your script that you do "set echo off", however it is related to oracle ,to see the truncate command output set echo on so you will findout weather it truncate the table or not
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:29 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0