ABL/4GL code to run binary dump and load for all tables
- This functionality is available starting from Progress 8.2x.
- "DBNAME" will populate the database name
- To run a parallel binary dump against an online database, break up the list and create several files renaming each with names like load1.sh, load2.sh, etc. Then run each one of those to perform multiple dump at the same time.
- After binary loading the data into a new database, remember to rebuild the indexes using IDXBUILD.
- When running on UNIX, set the execute permission on the command files or specify the shell to use in order to execute the scripts above (eg sh dump.sh or sh load.sh). Set the execute permission on the command files with the following command:
chmod +x dump.sh load.sh
DEFINE VARIABLE dir-name AS CHARACTER NO-UNDO FORMAT "X(77)".
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.