Export table and restart from last table


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
Export table and restart from last table

Hello all,

Thank you in advance for reading my post and helping me..

Scenario:

I have 50 tables whose names are in a file export.sql, i use the below command to export all these tables one by one
Code:
cat export.sql|while read tn
      do
       echo "export to $tn.del of del select from $tn"
     done

Problem:

The problem is when this job stops some where in between working on these 50 tables, for ex on 24th table. When i restart the script, i would like the script to know the last worked table name and then continue from the next table so that i dont backup the table twice.

Please help me out and let me know if any questions


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks
# 2  
How does the full script looks like? How are you piping the info into sql? is it sql?
# 3  
The problem is, your script doesn't know the last table the database successfully imported -- it only knows what ones it printed.

If these are long operations, then I wouldn't see any harm in running these operations individually instead of piping them all into one database call. That way you could tell when the database finished, by when the DBMS quits. You'd also get its return value, which is useful to check.

How to do this depends on what your code is, as ahmed101 said.
# 4  
The above mentioned operation prints individual export commands into a different file which is run against the database.

But with this approach i am not having any control on restarting the job as it would start from beginning.

please let me know if you still have questions on this..thank you in advance
# 5  
We require information from you. We don't know what DBMS utility you're using. What, exactly, do you type to run that output file against the database?
# 6  
i am using db2 for this

1. i have all the tables in a file export.sql
2. i use the below script to print all the export statements to another file

Code:
cat export.sql|while read tn
      do
       echo "export to $tn.del of del select from $tn"
     done

3. i run the final file with db2 -tvf filename through cron
# 7  
Can't you either remove each table exported from that file or write each table exported to a log file to be eliminated from export.sql (e.g. grep -v) for the next run?
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Science: Gadgets
Difficulty: Easy
Microphones can be used not only to pick up sound, but also to project sound similar to a speaker.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Export HTML table

HI , I have a HTML tables as below. It has 2 tables ,I want to extract the second table . Please help me in doing it. <html> <body> <b><br>Running Date: </b>11-JAN-2019 03:07</br> <h2> Schema mapping and info </h2> <BR><TABLE width="100%" class="x1h" cellpadding="1"... (3 Replies)
Discussion started by: deepti01
3 Replies

2. UNIX for Advanced & Expert Users

How can i export entries from table into a variable and parse them?

Hi, I need to export some entries from a table, from a specific column and then redirect them into a file. I used sql plus, in order to fetch the entries and i put them in one variable. When i am running the script it stuck at a point and does not move further. I did something like: ... (4 Replies)
Discussion started by: cookie2
4 Replies

3. Linux

Parsing - export html table data as .csv file?

Hi all, Is there any out there have a brilliant idea on how to export html table data as .csv or write to txt file with separated comma and also get the filename of link from every table and put one line per rows each table. Please see the attached html and PNG of what it looks like. ... (7 Replies)
Discussion started by: lxdorney
7 Replies

4. Shell Programming and Scripting

Export table of 50 columns

Dear all, I have a big table of 50 columns and more then 100, 000 rows in mysql. Could you please help me that how I can export it as .csv or . txt that I can open it in MS excel????? OR how can I export the specific columns of the table??? Thanks AAWT (5 Replies)
Discussion started by: AAWT
5 Replies

5. Shell Programming and Scripting

Shell script to export data from Oracle table .

Hi, I want to write a shell script which will export data from oracle table . I don't want to save that data . I want the queries . Right now i am right clicking on the table and clicking on export as to my desktop . Please let me know if any one have any idea . (2 Replies)
Discussion started by: honey26
2 Replies

6. Shell Programming and Scripting

How to export table data to xml file?

Hi , I would like to get some suggestion from the experts. My requirement is to export oracle table data as an xml file. Any unix/linux tools, scripts available? Regards, (2 Replies)
Discussion started by: LinuxLearner
2 Replies

7. Shell Programming and Scripting

Problem in scheduling an Export of a table

Hi, I am facing a problem while scheduling an export of a table using cron job. I have written a simple export command inside a shell script test.sh like echo started exp schemaname/temp1234 file= /test/d.dmp tables=per_st log= /test/d.log echo ended I tried scheduling it through... (6 Replies)
Discussion started by: beautifulmind
6 Replies

8. Shell Programming and Scripting

Export a HTML table to Xcel

Hello All, I have a perl script that prints a HMTL table. I want to convert this data into a report and this want to export this information into Excel. How can I do this? Regards, garric (3 Replies)
Discussion started by: garric
3 Replies

9. Shell Programming and Scripting

help for writing shell script to export table data

Hi All, I need to write a shell script(ksh) to take the tables backup in oracle(exporting tables data). The tables list is not static, and those are selecting through dynamic sql query. Can any body help how to write this shell script. Thanks, (3 Replies)
Discussion started by: sankarg
3 Replies

10. Shell Programming and Scripting

export table from oracle database

i would like to export a particular table in my oracle database installed in a hpux box. i would like to determine the filesize of the output before performing these action so i can assess if my harddisk can still handle it. thanks as usuall :rolleyes: (1 Reply)
Discussion started by: inquirer
1 Replies

Featured Tech Videos