NetBackup, a Windows based script to identify oldest backup images by storage type.
Updated 9 years ago
Version 2.0Here'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 . . .