Backup & Recovery

One of the more complicated facets of NetBackup is that the 'copy number' of a backup image bears no relation to its locality/residence/age or duplication life history. The copy number of a backup image is an arbitary number, and does not convey any meaning other than the fact that a copy of the image exists.

For example, imagine an SLP that has two stages.  The first stage is a backup to disk stage, and this will typically create copy '1' of a backup image.  The second stage is a duplication to tape stage, and this will typically result in the creation of second copy of the backup image with a copy number of '2'.  Now imagine that through some turn of events long ago which was about to result in copy 1 of the image being lost, but before it was lost it was duplicated again to become copy 3 on another different disk pool.  No we have a situation where most of the backup images follow the usual pattern of copy 1 is on disk, and copy 2 is on tape... however one of the images does not.  If many changes and manual duplications have taken place, then the thought of selecting images by copy number alone becomes a risky proposition.

There are oocasions where one needs to be sure that one has identified all of the copies on a specific storage type, e.g. on disk... yet at the same time perhaps ignore these copies on disk... IF... they do not have a copy on tape.  This script can help you do that.  It is a curious thing that usually when one needs to identify backup images that fall in to these categories, then one is also usually wanting to identify the oldest of these.  Hence this script will also identify and select images by date.

N.B:  This script will not actually change anything.  The sole purpose of this script is to produce a file containing just a list of backup image-IDs and the copy number for the copy that was found on the user selected type(s) of storage.

So, as it stands this script can be thought of as a reporting script, as it does not make any changes to NetBackup.

.

As ever, please carefully read the entire script header before attempting to use this script.

In fact, read it again Smiley Happy    Make sure that you understand its limitations.

HTH.

Edit... script attached below:

Comments

A copy of the script for a Windows based NetBackup Server is attached below.

N.B:  I have tried to create a script which is sensitive to date formats for both UK and US locales.  However, I do not have an extensive range of different systems to test upon.  I have primarily tested this script on systems based on UK locale.

Remember this is a reporting script only, and so should be safe to run on any system.

If anyone does find 'date' handling issues, then please do post back, or IM message me via the forum and I will work to resolve any date handling bugs.  Smiley Happy

 

Here's an example of the script running:

