On 01-Feb-2014 05:22 -0800, bluish wrote:
> I had a similar problem with SYSCOLUMNS.
Not sure what is the point in resurrecting a thread from 2006; esp.
given no context from the replied-to message was included, thus anyone
using NNTP must look to some web archival to peruse the message thread...
But the answer to missing SQL Catalog VIEW object(s) from the QSYS2
library, which this ancient thread\topic was about, is to perform a
request to re-create those objects. Most likely origin, per the msg
CPF32D1 as part of system recovery actions in response to a problem
encountered with the *DBXREF feature; i.e. the feature attempted an
auto-recovery that may include DROP TABLE CASCADE of stored metadata.
The recovery is to perform, after changing the job CCSID to match the
CCSID of the character columns of QADBXREF in QSYS:
CALL QSYS2/QSQXRLF (CRT QSYS2)
The above is optionally preceded by a request to DROP the other SQL
Catalog VIEW file objects that are built over the System Database Cross
Reference (DBXREF) metadata files, if for example the desire was to have
all of them re-created at the same time:
CALL QSYS2/QSQXRLF (DLT QSYS2)
The 'CRT' invocation [to create missing catalog VIEWs in QSYS2; those
created over the *DBXREF data], may be run as part of the following if
one of the files is detected as missing:
CHKPRDOPT *OPSYS OPTION(01)
> Such file "not found" can be absent or have metadata stored inside
> which are incorrect.
If the metadata is absent or incorrect, there is likely a defect, or
there was some failure for which necessary recovery has not yet been
effected. However for TABLE, VIEW, INDEX, column, key, PACKAGE,
CONSTRAINT, ALIAS, TRIGGER, and ?perhaps a couple others like SEQUENCE?
[but *not* ROUTINES], the recovery is to refresh the *DBXREF data with a
request to Reclaim Storage (RCLSTG) [to include the *DBXREF] or Reclaim
Database Cross-Reference (RCLDBXREF)... and then pursue origin for any
like or repeat incidents of lost or incorrect information as a probable
defect [if the origin was not already determined to be a failure
understood to require that recovery action per a restriction or
non-defect action].
> It can happen when copying a DB between 2 different machines, using
> option 21 (copy all objects, system and metadata objects included,
> like SYSIBM, QSYS and QSYS2). It's not the correct way, you should
> indicate all libraries to be copied one by one, avoiding system
> libraries. In such way the system will take charge of populating
> metadata in these system libraries. Instead if you make a bulk copy
> of every library you can corrupt destination DB if it is of a
> different version.
The problem with it, is that it is undefined. What it is, needs to
be clearly defined.
Presumably that is an allusion to improper restore activity from
backups taken by GO SAVE option-21 [though the same applies to any
save\restore performed improperly] into one of the quasi-user libraries
such as QGPL, QUSRSYS, QSYS2, and SYSIBM. Following the appropriate and
documented restore\migration, restore\upgrade, or recovery scenario
avoids such difficulties. However... irrespective of what is done,
improperly or properly, the system automatically and implicitly
populates the catalog metadata; i.e. reflection of the properly or
improperly restored objects is done immediately, but as a proper
reflection there is no "corruption" with regard to the metadata.
The only issue that is problematic is a documented restriction, and
that is whereby libraries restored to a new name, the catalog VIEW files
specific to that restored SCHEMA will "point to" the old name; i.e. the
literal selection for SCHEMA_NAME is not updated in a catalog VIEW that
is private to that COLLECTION [aka SCHEMA or LIBrary]. The capability
to recreate those SCHEMA-specific catalogs is effected by the following
CL requests [where NEW_NAME is the new name for the *LIB object]:
CALL QSYS2/QSQXRLF (DLT NEW_NAME) /* dlt SQL catalog VIEWs in lib */
CALL QSYS2/QSQXRLF (CRT NEW_NAME) /* optional IMO; re-crt them */
> To solve this call IBM and ask them to tell you which recovery
> program you have to launch.
Not to sure what is alluded here, because as I suggested, there is
nothing about the "copying a DB between 2 different machines" [where DB
must refer to a SCHEMA; also known as a *LIB] for which a "recovery"
would be required for the metadata. If their improper restore effected
some other issue that needed some resolution, then the metadata would be
automatically\implicitly reflected according to whatever were those
recovery actions.
--
Regards, Chuck