Command to get mediad serial number ?

Hello

Does someone know a command to get the media serial number ? (not barcode as that can be changed)

Have found this old tech note: https://www.veritas.com/content/support/en_US/article.100027311.html

where it seem that netbackup stores the information in the EMM DB.

Have played aorund with nbemmcmd, but without luck so far.

Regards

Michael

The standard questions: Have you checked: 1) What has changed. 2) The manual 3) If there are any tech notes or VOX posts regarding the issue
4 Replies

Re: Command to get mediad serial number ?

It's one of the fields in the EMM_Media table.

If it doesn't appear in nbemmcmd -listmedia output then it's not a field you will get from any other command.

The only way to get it is to loook in the DB directly ...

nbdb_unload /my/output/dir

vi reload.sql

Search forward for INPUT INTO "EMM_MAIN"."EMM_Media"

You should see something like this

INPUT INTO "EMM_MAIN"."EMM_Media"
FROM '/netbackup/db/775.dat'
FORMAT TEXT
ESCAPE CHARACTER '\\'
BY ORDER("MediaKey","DriveKey","MediaGuid","MediaId","PartnerKey"     <snip>

You can see the .dat file name for that table (it differs betwwen NBU releases) - the bottom line which I have <snipped> as it is long, shows the fields of the table in the correct order, so field 1 isMediaKey, field 2 is DriveKey and so on ...

The 64th field at the version of NBU I have 

64 ,"SerialNumber" varchar(32) NOT NULL DEFAULT ''

You could also search the reload.sql file for :  CREATE TABLE "EMM_MAIN"."EMM_Media"

CREATE TABLE "EMM_MAIN"."EMM_Media" (
"MediaKey" unsigned int NOT NULL DEFAULT autoincrement CONSTRAINT "CKC_MEDIAKEY_EMM_MEDI" check("MediaKey
" >= 4000001)
,"DriveKey" unsigned int NOT NULL DEFAULT 0
,"MediaGuid" binary(16) NOT NULL DEFAULT "NEWID"()
,"MediaId" varchar(32) NOT NULL
,"PartnerKey" unsigned int NOT NULL DEFAULT 0
,"PartnerId" varchar(32) NOT NULL DEFAULT ''
,"LegacyMediaType" integer NOT NULL DEFAULT -1
,"MediaTypeName" varchar(64) NOT NULL DEFAULT ''
,"MediaGroupName" varchar(128) NOT NULL
,"DensityName" varchar(32) NOT NULL DEFAULT ''
,"DensityCode" binary(8) NOT NULL DEFAULT 0
,"VerificationFlag" integer NOT NULL DEFAULT 0
,"AssignedAppType" integer NOT NULL DEFAULT 0
,"MediaFlags" integer NOT NULL DEFAULT 0
,"MediaTypeFlags" integer NOT NULL DEFAULT 0

<snip>

This gives a list of the fields in a easier to read format, but you still need to search  to confirm the .dat file name for the table.

Highlighted

Re: Command to get mediad serial number ?

Thanks, that is something work out from.

Too bad I can't do a select of mediaid and serial number directly on the table in the database.

The standard questions: Have you checked: 1) What has changed. 2) The manual 3) If there are any tech notes or VOX posts regarding the issue

Re: Command to get mediad serial number ?

Ended up with using nbdb_load -t EMM_media to limit the output to the relevant table.

Then is just using a script language to pull out the wanted information from the dat file.

The standard questions: Have you checked: 1) What has changed. 2) The manual 3) If there are any tech notes or VOX posts regarding the issue

Re: Command to get mediad serial number ?

ahh yes, good thinking, regarding the -t <table option>.

Just be aware that between different NBU versions the .dat files can change, and although perhaps less likely, at least for the EMM_Media table, the fileds can change as well.  Not a massive deal, you just have to check and adjust your script if you upgrade.