DB2-Admin

 view release on metacpan or  search on metacpan

Admin.xs  view on Meta::CPAN

                case DB2HISTORY_OPTYPE_INCR_ONLINE:
                    ptr = "Incremental Online";
                    break;
                case DB2HISTORY_OPTYPE_DELT_OFFLINE:
                    ptr = "Delta Offline";
                    break;
                case DB2HISTORY_OPTYPE_DELT_ONLINE:
                    ptr = "Delta Online";
                    break;
                default:
                    ptr = "(unknown backup operation type)";
                }
                break;
            case DB2HISTORY_OP_QUIESCE:
                switch(entry_data.oOptype) {
                case DB2HISTORY_OPTYPE_SHARE:
                    ptr = "Share";
                    break;
                case DB2HISTORY_OPTYPE_UPDATE:
                    ptr = "Update";
                    break;

Admin.xs  view on Meta::CPAN

        }
        no_items = 4;
        while (--no_items >= 0)
            Safefree(client_app_info[no_items].pValue);
        Return = newRV_noinc((SV*)retval);
        XPUSHs(Return);
    }


#
# Perform a backup
#
# Parameters:
# - Database name
# - Target (ref to array of strings)
# - Tablespaces (ref to array of tablespaces)
# - Options (hash reference)
# Returns:
# - Ref to hash with ApplicationId/Timestamp/BackupSize/SQLCode/NodeInfo/...
#
void
db2Backup(db_alias, target, tbspaces, options)
     char *db_alias;
     SV   *target;
     SV   *tbspaces;
     SV   *options;

     PPCODE:
     {
         db2BackupStruct            backup_info;
         db2MediaListStruct         location_info = { NULL, 0, 0 };
         char                     **locations = NULL;
         db2TablespaceStruct        tablespace_info = { NULL, 0 };
         char                     **tablespaces = NULL;
#ifdef DB2BACKUP_MPP
         db2NodeType               *node_list = NULL;
         db2BackupMPPOutputStruct  *mpp_output = NULL;
#endif /* DB2BACKUP_MPP */
         SV                        *value;
         char                      *key;

Admin.xs  view on Meta::CPAN

             (SvTYPE(SvRV(tbspaces)) != SVt_PVAV)) {
             croak("Array reference expected for parameter 'tbspaces'");
         }
         /* Check options is valid */
         if ((!SvROK(options)) ||
             (SvTYPE(SvRV(options)) != SVt_PVHV)) {
             croak("Hash reference expected for parameter 'options'");
         }

         /*
          * The backup structure differs between DB2 releases,
          * so it's hard to write an initializer.  We will
          * just zero it.
          */
         memset(&backup_info, 0, sizeof(backup_info));
         backup_info.piDBAlias = db_alias;

         /* Set up target */
         backup_info.piMediaList = &location_info;
         backup_info.iCallerAction = DB2BACKUP_NOINTERRUPT; /* See Action below */
         location_info.locationType = SQLU_LOCAL_MEDIA;  /* See TargetType below */
         if (av_len((AV*)SvRV(target)) >= 0) {
             AV     *media;
             I32     no_entries, counter;

             media = (AV*)SvRV(target);
             no_entries = av_len(media) + 1;
             location_info.numLocations = no_entries;
             Newz(0, locations, no_entries, char *);
             location_info.locations = locations;

Admin.xs  view on Meta::CPAN

                     croak("Element '%d' (offset-zero based) in target array is invalid: not a string\n", counter);
                 }
             }
         } /* End if: have target entries */

         /* Set up tablespaces */
         if (av_len((AV*)SvRV(tbspaces)) >= 0) {
             AV     *tblist;
             I32     no_entries, counter;

             backup_info.iOptions |= DB2BACKUP_TABLESPACE;
             backup_info.piTablespaceList = &tablespace_info;
             tblist = (AV*)SvRV(tbspaces);
             no_entries = av_len(tblist) + 1;
             tablespace_info.numTablespaces = no_entries;
             Newz(0, tablespaces, no_entries, char *);
             tablespace_info.tablespaces = tablespaces;

             for (counter = 0; counter < no_entries; counter++) {
                 SV **array_elem;

                 array_elem = av_fetch(tblist, counter, FALSE);

Admin.xs  view on Meta::CPAN

                     char   *val;
                     STRLEN  len;

                     val = SvPV(*array_elem, len);
                     tablespaces[counter] = val;
                 } else {
                     croak("Element '%d' (offset-zero based) in tablespaces array is invalid: not a string\n", counter);
                 }
             }
         } else {
             backup_info.iOptions |= DB2BACKUP_DB;
         } /* End if: have tablespace entries */

         /*
          * Handle the backup options (hash reference):
          * - Type
          * - Action
          * - Nodes
          * - ExceptNodes
          * - Online
          * - Compress
          * - IncludeLogs
          * - ExcludeLogs
          * - ImpactPriority
          * - Parallelism

Admin.xs  view on Meta::CPAN

                                       (char **)&key, &keylen))) {
             if (strEQ(key, "Type")) { /* Full / Incremental / Delta */
                 if (SvPOK(value)) {
                     char   *val;
                     STRLEN  len;

                     val = SvPV(value, len);
                     if (strEQ(val, "Full")) {
                         /* Default: nothing to do */
                     } else if (strEQ(val, "Incremental")) {
                         backup_info.iOptions |= DB2BACKUP_INCREMENTAL;
                     } else if (strEQ(val, "Delta")) {
                         backup_info.iOptions |= DB2BACKUP_DELTA;
                     } else {
                         croak("Unsupported value '%s' for Options key '%s'\n",
                               val, key);
                     }
                 } else {
                     croak("Illegal value for Options key '%s': not a string\n", key);
                 }
             } else if (strEQ(key, "Action")) {
                 if (SvPOK(value)) {
                     char   *val;
                     STRLEN  len;

                     val = SvPV(value, len);
                     if (strEQ(val, "Start")) {
                         backup_info.iCallerAction = DB2BACKUP_BACKUP;
                     } else if (strEQ(val, "NoInterrupt")) {
                         backup_info.iCallerAction = DB2BACKUP_NOINTERRUPT;
                     } else if (strEQ(val, "Continue")) {
                         backup_info.iCallerAction = DB2BACKUP_CONTINUE;
                     } else if (strEQ(val, "Terminate")) {
                         backup_info.iCallerAction = DB2BACKUP_TERMINATE;
                     } else if (strEQ(val, "DeviceTerminate")) {
                         backup_info.iCallerAction = DB2BACKUP_DEVICE_TERMINATE;
                     } else if (strEQ(val, "ParamCheck")) {
                         backup_info.iCallerAction = DB2BACKUP_PARM_CHK;
                     } else if (strEQ(val, "ParamCheckOnly")) {
                         backup_info.iCallerAction = DB2BACKUP_PARM_CHK_ONLY;
                     } else {
                         croak("Unsupported value '%s' for Options key '%s'\n",
                               val, key);
                     }
                 } else {
                     croak("Illegal value for Options key '%s': not a string\n", key);
                 }
#ifdef DB2BACKUP_MPP
             } else if (strEQ(key, "Nodes") || strEQ(key, "ExceptNodes")) {
                 if (backup_info.iOptions & DB2BACKUP_MPP)
                     croak("The options 'Nodes' and 'ExceptNodes' may not be combinbed\n");
                 backup_info.iOptions |= DB2BACKUP_MPP;
                 if (strEQ(key, "Nodes") && SvPOK(value)) {
                     char   *val;
                     STRLEN  len;

                     val = SvPV(value, len);
                     if (strEQ(val, "All"))
                         backup_info.iAllNodeFlag = DB2_ALL_NODES;
                     else
                         croak("Invalid Options key %s value %s: must be 'All' or array-reference\n", key, val);
                 } else if (SvROK(value) && SvTYPE(SvRV(value)) == SVt_PVAV) {
                     AV     *nodes;
                     I32     no_nodes, counter;

                     if (strEQ(key, "Nodes"))
                         backup_info.iAllNodeFlag = DB2_NODE_LIST;
                     else
                         backup_info.iAllNodeFlag = DB2_ALL_EXCEPT;

                     nodes = (AV*)SvRV(value);
                     no_nodes = backup_info.iNumNodes = av_len(nodes) + 1;
                     Newz(0, node_list, no_nodes, db2NodeType);
                     backup_info.piNodeList = node_list;
                     for (counter = 0; counter < no_nodes; counter++) {
                         SV **array_elem;

                         array_elem = av_fetch(nodes, counter, FALSE);
                         if ((!SvROK(*array_elem)) && looks_like_number(*array_elem)) {
                             node_list[counter] = SvUV(*array_elem);
                         } else {
                             croak("Element '%d' (offset-zero based) in %s array is invalid: not a number\n", counter, key);
                         }
                     } /* End: for each node */

Admin.xs  view on Meta::CPAN

                     croak("Illegal value for Options key '%s': must be an array reference, or 'All' for key 'Nodes'\n", key);
                 }

                 /*
                  * Set up output list.  Size it at maximum of 1024 nodes.
                  *
                  * We configure the first node to look like the last-node
                  * marker that db2Backup writes when successful.
                  */
                 Newz(0, mpp_output, 1024, db2BackupMPPOutputStruct);
                 backup_info.iNumMPPOutputStructs = 1024;
                 backup_info.poMPPOutputStruct = mpp_output;
                 mpp_output[0].nodeNumber = (db2NodeType)-1;
#endif /* DB2BACKUP_MPP */
             } else if (strEQ(key, "Online")) { /* Boolean */
                 if (SvTRUE(value)) {
                     backup_info.iOptions |= DB2BACKUP_ONLINE;
                 } else {
                     backup_info.iOptions |= DB2BACKUP_OFFLINE;
                 }
             } else if (strEQ(key, "Compress")) { /* Boolean */
                 if (SvTRUE(value)) {
                     backup_info.iOptions |= DB2BACKUP_COMPRESS;
                 }
             } else if (strEQ(key, "IncludeLogs")) { /* Boolean */
                 if (SvTRUE(value)) {
                     backup_info.iOptions |= DB2BACKUP_INCLUDE_LOGS;
                 }
             } else if (strEQ(key, "ExcludeLogs")) { /* Boolean */
                 if (SvTRUE(value)) {
                     backup_info.iOptions |= DB2BACKUP_EXCLUDE_LOGS;
                 }
             } else if (strEQ(key, "ImpactPriority")) { /* 32-bit unsgn number */
                 if ((!SvROK(value)) && looks_like_number(value)) {
                     backup_info.iUtilImpactPriority = SvUV(value);
                 } else {
                     croak("Illegal value for Options key '%s': not a number\n", key);
                 }
             } else if (strEQ(key, "Parallelism")) { /* 32-bit unsg number */
                 if ((!SvROK(value)) && looks_like_number(value)) {
                     backup_info.iParallelism = SvUV(value);
                 } else {
                     croak("Illegal value for Options key '%s': not a number\n", key);
                 }
             } else if (strEQ(key, "NumBuffers")) { /* 32-bit unsg number */
                 if ((!SvROK(value)) && looks_like_number(value)) {
                     backup_info.iNumBuffers = SvUV(value);
                 } else {
                     croak("Illegal value for Options key '%s': not a number\n", key);
                 }
             } else if (strEQ(key, "BufferSize")) { /* 32-bit unsg number */
                 if ((!SvROK(value)) && looks_like_number(value)) {
                     backup_info.iBufferSize = SvUV(value);
                 } else {
                     croak("Illegal value for Options key '%s': not a number\n", key);
                 }
             } else if (strEQ(key, "TargetType")) { /* String */
                 if (SvPOK(value)) {
                     char   *val;
                     STRLEN  len;

                     val = SvPV(value, len);
                     if (strEQ(val, "Local")) {

Admin.xs  view on Meta::CPAN

                         croak("Unsupported value '%s' for Options key '%s'\n",
                               val, key);
                     }
                 } else {
                     croak("Illegal value for Options key '%s': not a string\n", key);
                 }
             } else if (strEQ(key, "Userid")) { /* String */
                 if (SvPOK(value)) {
                     STRLEN  len;

                     backup_info.piUsername = SvPV(value, len);
                 } else {
                     croak("Illegal value for Options key '%s': not a string\n", key);
                 }
             } else if (strEQ(key, "Password")) { /* String */
                 if (SvPOK(value)) {
                     STRLEN  len;

                     backup_info.piPassword = SvPV(value, len);
                 } else {
                     croak("Illegal value for Options key '%s': not a string\n", key);
                 }
             } else {
                 croak("Unexpected Options key '%s'", key);
             }
         } /* End: each hash entry */

         /* Actually call db2Backup */
         db2Backup(DB2_VERSION_ENUM, &backup_info, &global_sqlca);
         Safefree(locations);
         Safefree(tablespaces);

         /* Return a hash with backup details if okay, undef on error */
         {
             HV   *retval;
             SV   *Return;
             char  buffer[MESSAGE_BUFFER_SIZE];
             int   status;

             /* Main return code */
             retval = (HV*)sv_2mortal((SV*)newHV());
             if (backup_info.oApplicationId[0]) { /* SKip empty string */
                 hv_store(retval, "ApplicationId", 13,
                          newSVpv(backup_info.oApplicationId, strlen(backup_info.oApplicationId)), FALSE);
             }
             if (backup_info.oTimestamp[0]) { /* Skip empty string */
                 hv_store(retval, "Timestamp", 9,
                          newSVpv(backup_info.oTimestamp, strlen(backup_info.oTimestamp)), FALSE);
             }
             hv_store(retval, "BackupSize", 10,
                      newSVuv(backup_info.oBackupSize), FALSE);
             hv_store(retval, "SQLCode", 7,
                      newSViv(global_sqlca.sqlcode), FALSE);
             status = sqlaintp(buffer, MESSAGE_BUFFER_SIZE, 0,
                               &global_sqlca);
             if (status > 0) {
                 hv_store(retval, "Message", 7,
                          newSVpv(buffer, status), FALSE);
             }
             status = sqlogstt(buffer, MESSAGE_BUFFER_SIZE, 0,
                               global_sqlca.sqlstate);

Admin.xs  view on Meta::CPAN

             }
