Nothing revolutionary here, but I thought I’ll document the procedure as I happen to use it every now and then.
All VMs are assigned with a MoRef id when they are added to a vCenter deployment.
When you want to backup a VM using Veeam B&R, you add it into a pre-configured job using its name, however on the backend Veeam associates the VM with that job using the MoRef id.
If the VM which is being backed up by Veeam B&R is removed from the vCenter inventory (because you removed a whole host from vCenter or a VM was in an invalid state), the MoRef id for that VM will change when the VM is added back into the vCenter. Veeam will not register the MoRef id change automatically and kick off a new full backup (on the next backup cycle) for the same VM it previously backed up – thinking it’s a completely new VM (due to the unique new MoRef id).
To avoid a new full backup, you need to manually update the MoRef id for that VM in the Veeam database prior to the next backup cycle.
Note that the following steps are not supported by Veeam officially. Mess with the Veeam database at your own risk!
Here are the steps:
Backup Veeam config and database & install SQL Management Studio (on the Veeam server, assuming your Veeam database is not on a dedicated SQL server).
Find out the MoRef id of VM using Powercli – before you remove it from Vcenter inventory.
connect-viserver vcenter FQDN
get-vm | select name,id
You should get back something similar to –
VirtualMachine-vm-250645
Remove VM from inventory and add it back in – and then run the Powercli script above to find out the new id.
You should get back something similar to –
VirtualMachine-vm-578808
Locate id in Veeam database running following SQL query:
SELECT [dbo].[BObjects].id, [dbo].[BObjects].object_id, [dbo].[BObjects].host_id, [dbo].[BObjectsSensitiveInfo].object_name, [dbo].[BObjectsSensitiveInfo].path
FROM [dbo].[BObjects]
INNER JOIN [dbo].[BObjectsSensitiveInfo] ON [dbo].[BObjectsSensitiveInfo].bObject_id=[dbo].[BObjects].id
WHERE object_id = 'vm-250645'
You should get back something similar to –
Now update id running following SQL query –
UPDATE [dbo].[BObjects]
SET [object_id] = 'vm-578808'
WHERE [object_id] = 'vm-250645'
SET line – NEW ID, WHERE line – OLD ID
Run the following SQL query again –
SELECT [dbo].[BObjects].id, [dbo].[BObjects].object_id, [dbo].[BObjects].host_id, [dbo].[BObjectsSensitiveInfo].object_name, [dbo].[BObjectsSensitiveInfo].path
FROM [dbo].[BObjects]
INNER JOIN [dbo].[BObjectsSensitiveInfo] ON [dbo].[BObjectsSensitiveInfo].bObject_id=[dbo].[BObjects].id
WHERE object_id = 'vm-250645'
You should get back no results!
Now run the same SQL query after replacing object_id –
SELECT [dbo].[BObjects].id, [dbo].[BObjects].object_id, [dbo].[BObjects].host_id, [dbo].[BObjectsSensitiveInfo].object_name, [dbo].[BObjectsSensitiveInfo].path
FROM [dbo].[BObjects]
INNER JOIN [dbo].[BObjectsSensitiveInfo] ON [dbo].[BObjectsSensitiveInfo].bObject_id=[dbo].[BObjects].id
WHERE object_id = 'vm-578808'
You should get back something similar to –
Now kick off the backup job or wait until the next backup cycle. The resulting backup job for particular VM should be incremental not FULL!
Additional notes:
If you don’t have a record of the previous MoRef id, as in prior to it changing, then search the Veeam DB using the VM name.
Simply modify the SQL query as below before running it –
SELECT [dbo].[BObjects].id, [dbo].[BObjects].object_id, [dbo].[BObjects].host_id, [dbo].[BObjectsSensitiveInfo].object_name, [dbo].[BObjectsSensitiveInfo].path
FROM [dbo].[BObjects]
INNER JOIN [dbo].[BObjectsSensitiveInfo] ON [dbo].[BObjectsSensitiveInfo].bObject_id=[dbo].[BObjects].id
WHERE object_name = 'VM NAME'
The id in the object_id column of results is the old id, you can find the new id by running the Powercli script above, then use the same update SQL query to update the id.
The update SQL query can be run in batch, if you need to update the MoRef id of multiple VMs.
UPDATE [dbo].[BOobjects]
SET [object_id] = 'new-id'
WHERE [object_id] = 'old-id'
SET [object_id] = 'new-id'
WHERE [object_id] = 'old-id'
SET [object_id] = 'new-id'
WHERE [object_id] = 'old-id'
SET [object_id] = 'new-id'
WHERE [object_id] = 'old-id'
SET [object_id] = 'new-id'
WHERE [object_id] = 'old-id'
SET [object_id] = 'new-id'
WHERE [object_id] = 'old-id'
Thank you!! I do not get why Veeam just doesn’t make a little utility to do this for you as a standard thing. It is one of the things I absolutely hate about Veeam and has made me question using it with my VMware environment as this type of thing can happen easily.