IMO the best procedure to effect a migration of the /structure/ of
the database [as defined by the DDL] is to run the DDL creation scripts
on the target system. Generate the DDL if not already existing in
scripts, then run those scripts.
Beyond that, the following may be informative for alternatives; esp.
where the files are DDS created without RI and/or triggers.
Other methods are potentially difficult if not problematic, or their
value depends on what may be planned for save\restore of those /same/
files.data in the future, between the source and target systems. I
prefer to save all data and access paths, restore all, then clear, to
achieve the most DR-like copy to a target system; problematic for at
least, both referential constraints and delete triggers.
SAVLIB ERP_DB FILEMBR((*ALL *NONE)) will save database files without
data, but also without members. Having performed the request to DSPFD
ERP_DB/*ALL *MBR FILEATR(*PF) OUTPUT(*OUTFILE) on the source system, the
output file.data can be used as input to a CLP which then effects ADDPFM
to the files restored to the target system.
Notes: I am not sure if any /fixes/ have been put in place for SQL
TABLE for which the condition of no-member is at best, quasi-invalid,
such that restore may now even force a member to exist, although it
never used to. I do not recall the full ramifications for primary key
constraints [ugly messages for sure], but referential constraints will
be problematic using save/restore to omit members. If saved and
restored with data, then during clear on the target system, both
referential constraints and delete triggers will need to be disabled.
The /hoops/ to get a no-data scenario to work, is why the DDL script is
most appropriate. If a copy of media exists already with data, like the
save, the restore can omit members with FILEMBR((*ALL *NONE)) but IIRC
counter-intuitively requires MBROPT(*ALL) also be specified.
For save with no members, if the SAVLIB or a SAVOBJ can be inclusive
of only the PF [e.g. by naming enabling either generic naming inclusion
or omission by OMITOBJ(), or individually named in SAVOBJ or save API],
and another save can be inclusive of only the LF, then:
save without members, the PF from the source system
DSPFD to list the PF members that were not saved
save the LF with members
restore the PF without members
run CLP to add members since they were not restored
restore the LF with members; diags for different PFM
Regards, Chuck
Reinardy, James wrote:
We are migrating our development work to a separate LPAR and want to
copy the structure of our main ERP database without all of the data.
It appeared that doing a SAVLIB to a *SAVF with SAVFDTA(*NO) might do
the trick, but this still copies data in our tests. Do I need
another parameter, or is there an easier way to do this?
As an Amazon Associate we earn from qualifying purchases.