batch update of table on multiple databases, is this possible?

danozard

New Member
Hi,
I was wondering if it was possible to create a batch script that would update table that is common to a number of databases so as to save time from logging on each db manually and update the tables one at a time.

I do have a script that can make a backup of all the databases which share the same tables as each other , as well as shut them all down and restart them with one script but none for a batch db update.

The progress db in question is Open Edge on HP UX Itanium 64 bit server.

How would i go about creating a script that can add, say Field 1 to Table ABC on all 8 dbs?

Thanks in advance.
 

tamhas

ProgressTalk.com Sponsor
It sounds like you want to make schema changes on multiple databases?

If so, the basic technique here is to have a reference version and your desired new version and then to connect to both to create what is called an incremental .df file. This will contain the commands to change the reference version into the new version. Assuming your other databases all match the reference version, this provides the basic tool you need to change them all equivalently. Done right, you can even keep these in sync so that the same r code will work on all.

As for doing by scripts, there are routines in the data dictionary which can be called from small ABL wrappers to automate the procedure, but I haven't done that in ages, so someone else will have to tell you then name of the procedure to call. It isn't hard to sort out of the dictionary code if you unpack the procedure library, but it is a bit ugly on the inside! :)
 

Casper

ProgressTalk.com Moderator
Staff member
As for doing by scripts, there are routines in the data dictionary which can be called from small ABL wrappers to automate the procedure, but I haven't done that in ages, so someone else will have to tell you then name of the procedure to call. It isn't hard to sort out of the dictionary code if you unpack the procedure library, but it is a bit ugly on the inside! :)

Basically you need to write a 4GL Program which apart from some logging you might want to add includes the following:
Code:
if session:parameter = "" or session:parameter = ?
then return.
create alias DICTDB for database [I]<[/I]databasename>.
run prodict/load_df.p(session:parameter) no-error.
delete alias DICTDB.

You give the name of the input file (df file) as a parameter with the -param parameter.

You can call this program from your script.
for instance:
TERM=vt100 _progres blabla -p loaddf.r -rx -param name-df-file

Casper
 
Top