you will want to make certain that if you take a backup of master on a server in your environment that you aren’t interfering with any existing backup plan:
BACKUP DATABASE [master] TO DISK = N'C:SQLBackupsmaster.bak' |
Next we will create a test login as part of our practice run:
USE [master] GO CREATE LOGIN [master_restore_test] WITH PASSWORD=N'test', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF |
Just for fun, we will create a new database as well:
CREATE DATABASE [restore_test] |
Since the login and database were created after the backup they won’t be there after the restore is complete.
RESTORE DATABASE master FROM DISK = 'C:SQLBackupsmaster.bak' WITH REPLACE
CREATE DATABASE [restore_test] ON ( FILENAME = N'C:SQLData estore_test.mdf' ), ( FILENAME = N'C:SQLLogs estore_test_log.ldf' ) FOR ATTACH