Example SQL query to backup a database to disk
This sample SQL query can be executed to backup a site collection database to a file, where WSS_Content_Intranet is the name of the database used by the Site Collection.
Use WSS_Content_Intranet
DBCC Shrinnkfile (‘WSS_Content_Intranet’)
DBCC Shrinnkfile (‘WSS_Content_Intranet_log’)
GoBackup Database WSS_Content_Intranet To Disk = ‘C:\Backups\WSS_Content_Intranet.bak’
GoBackup Log WSS_Content_Intranet_Log To Disk = ‘C:\Backups\WSS_Content_Intranet_Log.bak’;
GoDBCC Shrinnkfile (‘WSS_Content_Intranet’)
DBCC Shrinnkfile (‘WSS_Content_Intranet_log’)
Go
Note: Ensure there is enough disk space available to store the backup file