Restoring Vault Databases

A collection of information about Vault, including solutions to common problems.

Moderator: SourceGear

Post Reply
Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Restoring Vault Databases

Post by Beth » Fri Mar 31, 2017 9:19 am

There may be cases where one will need to restore Vault databases. These can include moving the Vault databases to a different SQL Server or in the case of disaster recovery when a hard drive is corrupted. When restoring the Vault databases, they must all be restored at the same time. The sgvault and sgmaster databases are required in all cases. Sgdragnet is required for Vault Professional. Sgnotify and sgvaultindex should be restored if they are available. One should avoid restoring a mix of backups from different times.

After a database is restored, users should clear their caches prior to opening their clients. See this KB article for additional information: viewtopic.php?t=217.

There are a few methods for restoring I will list here:

1) Restoring using the Vault admin backup/restore web page.
  • The Backup/Restore page allows the user to backup and restore all Vault databases, which include sgvault, sgmaster, and sgdragnet if you are using Vault Professional. This page uses the SQL Server basic backup and restore functions. This page can only be used to restore databases on the server on which Vault already resides.
2) Restoring using SQL Server Management Studio (SSMS)
  • SSMS has a restore function. Details on how to use it can be found in Microsoft's documentation: https://msdn.microsoft.com/en-us/librar ... l.90).aspx. If you are restoring a backup that was created using Vault's admin web page, you will need to rename the file extension of each back up file from .sgvbak to .bak. This method can be used in any case where you may need to restore the Vault databases.
3) Restoring using a SQL Query
  • In SSMS you can click New Query and paste in the example code provided below to restore a database and decide it's restore location at the same time. Replace the sections "xxx_some path_xxxx " with the appropriate locations. In addition replace the backup names with the correct backup name.

Code: Select all

--SGVAULT
RESTORE DATABASE sgvault
FROM DISK = 'x:\ xxx_some path_xxxx \vault backup name.bak'
WITH MOVE 'sgvault' to 'x:\ xxx_some path_xxxx \sgvault.mdf',
     MOVE 'sgvault_log' to 'x:\xxx_some path_xxxx\sgvault_log.ldf'  

--SGMASTER
RESTORE DATABASE sgmaster
FROM DISK = 'x:\ xxx_some path_xxxx \sgmaster backup name.bak'
WITH MOVE 'sgmaster' to 'x:\ xxx_some path_xxxx \sgmaster.mdf',
     MOVE 'sgmaster_log' to 'x:\xxx_some path_xxxx\sgmaster_log.ldf'  

--SGDRAGNET
RESTORE DATABASE sgdragnet
FROM DISK = 'x:\ xxx_some path_xxxx \dragnet backup name.bak'
WITH MOVE 'sgdragnet' to 'x:\ xxx_some path_xxxx \sgdragnet.mdf',
     MOVE 'sgdragnet_log' to 'x:\xxx_some path_xxxx\sgdragnet_log.ldf'  

--SGNOTIFY
RESTORE DATABASE sgnotify
FROM DISK = 'x:\ xxx_some path_xxxx \sgnotify backup name.bak'
WITH MOVE 'sgnotify' to 'x:\ xxx_some path_xxxx \sgnotify.mdf',
     MOVE 'sgnotify_log' to 'x:\xxx_some path_xxxx\sgnotify_log.ldf'  

--SGVAULTINDEX
RESTORE DATABASE sgvaultindex
FROM DISK = 'x:\ xxx_some path_xxxx \vaultindex backup name.bak'
WITH MOVE 'sgvaultindex' to 'x:\ xxx_some path_xxxx \sgvaultindex.mdf',
     MOVE 'sgvaultindex_log' to 'x:\xxx_some path_xxxx\sgvaultindex_log.ldf'  

Beth Kieler
SourceGear Technical Support

Post Reply