#ifdef DB2BACKUP_MPP
             if (mpp_output) {
                 int  counter;
                 AV  *part_retval;

                 part_retval = newAV();
                 hv_store(retval, "NodeInfo", 8,
                          newRV_noinc((SV*)part_retval), FALSE);
                 for (counter = 0;
                      counter < backup_info.iNumMPPOutputStructs;
                      counter++) {
                     HV                       *node_elem;
                     db2BackupMPPOutputStruct *ni;

                     /*
                      * We may have more elements than results;
                      * leave if we find an empty element.  Note
                      * we configure the first node like this
                      * before calling db2Backup, so we can handle
                      * the case where the call fails entirely.
                      */
                     ni = mpp_output + counter;
                     if (ni->nodeNumber == (db2NodeType)-1 &&
                         ni->backupSize == 0 &&
                         ni->sqlca.sqlcode == 0)
                         break;

                     node_elem = newHV();
                     hv_store(node_elem, "NodeNum", 7,
                              newSVuv(ni->nodeNumber), FALSE);
                     hv_store(node_elem, "BackupSize", 10,
                              newSVuv(ni->backupSize), FALSE);
                     hv_store(node_elem, "SQLCode", 7,
                              newSViv(ni->sqlca.sqlcode), FALSE);
                     status = sqlaintp(buffer, MESSAGE_BUFFER_SIZE, 0,
                                       &ni->sqlca);
                     if (status > 0) {
                         hv_store(node_elem, "Message", 7,
                                  newSVpv(buffer, status), FALSE);
                     }
                     status = sqlogstt(buffer, MESSAGE_BUFFER_SIZE, 0,
                                       ni->sqlca.sqlstate);

CHANGES  view on Meta::CPAN

manner; so a file generated for V9.5 will not work with V8.2.

=head2 ListUtilities fix

The C<ListUtilities> method now supports the C<Version> parameter.

=head1 Changes in the 3.0 release

=head2 Backup

Add support for the Backup command, including support for DPF backups
(with included logs) in DB2 V9.5.

=head1 Changes in the 2.9 release

=head2 Fix core dump in load from cursor

A second bug in the db2Load command, caused a load from cursor (source
type "Statement") to perform an invalid free, sometimes leading to a
core dump. Now fixed.  Have run valgrind on import/export/load to
verify no additional mistakes are present.

CHANGES  view on Meta::CPAN

=head2 Add LoadQuery method

A new LoadQuery method allows you to query the progress of a Load
command against a table.

=head1 Changes in the 1.2 release

=head2 Add ListHistory command

A new ListHistory method implements the equivalent of the CLP "List
History" command that allows you to query loads, backups,
rollforwards, etc.

=head2 Make test suite configurable

A CONFIG file is used to drive the test suite, externalizing the names
of the test database, test tables, schema names, etc.

=head1 Changes in the 1.1 release

=head2 Add Load method

CHANGES.html  view on Meta::CPAN

<P>
<HR>
<H1><A NAME="Changes_in_the_3_0_release">Changes in the 3.0 release

</A></H1>
<P>
<HR>
<H2><A NAME="Backup">Backup

</A></H2>
Add support for the Backup command, including support for DPF backups (with
included logs) in DB2 V9.5.


<P>

<P>
<HR>
<H1><A NAME="Changes_in_the_2_9_release">Changes in the 2.9 release

</A></H1>

CHANGES.html  view on Meta::CPAN

<HR>
<H1><A NAME="Changes_in_the_1_2_release">Changes in the 1.2 release

</A></H1>
<P>
<HR>
<H2><A NAME="Add_ListHistory_command">Add ListHistory command

</A></H2>
A new ListHistory method implements the equivalent of the CLP ``List
History'' command that allows you to query loads, backups, rollforwards,
etc.


<P>

<P>
<HR>
<H2><A NAME="Make_test_suite_configurable">Make test suite configurable

</A></H2>

MANIFEST  view on Meta::CPAN

t/31listutil.t
t/40cfg.t
t/45dir.t
t/50force.t
t/55runstats.t
t/60export.t
t/61import.t
t/62load.t
t/63history.t
t/64loadquery.t
t/70backup.t
t/99pod.t
typemap
util/check_config_params.pl
util/parse_config
util/parse_constants.pl
util/write_manifest
util/write_yaml

lib/DB2/Admin.pm  view on Meta::CPAN


    #
    # The XS code expects a reference to an array; we support either
    # a string or an array, and we translate this at the perl level.
    #
    unless (ref $params{Target}) {
        $params{Target} = [ $params{Target} ];
    }

    #
    # A full backup is indicated by an empty list of tablespaces.
    #
    $params{Tablespaces} ||= [];

    #
    # Handle default options
    #
    my $options = $params{Options};
    $options->{Type} ||= 'Full';
    $options->{Online} ||= 0;

lib/DB2/Admin.pm  view on Meta::CPAN

  my @utils = DB2::Admin->ListUtilities();
  my @utils = DB2::Admin->ListUtilities('Database' => $db_name);

  # Rebind a package.  Requires a database connection. Example omits options.
  DB2::Admin->Rebind('Database' => $db_name,
                     'Schema'   => $schema_name,
                     'Package'  => $pkg_name);

  # Backup a database (or database partition)
  DB2::Admin->Backup('Database' => $db_name,
                     'Target'   => $backup_dir,
                     'Options'  => { 'Online' => 1, 'Compress' => 1, });

  # Backup all nodes of a DPF database (V9.5 only)
  DB2::Admin->Backup('Database' => $db_name,
                     'Target'   => $backup_dir,
                     'Options'  => { 'Online' => 1, 'Nodes' => 'All', });

=head1 DESCRIPTION

This module provides perl language support for the DB2 administrative
API.  This loosely corresponds to the non-SQL functions provided by
the DB2 Command Line Processor (CLP), the 'db2' program.

This function is complementary to the DBD::DB2 database driver.  The
DBD::DB2 driver is intended for application developers and supports

lib/DB2/Admin.pm  view on Meta::CPAN

The C<XmlFile> parameter may be a string or a reference to an array of
strings.

=back

=head2 Import

This method is used to import a file into a table.  Existing data can
be added to (insert mode), replaced (replace mode), or overwritten on
duplicate keys (insert_update mode).  The import functions go through
the transaction log; no tablespace backup is required once the
operation succeeds.

Importing data is less efficient than the C<Load> method.  IBM
recommends load over import for more than 50,000 rows or 50MB of data.

At this time, only a limited subset of DB2 import functionality is
supported; specifically, support for table hierarchies and XML
schema-related validation options is not provided.  Additional
functionality will be added on request if deemed useful.

lib/DB2/Admin.pm  view on Meta::CPAN


Load is not subject to restrictions for databases configured to use
circular logging.  Generally, only non-important test databases are
configured with circular logging; most databases have archive logging
enabled.

=item *

If the load is marked as non-recoverable, it is not subject to use
restrictions once the load completes.  However, the table will be
unavailable if the database is restarted before a backup is taken.
This is different from Sybase, where the table will be available in
the pre-load state.

=item *

If the load is marked as recoverable (the default), either the loaded
data must be copied by the server (see the C<CopyDirectory> argument),
or a database or tablespace backup must be performed by the DBAs.  If
this is not done, the table may be put in a mode where data can be
read but not updated.

=item *

If the load fails, a follow-up command may have to be issues to
continue or terminate the load.  This command is I<not> issued
automatically, because there are cases where terminating a partially
failed load will make things worse (e.g. force index rebuilds).

lib/DB2/Admin.pm  view on Meta::CPAN

qualified by a schema name, or must have the same schema specified for
the table.

This parameter should not be combined with the 'AllIndexes' option and
may be combined with the 'DetailedIndexes' or 'SampledIndexes' option.

=back

=head2 ListHistory

This method is used to query the history of backups, roll forwards,
loads, tablespace actions, etc.  It applies to a database, but doesn't
require a database connection (just an instance attachment) - IBM is
not very consistent here.  This method can be quite slow if selection
criteria are not specified.  The selection criteria (action, object
name and start time) are logically ANDed.

This method specifies up to four named parameters, of which only
C<Database> is required.  It returns an array with hash-references
describing the history in detail; use of C<Data::Dumper> to study the
results is recommended.

lib/DB2/Admin.pm  view on Meta::CPAN


The accounting string.

=back

The return value from this method is a hash with the same four fields,
all of which will be present only if the value is non-empty.

=head2 Backup

This method performs a database backup.  For a DPF database, it backs
up the node specified in the C<DB2NODE> environment variable.  In DB2
V9.5, it can back up all nodes of a DPF database.

This method takes four named parameters and returns a hash reference,
described in more detail after the parameters.

=over 4

=item Database

lib/DB2/Admin.pm  view on Meta::CPAN


=item Target

The database target.  This can either be a string (a directory name)
or a reference to an array of directory names.  This parameter is
required.

=item Tablespaces

An optional array reference with a lkist of tablespace names to back
up.  Specifying this parameter switches from a database backup to a
tablespace backup.

=item Options

A required hash reference with backup options.

=over 4

=item Type

The type of backup.  This cna be C<Full>, C<Incremental> or C<Delta>.

=item Action

The backup action.  Technically, the abckup cna either eb fully
automated (the default), or it can go through multiple phases:
parameter check, start, promt, continue, etc.  This parameter allows
the user to specify the backup type/stage.  Supported values are
C<NoInterrupt> (the default), C<Start>, C<Continue>, C<Terminate>,
C<DeviceTerminate>, C<ParamCheck> and C<ParamCheckOnly>.

=item Nodes

This parameter is only valid on DB2 V9.5 and only for DPF databases.
It can be C<All> for a system-wide backup of all DPF nodes, or a
reference to an array of node numbers to back up.  Use of this
parameter triggers the creation of the C<NodeInfo> field in the return
value.  It is mutually exclusive with the C<ExceptNodes> parameter.

=item ExceptNodes

This parameter is only valid on DB2 V9.5 and only for DPF databases.
It is reference to an array of node numbers I<not> to back up.  Use of
this parameter triggers the creation of the C<NodeInfo> field in the
return value.  It is mutually exclusive with the C<Nodes> parameter.

=item Online

A boolean option specifying an online or offline backup.  The default
is an offline backup.

=item Compress

A boolean option specifying whether to compress the backup.  The
default is a non-compressed backup.

=item IncludeLogs

A boolean option specifying that database logs must be included.  This
parameter is mutually exclusive with the C<ExcludeLogs> option.
Omitting both C<IncludeLogs> and C<ExcludeLogs> selects the default
for the backup type, which is to include logs for snapshot backups and
to exclude logs in all other cases.

=item ExcludeLogs

A boolean option specifying that database logs must be excluded.  This
parameter is mutually exclusive with the C<IncludeLogs> option.
Omitting both C<IncludeLogs> and C<ExcludeLogs> selects the default
for the backup type, which is to include logs for snapshot backups and
to exclude logs in all other cases.

=item ImpactPriority

An integer specifying the impact priority.  When omitted, the backup
runs unthrottled.

=item Parallelism

An integer specifying the degree of parallelism (number of buffer
manipulators).

=item NumBuffers

An integer specifying the number of backup buffers to be used.

=item BufferSize

An integer specifying the size of the abckup buffer in 4K pages.

=item TargetType

The backup target type.  The default is C<Local>, i.e. a backup to a
filesystem.  Other options are C<XBSA>, C<TSM>, C<Snapshot> and
C<Other>.

=item Userid

An optional connect userid.

=item Password

An optional password to be used with the connect userid.

lib/DB2/Admin.pm  view on Meta::CPAN

the following entries:

=over 4

=item ApplicationId

=item Timestamp

=item BackupSize

The size of the backup in megabytes

=item SQLCode

=item Message

The error message if the SQL code is not zero

=item State

The description if the SQL state, if available

lib/DB2/Admin/DataElement.pm  view on Meta::CPAN

                            9  => 'compiling SQL stmt',
                            10 => 'request interrupted',
                            11 => 'disconnect pending',
                            12 => 'prepared transaction',
                            13 => 'heuristically committed',
                            14 => 'heuristically rolled back',
                            15 => 'transaction ended',
                            16 => 'creating database',
                            17 => 'restarting database',
                            18 => 'restoring database',
                            19 => 'performing backup',
                            20 => 'performing fast load',
                            21 => 'performing fast unload',
                            22 => 'wait to disable tablespace',
                            23 => 'quiescing tablespace',
                            24 => 'waiting for remote node',
                            25 => 'pending results from remote request',
                            26 => 'app decoupled from coord',
                            27 => 'rollback to savepoint',
                           );
        $display = $status_table{$value} ||

lib/DB2/Admin/db2_config_params.pl  view on Meta::CPAN

    'SQLF_DBTN_AVG_APPLS' => {
        'Type'      => 'u16bit',
        'Name'      => 'avg_appls',
        'Updatable' => 1,
        'Domain'    => 'Database',
    },
    'SQLF_DBTN_BACKUP_PENDING' => {
        'Type'      => 'u16bit',
        'Domain'    => 'Database',
        'Updatable' => 0,
        'Name'      => 'backup_pending',
    },
    'SQLF_DBTN_BLK_LOG_DSK_FUL' => {
        'Type'      => 'u16bit',
        'Name'      => 'blk_log_dsk_ful',
        'Updatable' => 1,
        'Domain'    => 'Database',
    },
    'SQLF_DBTN_BUFF_PAGE' => {
        'Type'      => 'u32bit',
        'Name'      => 'buffpage',

lib/DB2/Admin/db2_config_params.pl  view on Meta::CPAN

        'Name'      => 'numarchretry',
    },
    'SQLF_KTN_NUMDB' => {
        'Type'      => 'u16bit',
        'Name'      => 'numdb',
        'Updatable' => 1,
        'Domain'    => 'Manager',
    },
    'SQLF_DBTN_NUM_DB_BACKUPS' => {
        'Type'      => 'u16bit',
        'Name'      => 'num_db_backups',
        'Updatable' => 1,
        'Domain'    => 'Database',
    },
    'SQLF_DBTN_NUM_ESTORE_SEGS' => {
        'Type'      => '32bit',
        'Updatable' => 1,
        'Name'      => 'num_estore_segs',
        'Domain'    => 'Database',

    },

sample/copy_data.pl  view on Meta::CPAN

				 'FileType'    => 'DEL',
				 'FileOptions' => { 'LobsInFile' => 1, },
				 'LobPath'     => $export_dir,
				 'LobFile'     => 'lob-prefix',
				);
