Kbase P124532: How to generate scripts to run binary dump and load for all tables?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/15/2008 |
|
Status: Verified
GOAL:
How to generate scripts to run binary dump and load for all tables?
GOAL:
Can I automate a binary dump & load?
GOAL:
Is there a script for binary dump & load?
GOAL:
Do I have to do each table separately in a binary dump & load?
GOAL:
How to create scripts to perform a Binary Dump/Load based on database schema
GOAL:
To provide a 4GL program to create a dump.txt script that dumps all of your tables in binary mode, and a load.txt script which will load them.
GOAL:
Binary dump and load scripts
GOAL:
How to generate binary dump and load scripts from 4GL
FACT(s) (Environment):
OpenEdge 10.x
Progress 9.x
Progress 8.2x
Progress 8.3x
All Supported Operating Systems
FIX:
The 4GL code:
DEFINE VARIABLE dir-name AS CHARACTER NO-UNDO FORMAT "X(25)".
DEFINE VARIABLE db-name AS CHARACTER NO-UNDO.
DEFINE VARIABLE front-end AS CHARACTER NO-UNDO.
DEFINE VARIABLE outstring AS CHARACTER NO-UNDO FORMAT "X(100)".
DEFINE VARIABLE delim AS CHARACTER NO-UNDO FORMAT "X(1)".
DEFINE STREAM dumpcmds.
DEFINE STREAM loadcmds.
SET dir-name.
IF OPSYS = "WIN32" THEN
DO:
ASSIGN delim = "~\".
OUTPUT STREAM dumpcmds TO dump.bat.
OUTPUT STREAM loadcmds TO load.bat.
ASSIGN front-end = "call proutil " + DBNAME.
END.
ELSE
DO:
ASSIGN delim = "/".
OUTPUT STREAM dumpcmds TO dump.sh.
OUTPUT STREAM loadcmds TO load.sh.
ASSIGN front-end = "proutil " + DBNAME.
END.
FOR EACH _file WHERE _file-num > 0 AND _file-num < 32768:
ASSIGN outstring = front-end + " -C dump " + _file-name + " " + dir-name.
PUT STREAM dumpcmds outstring SKIP.
ASSIGN outstring = front-end + " -C load " + dir-name + delim + _file-name + ".bd".
PUT STREAM loadcmds outstring SKIP.
END.
OUTPUT STREAM dumpcmds CLOSE.
OUTPUT STREAM loadcmds CLOSE.
This functionality is available starting from Progress 8.2x. The output file that is generated from the sports database on a Unix system looks like the following:
proutil test -C dump Customer junk
proutil test -C dump Invoice junk
proutil test -C dump Item junk
proutil test -C dump Local-Default junk
proutil test -C dump Order junk
proutil test -C dump Order-Line junk
proutil test -C dump Ref-Call junk
proutil test -C dump Salesrep junk
proutil test -C dump State junk
where "junk" is the directory name used as input.
The output file that is generated from a sports database on a Windows system is slightly different:
call proutil test -C dump Customer junk
call proutil test -C dump Invoice junk
call proutil test -C dump Item junk
call proutil test -C dump Local-Default junk
call proutil test -C dump Order junk
call proutil test -C dump Order-Line junk
call proutil test -C dump Ref-Call junk
call proutil test -C dump Salesrep junk
call proutil test -C dump State junk
The call statement is required by DOS (since proutil is a batch file).
NOTE: If you run this on a UNIX system, you must set the execute permission on the command files or specify the shell you want to use in order to execute the scripts above (eg sh dump.sh or sh load.sh). Y.ou set the execute permission on the command files with the following command:
chmod +x dump.sh load.sh
When you load the data into your new database, remember that you must rebuild the indexes using IDXBUILD..