How to back up and restore your SES Database using SQL commands?
The following shows simple scripts to create backups and restore from them for a typical SES Database.
Backup database 'SESDB' to a file called 'SESDB_backup_1.bak' (will be placed by default in "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup"):
Tailor the following to match the name of your SES dtabase, its server location:
NOTE: replace [SESDB] with the name of your database and the name of your destination backup file.
NOTE: Your finished script should NOT have any square brackets [ ]
How to backup the SES Database:
Sample Database Backup Code fragment
USE [SESDB]
GO
BACKUP LOG [SESDB] WITH TRUNCATE_ONLY
DBCC SHRINKFILE(2, 1)
GO
BACKUP DATABASE [SESDB] TO
DISK = N'\SESDB_backup_1.bak'
GO
It is assumed that the db has only one log file (number 2).
How to restore the SES database from a backup:
Restore database 'SESDB' (could be nonexistant) from the same backup in the default backup folder. The MDF/LDF files will also be moved to the desired location:
Sample Database source Code
RESTORE DATABASE SESDB
FROM DISK='\SESDB_backup_1.bak' WITH FILE =1 ,
MOVE N'SESDB_Data' to N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\SESDB.mdf' ,
MOVE N'SESDB_Log' to N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\SESDB.ldf',
NOUNLOAD, REPLACE;
GO
How to get a List of Files in the Backup
It is assumed that the SQL Server data location is in "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data", and the Data and Log logical file names are "SESDB_Data" and "SESDB_Log" respectively. One way to determine the above is to first get a file list by executing:
Source Code to get List of Files in Backup Title
RESTORE FILELISTONLY FROM DISK='\SESDB_backup_1.bak' ;
GO
Custom Fields
Version: SecureDoc 4.9, SecureDoc 5.0, SecureDoc 5.1, SecureDoc 5.2, SecureDoc 5.3 SR1, SecureDoc 5.3 SR2