Subscribe Now!

Enter your email address:

Wednesday, November 16, 2011

Database BackUp and Restore Script

For .Net developer a very common task is to take reguler backup and restore of SQL Server Database. Most of the time developer does that thru UI of Sql Server Management Studio. It is acully nice to know the Scripts which we can run and take backup and restore easily.


       To BackUp :-        
     BACKUP DATABASE [DatabaseName] TO DISK = 'C:\FileName.bak' WITH FORMAT
       To Restore :-
           RESTORE DATABASE [DatabaseName] FROM DISK = 'C:\FileName.bak'


Also when ever you do any database opration thru UI of Sql Server Management Studio you can always have look to the Script behind that opration. Its good practise to look at the script run by Sql Server to do any database realted opration. 

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...