print "Exported $rows rows\n";

#
# Load the data back in.  We specify the 'nonrecoverable' parameter
# but you'd better specify the 'CopyDirectory' parameter in real life,
# or take a backup as soon as the loads complete.
#
my $rc = DB2::Admin::->Load('Database'      => $tgt_db,
			   'Schema'        => $schema,
			   'Table'         => $table,
			   'InputFile'     => "$export_dir/$table.del",
			   'LogFile'       => "$export_dir/load.log",
			   'FileOptions'   => { 'LobsInFile' => 1, },
			   'SourceType'    => 'DEL',
			   'Operation'     => 'Replace',
			   #'CopyDirectory' => "/stable/path/on/server",

t/01lowlevel.t  view on Meta::CPAN

# Cleanup connections (a no-op)
#
DB2::Admin::cleanup_connections();
ok(1, "cleanup_connections");

#
# We're not doing import/export/load tests in this low-level suite
#

#
# The 'list history' command.  This is slow, so limit to 'backup'.
#
$rc = DB2::Admin::db2ListHistory($db_name, 'Load', '', '');
ok(defined $rc, "db2ListHistory - $db_name Load");

#
# Extract SQL code
#
DB2::Admin::sqlcode();
pass("sqlcode");

t/70backup.t  view on Meta::CPAN

#
# Test the backup functions
#
# $Id: 70backup.t,v 165.2 2009/02/24 14:46:03 biersma Exp $
#

#
# Get the database/schema/table names from the CONFIG file
#
our %myconfig;
require "util/parse_config";
my $db_name = $myconfig{DBNAME};

use strict;

t/70backup.t  view on Meta::CPAN

                        'Flag'     => 'Delayed',
                        'Database' => $db_name);
    #print Dumper(\@retval);
    if ($retval[0]{Value}) {
        $trackmod = 1;
    }
    ok(1, "Get database config for trackmod");
}

