Using the vmquery -deassignbyid can be a bit dangerous. If you deassgn the meida before expireing the media the images are still in the image database but no long assigned to the media. Ooops.
I use bpexpidate -m mediaid -d 0 then after the next catalog backup the images are expired off of the media. After running the bpexpidate command you can run the vmquery command. You can for bpexpdate with the -f switch
bpexpdate -ev MEDIA_ID -d 0 -force -host HOST
so in a nut shell
To remove media from the Netbackup database
* Verify that there are no images on the tape
bpimmedia -mediaid 000687 -L
* Expire the tape
bpexpdate -ev 000687 -d 0 -host scorpius -force
* Get the status and pool number of the tape
vmquery -m 000687
* Deassign the tape
vmquery -deassignbyid
vmquery -deassignbyid 000687 4 0x0
* Delete the tape
vmdelete -m 000687