Forum Discussion

VoropaevPavel's avatar
10 years ago
Solved

DB2 backup are writing to wrong policy

DB2 backup are going to the wrong policy, for example if backup was initiated from PRD_PORDB2_DB2_D_Full policy. Data will be recieved by PRD_PORDB2_DB2_M_Full.

My goal is to keep different retentions for DB2 backups. And since data is going to the  default-applicaiton-backup schedule, multiple policies are requered.

 

db2.conf

DATABASE JCRDB

OBJECTTYPE DATABASE

POLICY PRD_PORDB2_DB2_M_Full

SCHEDULE Default-Application-Backup

ENDOPER

 

DATABASE JCRDB

OBJECTTYPE DATABASE

POLICY PRD_PORDB2_DB2_W_Full

SCHEDULE Default-Application-Backup

ENDOPER

 

DATABASE JCRDB

OBJECTTYPE DATABASE

POLICY PRD_PORDB2_DB2_D_Full

SCHEDULE Default-Application-Backup

ENDOPER

 

 

DATABASE JCRDB

OBJECTTYPE ARCHIVE

POLICY PRD_PORDB2_DB2_Arch

SCHEDULE Default-Application-Backup

ENDOPER

DATABASE JCRDB

OBJECTTYPE DATABASE

POLICY PRD_PORDB2_DB2_M_Full

SCHEDULE Default-Application-Backup

ENDOPER

 

DATABASE JCRDB

OBJECTTYPE DATABASE

POLICY PRD_PORDB2_DB2_W_Full

SCHEDULE Default-Application-Backup

ENDOPER

 

DATABASE JCRDB

OBJECTTYPE DATABASE

POLICY PRD_PORDB2_DB2_D_Full

SCHEDULE Default-Application-Backup

ENDOPER

 

 

DATABASE JCRDB

OBJECTTYPE ARCHIVE

POLICY PRD_PORDB2_DB2_Arch

SCHEDULE Default-Application-Backup

ENDOPER

  • I believe you can have only one OBJECTTYPE DATABASE and one OBJECTTYPE ARCHIVE per database per db2.conf. So you will capture the very first DATABASE / OBJECTTYPE DATABASE pair and backup to the schedule under that pair. 

    Since you are running user scripts and doing an Default-Application-Backup schedule type then you could as a part of your cron job copy a db2.conf first to that has the correct DB / Schedule pair in it. 

  • Thenks guys,

    Now I'm pretty confident that environment vaiables aren't used with DB2 backups, as opposite to Oracle, SAP etc. only db2.conf matters. And as Andrew said only one entry is used from db2.conf per operation, and that is the first one.

    I've found this technote that suggests to move db2.conf using the backup script.

    http://www.symantec.com/business/support/index?page=content&id=TECH223248

    It is working for me so far.

  • Suggestion to explain what you are seing - From the NBU DB2 admin guide page 67

    Script parameters

    The NetBackup for DB2 templates and scripts read parameters from the environment when they perform backup and restore operations. The parameters can come from the following sources:

    ■ Environment variables

    ■ UNIX: NetBackup bp.conf

    ■ NetBackup db2.conf

    Parameters from these sources can be evaluated within the scripts. For example, the DB2_POLICY value is the name of the policy that is used to perform the backup

    If DB2 backup goes to the wrong policy it may indicate you have environment variables defined that takes precedence over policy configured in db2.conf

  • I believe you can have only one OBJECTTYPE DATABASE and one OBJECTTYPE ARCHIVE per database per db2.conf. So you will capture the very first DATABASE / OBJECTTYPE DATABASE pair and backup to the schedule under that pair. 

    Since you are running user scripts and doing an Default-Application-Backup schedule type then you could as a part of your cron job copy a db2.conf first to that has the correct DB / Schedule pair in it. 

  • Hi Pavel,

     

    I would keep one policy but use different schedules (Default-Application-Backup-Daily, Default-Application-Backup-Weekly, Default-Application-Backup-Monthly). Then use those in your db2.conf.