Hi,
I am trying to export some 50 tables and i want to write a loop and execute the script for every table. I did for one table and its running. Can any one help me for setting a loop and running the script for all the tables
thanks
How about a few details here? System? OS? Language? Database? Also post the script you have for the one table.
Its oracle Database and os is linux I want it to do it in shell
here is what i did
#!/usr/bin/sh
dumptime=`date '+%Y %m %d:%H:%M:%S' | sed -e 's/ //g' `
user=username
password=password
tables=(table1)
exp $user/$password buffer=2000000 file=$user.qwer.dmP.$dumptime log=qwer.log.$dumptime tables=$tables compress=N direct=Y grants=N consistent=Y statistics=NONE
I can write a query to display all the tables in to a file . I want to take every single table from the file and do the export the schema
After you spool the list of tables to a file called tables.lst in the current directory, this will loop through the list one at a time:
#!/usr/bin/sh
dumptime=`date '+%Y %m %d:%H:%M:%S' | sed -e 's/ //g' `
user=username
password=password
for table in `cat tables.lst`
do exp $user/$password buffer=2000000 file=$user.qwer.dmP.$dumptime log=qwer.log.$dumptime tables=$table compress=N direct=Y grants=N consistent=Y statistics=NONE
done
Or this will build a list of tables
#!/usr/bin/sh
dumptime=`date '+%Y %m %d:%H:%M:%S' | sed -e 's/ //g' `
user=username
password=password
tables=`cat tables.lst | tr \\n " "`
tables=\(${tables}\)
exp $user/$password buffer=2000000 file=$user.qwer.dmP.$dumptime log=qwer.log.$dumptime tables=$tables compress=N direct=Y grants=N consistent=Y statistics=NONE
thankyou very much. Can you please guide me where should i put the tables.lst file which contains all the list of tables.
thanks
/tmp should be fine
thanks its working perfectly 