J:\NBU_SCRIPTS\identify-oldest-images>identify-oldest-images.bat
14/02/2016 12:39:51
14/02/2016 12:39:51
14/02/2016 12:39:51  ********************************************************
14/02/2016 12:39:51  ********************************************************
14/02/2016 12:39:51  Script session details...
14/02/2016 12:39:51  ...script started:  14/02/2016 12:39:51
14/02/2016 12:39:51  ...script name:     identify-oldest-images
14/02/2016 12:39:51  ...script path:     J:\NBU_SCRIPTS\identify-oldest-images\
14/02/2016 12:39:51  ...script log:      J:\NBU_SCRIPTS\identify-oldest-images\identify-oldest-images.log
14/02/2016 12:39:51  ...script version:  v0.05
14/02/2016 12:39:51  ...computer name:   MASTER01
14/02/2016 12:39:51  ...architecture:    AMD64
14/02/2016 12:39:51  ...username:        Administrator
14/02/2016 12:39:51  ...session name:    Console
14/02/2016 12:39:51  ...done...
14/02/2016 12:39:51
14/02/2016 12:39:51  Checking whether script is running with `administrator` rights...
14/02/2016 12:39:51  ...script appears to be running with `administrator` rights, script continuing...
14/02/2016 12:39:51  ...done...
14/02/2016 12:39:51
14/02/2016 12:39:51  Checking version of Windows...
14/02/2016 12:39:51  ...detected Windows major version as `6.3.`, appears to be `Windows 2012 R2`, script continuing...
14/02/2016 12:39:51  ...done...
14/02/2016 12:39:51
14/02/2016 12:39:51  Checking for presence of NetBackup...
14/02/2016 12:39:51  ...found NetBackup ok...
14/02/2016 12:39:51  ...client name:   master01
14/02/2016 12:39:51  ...type:          NetBackup Master Server
14/02/2016 12:39:51  ...path:          D:\Program Files\Veritas\
14/02/2016 12:39:51  ...version:       7.7.1
14/02/2016 12:39:51  ...done...
14/02/2016 12:39:51
14/02/2016 12:39:51  Determing locale, language-country, and date format...
14/02/2016 12:39:51  ...locale is:     0809
14/02/2016 12:39:51  ...language is:   en-gb
14/02/2016 12:39:51  ...search for:    en_gb
14/02/2016 12:39:51  ...translate to:  en_UK
14/02/2016 12:39:51  ...date format:   dd/mm/yyyy
14/02/2016 12:39:51  ...done...
14/02/2016 12:39:51
14/02/2016 12:39:51  Determining storage units and types...
14/02/2016 12:39:52  ...found:  master01-hcart3  Tape
14/02/2016 12:39:52  ...found:  master01-adv-disk-stu  Disk  DiskPool
14/02/2016 12:39:52  ...found:  master01-msdp-stu  Disk  DiskPool
14/02/2016 12:39:52  ...found:  master01-dsu-stu  Disk  Basic
14/02/2016 12:39:52  ...found:  master01-dsu2-stu  Disk  Basic
14/02/2016 12:39:52  ...done...
14/02/2016 12:39:52
14/02/2016 12:39:52  Listing the `2` discovered disk pools...
14/02/2016 12:39:52     Storage Unit                Disk Pool Name              Disk Pool Type    Disk Pool Media ID
14/02/2016 12:39:53     ------------                --------------              --------------    ------------------
14/02/2016 12:39:53     master01-adv-disk-stu       master01-adv-disk           AdvancedDisk      aaaaf
14/02/2016 12:39:53     master01-msdp-stu           master01-msdp               PureDisk          aaaah
14/02/2016 12:39:53  ...done...
14/02/2016 12:39:53
14/02/2016 12:39:53  Determining date format for bpexpdate...
14/02/2016 12:39:54  ...bpexpdate format is `dd/mm/yyyy`...
14/02/2016 12:39:54  ...bpexpdate date format is `UK`...
14/02/2016 12:39:54  ...year has `4` digits...
14/02/2016 12:39:54  ...done...
14/02/2016 12:39:54
14/02/2016 12:39:54
14/02/2016 12:39:54  N.B:  You now have a choice to make:
14/02/2016 12:39:54  ...enter YES, to     check for duplicates, and only select images on disk which do     have a copy on tape...
14/02/2016 12:39:54  ...enter NO,  to NOT check for duplicates, and      select images on disk which do NOT have a copy on tape...
14/02/2016 12:39:54
14/02/2016 12:39:54  _Check for duplicates on tape?  (YES,NO,exit) [NO]  :
14/02/2016 12:39:55  ...user entered ``...
14/02/2016 12:39:55  ...this has defaulted to `NO`...
14/02/2016 12:39:55  ...done...
14/02/2016 12:39:55
14/02/2016 12:39:55
14/02/2016 12:39:55  _Enter cutoff date in format `YYYY-MM-DD` [2016-01-23]  :
14/02/2016 12:39:56  ...user entered ``...
14/02/2016 12:39:56  ...this has defaulted to `2016-01-23`...
14/02/2016 12:39:56  ...checking whether cuttoff date is a valid date...
14/02/2016 12:39:56  ...cutoff date of `2016-01-23` appears to be valid...
14/02/2016 12:39:56  ...comparing to today's date...
14/02/2016 12:39:56  ...cutoff date appears to be a previous date...
14/02/2016 12:39:56  ...done...
14/02/2016 12:39:56
14/02/2016 12:39:56
14/02/2016 12:39:56  Now choose which image copies to `Identify`...
14/02/2016 12:39:56     1.   Identify all copies, no matter whether they are on disk or tape
14/02/2016 12:39:56     2.   Identify only copies that reside upon any form of disk, i.e. BasicDisk, AdvancedDisk, PureDisk, DataDomain
14/02/2016 12:39:56     3.   Identify only copies that reside upon any storage unit of BasicDisk
14/02/2016 12:39:56     4.   Identify only copies that reside upon any storage unit of AdvancedDisk
14/02/2016 12:39:56     5.   Identify only copies that reside upon any storage unit of PureDisk
14/02/2016 12:39:56     6.   Identify only copies that reside upon any storage unit of DataDomain
14/02/2016 12:39:56     7.   Identify only copies that reside on any tape
14/02/2016 12:39:56
14/02/2016 12:39:56  _Which option (1-7,EXIT) [2]  :
14/02/2016 12:39:57  ...user entered ``...
14/02/2016 12:39:57  ...this has defaulted to `2`...
14/02/2016 12:39:57  ...script will select image copies on storage of `Disk`...
14/02/2016 12:39:57  ...done...
14/02/2016 12:39:57
14/02/2016 12:39:57
14/02/2016 12:39:57  Listing backup images...
14/02/2016 12:39:58  ...counting images...
14/02/2016 12:39:58  ...found `76` backup images...
14/02/2016 12:39:58  ...done...
14/02/2016 12:39:58
14/02/2016 12:39:58  Filtering image list by cutoff date of `2016-01-23`...
14/02/2016 12:39:58  ...image:  2015-07-04  client01_1436028258
14/02/2016 12:39:58  ...image:  2015-07-04  client01_1436016188
14/02/2016 12:39:58  ...image:  2015-07-04  client01_1436015282
14/02/2016 12:39:58  ...sorting...
14/02/2016 12:39:58  ...count of images in source list:  76
14/02/2016 12:39:58  ...count of images before cutoff:   3
14/02/2016 12:39:58  ...done...
14/02/2016 12:39:58
14/02/2016 12:39:58  Filtering image list by number of copies...
14/02/2016 12:39:58  ...image:  2015-07-04  client01_1436015282                 copies: 1
14/02/2016 12:39:58  ...image:  2015-07-04  client01_1436016188                 copies: 3
14/02/2016 12:39:59  ...image:  2015-07-04  client01_1436028258                 copies: 1
14/02/2016 12:39:59  ...images checked:      3
14/02/2016 12:39:59  ...images to evaluate:  3
14/02/2016 12:39:59  ...done...
14/02/2016 12:39:59
14/02/2016 12:39:59  Filtering image list by storage of `Disk`...
14/02/2016 12:39:59
14/02/2016 12:39:59  ...checking image `1` of `3`, image:  client01_1436015282
14/02/2016 12:39:59  ......number of copies:  1
14/02/2016 12:39:59  ......copy number list:  1
14/02/2016 12:40:00  ......found image copy:  1       on:  PureDisk
14/02/2016 12:40:00
14/02/2016 12:40:00  ...checking image `2` of `3`, image:  client01_1436016188
14/02/2016 12:40:00  ......number of copies:  3
14/02/2016 12:40:00  ......copy number list:  1 2 3
14/02/2016 12:40:01  ......found image copy:  1       on:  PureDisk
14/02/2016 12:40:01  ......found image copy:  2       on:  AdvancedDisk
14/02/2016 12:40:01  ......found image copy:  3       on:  BasicDisk
14/02/2016 12:40:01
14/02/2016 12:40:01  ...checking image `3` of `3`, image:  client01_1436028258
14/02/2016 12:40:02  ......number of copies:  1
14/02/2016 12:40:02  ......copy number list:  1
14/02/2016 12:40:02  ......found image copy:  1       on:  PureDisk
14/02/2016 12:40:02
14/02/2016 12:40:02  ...finished evaluating images...
14/02/2016 12:40:02  ...evaluated images:  3
14/02/2016 12:40:02  ...copies selected:   5
14/02/2016 12:40:02  ...done...
14/02/2016 12:40:02
14/02/2016 12:40:02  Script exiting...
14/02/2016 12:40:02  ...script started:  14/02/2016 12:39:51
14/02/2016 12:40:02  ...script ended:    14/02/2016 12:40:02

Press any key to continue . . .
Contributors