

The example starts sqlcmd and executes a RESTORE DATABASE statement that restores a full database backup of master from a disk device: Z:\SQLServerBackups\master.bak.įor a named instance, the sqlcmd command must specify the -S \ option.In the event of disaster recovery, the instance where the master database is being restored to should be as close to an exact match to the original as possible. The example assumes that the server instance is already running in single-user mode. The following example restores the master database on the default server instance. Restart the server instance normally as a service, without using any startup parameters.Ĭontinue other recovery steps such as restoring other databases, attaching databases, and correcting user mismatches.

For more information, see Configure Server Startup Options (SQL Server Configuration Manager). Before you restart the server instance, remove the single-user startup parameter. For more information, see Use the sqlcmd Utility.Īfter master is restored, the instance of shuts down and terminates the sqlcmd process. In single-user mode, we recommend that you enter the RESTORE DATABASE statement in the sqlcmd utility. The existing database, if any, is deleted. The REPLACE option instructs to restore the specified database even when a database of the same name already exists. RESTORE DATABASE master FROM WITH REPLACE For more information about startup parameters, see Database Engine Service Startup Options.įrom a command prompt, run the following commands, and make sure you replace MSSQLXX.instance with the appropriate folder name: You can start SQL Server by either using the -m or -f startup parameters. Start the server instance in single-user mode.

Doing otherwise might result in undefined SQL Server instance behavior, with inconsistent feature support, and is not guaranteed to be viable. At a minimum, this recovery instance should be the same version, edition, and patch level, and it should have the same selection of features and the same external configuration (hostname, cluster membership, and so on) as the original instance. In the event of disaster recovery, the instance where the master database is being restored to should be as close to an exact match to the original as possible. This article explains how to restore the master database from a full database backup. Restore the master database (Transact-SQL)
