How to backup a Database with a SQL Script

Posted by robd on January 17, 2012
SQL

Often at work I’ll need to back-up a SQL server as I’m about to apply patches to the server or do something worrying with power etc!

 

There’s loads of ways to backup SQL:

–          If it’s a VM snapshot the bugger (potentially slow depending on the resources)

–          Log on to the Management Studio and right click the database you want to backup and follow all the instructios

–          Or my favourite method, Log onto the Management Studio start a Query for your desired database and run the following:

 

BACKUP DATABASE databaseName TO DISK = '\\Server\Share\databaseName.bak'

WITH PASSWORD = 'SUPERSECRETPASSWORD',

AND STATS = 1

 

Its fast and straight forward and with the stats line you can monitor the progress!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.