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’)
Go

Backup Database WSS_Content_Intranet To Disk = ‘C:\Backups\WSS_Content_Intranet.bak’
Go

Backup Log WSS_Content_Intranet_Log To Disk = ‘C:\Backups\WSS_Content_Intranet_Log.bak’;
Go

DBCC Shrinnkfile (‘WSS_Content_Intranet’)
DBCC Shrinnkfile (‘WSS_Content_Intranet_log’)
Go

Note: Ensure there is enough disk space available to store the backup file

 

[BlogBookmark] [Blogsvine] [del.icio.us] [Digg] [Facebook] [Furl] [Google] [LinkedIn] [MySpace] [Reddit] [Slashdot] [StumbleUpon] [Twitter] [Windows Live] [Yahoo!] [Email]