Difference between revisions of "Copy SQL Database"
From MidrangeWiki
(New utility program) |
m (added link to devworks article) |
||
Line 46: | Line 46: | ||
</pre> | </pre> | ||
+ | |||
+ | This program is based on an [http://www.ibm.com/developerworks/data/library/techarticle/0305milligan/0305milligan.html#section3 article] written by Kent Milligan for Developerworks. | ||
[[Category:SQL]] | [[Category:SQL]] | ||
[[Category:Utilities]] | [[Category:Utilities]] |
Latest revision as of 17:44, 29 November 2010
The following CL program can be used to automatically copy a SQL database from one library to another.
This program requires V5R4 or higher.
/* Copy SQL database to a new library on a single system. */ /* */ /* Copyright 2010 David Gibbs (david@midrange.com) */ /* */ /* This program is licensed under the Creative Commons Attribution */ /* 3.0 Unported license http://creativecommons.org/licenses/by-sa/3.0/ */ PGM PARM(&FROMLIB &TOLIB) DCL VAR(&FROMLIB) TYPE(*CHAR) LEN(10) DCL VAR(&TOLIB) TYPE(*CHAR) LEN(10) DCL VAR(&QSHCMD) TYPE(*CHAR) LEN(80) CRTSAVF FILE(QTEMP/CPYSQLDB) MONMSG MSGID(CPF0000) CLRSAVF FILE(QTEMP/CPYSQLDB) SAVLIB LIB(&FROMLIB) DEV(*SAVF) SAVF(QTEMP/CPYSQLDB) + TGTRLS(*CURRENT) ACCPTH(*YES) CHGVAR VAR(&QSHCMD) VALUE('db2 "CREATE SCHEMA ' || &TOLIB |< + '"') QSH CMD(&QSHCMD) CRTDTAARA DTAARA(&TOLIB/QDFTJRN) TYPE(*CHAR) LEN(40) + VALUE('XXXXXXXXXXQSQJRN *ALL *RSTOVRJRN') CHGDTAARA DTAARA(&TOLIB/QDFTJRN (1 10)) VALUE(&TOLIB) RSTLIB SAVLIB(&FROMLIB) DEV(*SAVF) SAVF(QTEMP/CPYSQLDB) + OPTION(*NEW) ALWOBJDIF(*OWNER) RSTLIB(&TOLIB) MONMSG MSGID(CPF3773) DLTF FILE(QTEMP/CPYSQLDB) endpgm
This program is based on an article written by Kent Milligan for Developerworks.