The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Database-Based Authentication for PHP Apps iBot Oracle Updates (RSS) 0 04-06-2008 02:10 AM
ccall database and collect data from one table rinku Shell Programming and Scripting 0 05-27-2007 10:16 PM
Upload of the images from the folder to the Database table shashisaini24 UNIX for Advanced & Expert Users 0 11-29-2006 02:03 AM
how to insert data in database based on text file? forevercalz Shell Programming and Scripting 9 12-20-2005 07:40 PM
export table from oracle database inquirer Shell Programming and Scripting 1 06-24-2003 06:48 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-29-2007
Registered User
 

Join Date: Aug 2007
Posts: 1
Delete database table based on months using script.

HI All,

Newbie here.
I have a script which generates the tables in teradata database with time stamp like below.I want to add some more code to delete the archive tables which are 2months old.

. $HOME/.profile
t_name=$1
procdate=`date +%y%m%d`
log_dir=$Folder/log
tab=`echo $t_name"_"$procdate`
tab_create=$log_dir/$t_name.txt
param_dir=$Folder/parameter
echo ".run file=$param_dir/logon.txt;" > $tab_create
echo "DATABASE XYZ;" >> $tab_create
echo ".echoreq off;" >>$tab_create
echo ".SET FOLDLINE off; " >>$tab_create
echo "rename table $t_name to $tab;" >> $tab_create
echo ".if errorcode =3803 then .goto prob38;" >> $tab_create
echo "create table $t_name as $tab with no data;" >> $tab_create
echo ".quit;" >> $tab_create
echo ".LABEL prob38" >> $tab_create
echo "drop table $tab;" >> $tab_create
echo "rename table $t_name to $tab;" >> $tab_create
echo "create table $t_name as $tab with no data;" >> $tab_create
echo ".quit;" >> $tab_create
echo "EOF" >> $tab_create
bteq < $tab_create> $log_dir/$tab_create_$tab.log

Can someone help me on this..

Thanks.

Regards,
Mav.
Reply With Quote
Google UNIX.COM
Forum Sponsor
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0