Forum Discussion

Michael_G_Ander's avatar
6 years ago

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

4 Replies

  • 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.

    • 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.

      • Michael_G_Ander's avatar
        Michael_G_Ander
        Level 6

        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.