How Do You Restore A SQL Server Database Using Transact-SQL?
One of the most important skills needed as a SQL Server DBA is the ability to restore a database from backup (i.e. bak file). Data availability is a critical aspect of database management. Knowing how to quickly and easily restore a database is paramount to your duties as a DBA. Hopefully, the need does not arise as a result of an unforeseen a disaster, but perhaps a user simply wishes to have a copy restored for a variety of other reasons. In either case, you should be well prepared. While SQL Server 2005 makes it easy to restore a database from SQL Server Management Studio, it’s even easier to do it using this helpful transact-SQL script along with these tips. Create an automated maintenance plan that creates regularly scheduled database backups. The backup should be saved to a drive other than the one where database files (.mdf) are stored. At least three days worth of backups should be saved. Furthermore, make sure the backup files are being backed up to a additional media, such as