#
# Start with a full offline backup to /dev/null.  If the "create test
# database" script was used, this will allow us to do
# online/incremental backups below.
#
my $rc = DB2::Admin->Backup('Database' => $db_name,
                            'Target'   => $null_device,
                            'Options'  => { 'Type'   => 'Full',
                                            'Online' => 0,
                                          },
                           );
ok(1, "Backup - whole database - Full, Off-line");

#
# Do full, incremental and delta backup to /dev/null
# Only try incremental/delta if trackmod set
#
SKIP: {
    foreach my $type (qw(Full Incremental Delta)) {
        unless ($type eq 'Full' || $trackmod) {
            skip("Skip $type backup as trackmod not set", 2);
        }

        my $rc = DB2::Admin->Backup('Database' => $db_name,
                                    'Target'   => $null_device,
                                    'Options'  => { 'Type'   => $type,
                                                    'Online' => 1,
                                                  },
                                   );
        ok(1, "Backup - whole database - $type");
        #print Dumper($rc);
    }
}

#
# Do a backup with a christmas tree of options
#
if (1) {
    my $options = { 'Type'           => 'Full',
                    'Action'         => 'ParamCheckOnly',
                    'Online'         => 1,
                    'Compress'       => 0,
                    'IncludeLogs'    => 1,
                    'ImpactPriority' => 75,
                    #'Parallelism'    => 8, # Conflicts with ParamCheckOnly
                    'NumBuffers'     => 64,

t/70backup.t  view on Meta::CPAN

    ok(1, "Backup - parameter check only - many options");
    #print Dumper($rc);
}


#
# DPF test ('Nodes' option works on non-DPF, but it requires V9.5)
#
SKIP: {
    my $version = substr($ENV{DB2_VERSION}, 1); # Vx.y -> x.y
    skip("DPF backup not available in DB2 version < 9.5", 1)
      if ($version < 9.5);

    my $rc = DB2::Admin->Backup('Database' => $db_name,
                                #'Target'   => [ '/tmp/bogus', '/tmp/b' ],
                                'Target'   => $null_device,
                                'Options'  =>  { Online   => 1,
                                                 #Action   => 'ParamCheckOnly',
                                                 Compress => 1,
                                                 Nodes    => 'All',
                                               },



( run in 2.089 seconds using v1.01-cache-2.11-cpan-49f99fa48dc )