DB2 LOAD Utility and Check Pending States

You may also like...

4 Responses

  1. Roland says:

    Hi Ember,

    if you have tables dependent on others, you might have a problem of ordering. If you have multiple dependecy trees you might have to iterate several times…

    Here’s some code snippet:
    ##################################################
    db2 “connect to $1”;
    num=`db2 -x “select count(*) from syscat.tables where status = ‘C'”`;

    while [ ${num} -gt 0 ] ; do
    db2 -x “select ‘SET INTEGRITY FOR ‘ || rtrim(char(tabschema, 128)) || ‘.’ || rtrim(char(tabname, 128)) || ‘ IMMEDIATE CHECKED;’
    from syscat.tables where status = ‘C’ order by parents, children” > ${db2_si_cmd_file};
    db2 -tvf ${db2_si_cmd_file} -z ${db2_si_log_file};

    prev_num=${num};
    num=`db2 -x “select count(*) from syscat.tables where status = ‘C'”`;

    if [ ${num} -gt 0 ] ; then
    echo “The INTEGRITY for the following tables could not be set: “;
    db2 -x “select rtrim(char(tabschema, 128)) || ‘.’ || rtrim(char(tabname, 128)) from syscat.tables where status = ‘C'”;
    fi;
    done;

    db2 “connect reset”;
    ##################################################

    Cheers
    Roland

  2. harihara says:

    Hi Ember,

    Is there any way to export complete schema in one shot ?

    Thanks
    harihara

    • Ember Crooks says:

      db2move is an excellent tool for that, though you may need to use db2look in conjunction with it, depending on your methodology and objects.

  1. December 15, 2015

    […] DB2 LOAD Utility and Check Pending States […]

Leave a Reply

Your email address will not be published. Required fields are marked *