Is there a way I can unload multiple tables along with their reload scripts instead of doing one at a time from sybase central. usually reload script is just named reload.sql but in this case off course I am going to be able to call each reload script associated with .dat file its own unique name.

asked 25 Jun '12, 10:45

javedrehman's gravatar image

javedrehman
256141421
accept rate: 0%

edited 25 Jun '12, 13:10

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297


I would think your requirements would be met by the -t option with dbunload, along with -r to name the output file.

permanent link

answered 25 Jun '12, 11:08

Glenn%20Paulley's gravatar image

Glenn Paulley
10.8k576106
accept rate: 43%

When you are using Sybase central to do the unload, I don't really understand your question. The Unload Wizard in Sybase central allows multi selection. On the page "Unload the selected tables only" just select more than one table and add them to the right side. Or is this not what you are looking for?

If you want to reload them individually have a look at the contents of the reload.sql script, for each table an individual block of code exists which is sufficient to load that particular table data.

permanent link

answered 26 Jun '12, 03:08

Martin's gravatar image

Martin
9.0k130169257
accept rate: 14%

From your new comment I conclude that you are primarily interested in exporting the data (and not the database schema) and have lots ot tables.

So a different approach would be to use the UNLOAD TABLE statement, and use a small SELECT/OUTPUT statement block to generate a SQL batch with according UNLOAD statements, such as:

select 'UNLOAD TABLE "' || table_name || '" TO ''C:\\MyDataDump\\' || table_name || '.dat'';'
from systab
where table_name like 'syst%' -- adapt to whatever table name (or owner) filter you require
order by table_name;
output to 'MyTableUnloadBatch.sql' format text quote '';

This will generate a SQL batch with statements like:

UNLOAD TABLE "SYSTAB" TO 'C:\\MyDataDump\\SYSTAB.dat';
UNLOAD TABLE "SYSTABAUTH" TO 'C:\\MyDataDump\\SYSTABAUTH.dat';
...

Obviously, this does not work for table names with characters that are not allowed in file names nor does it handle non-unique table names with different owners - but that could be easily added...

permanent link

answered 26 Jun '12, 09:20

Volker%20Barth's gravatar image

Volker Barth
40.1k361549819
accept rate: 34%

edited 26 Jun '12, 09:23

nice approach to automate it!

(26 Jun '12, 11:07) Martin
Replies hidden

Well, just something from the migration tool set, particularly the "dump and compare data from different databases" section...

Interestingly, I tend to use OUTPUT to generate such script files and use UNLOAD inside them - a somewhat asymmetrical approach:)

(26 Jun '12, 15:50) Volker Barth

Have a look at the dbunload utility. It might be what you're looking for.

permanent link

answered 25 Jun '12, 11:05

Phil%20Mitchell's gravatar image

Phil Mitchell
1.9k1831
accept rate: 27%

thanks to all who responded, it seems like the unload wizard as per one of the answers may be what I am looking for. I will try it and let everyone know if that works. As for the clarification of my initial question I am not doing a dbunload rather I am unloading only selected tables and I am using sybase central unload wizard. I am unloading one table at a time and unloading 1015 tables was taking too long to do it individually.

(26 Jun '12, 08:37) javedrehman
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×128
×52
×48

question asked: 25 Jun '12, 10:45

question was seen: 4,634 times

last updated: 26 Jun '12, 15:50