MSSQL master Database Maintenance

Command line options to start SQL server in single user mode for master database restore. Add -f for a minimal setup.

sqlservr.exe -c -m –sINSTANCENAME

Setup option to recreate the master database.

./setup.exe /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS=DOMAIN\adminaccount

MSSQL Restore Torn Page

To restore a specific torn page first make a backup from the transaction log with NORECOVERY (tail backup).

RESTORE DATABASE Databasename PAGE='1:234'
FROM DISK='X:\Path\To\Full\DatabaseBackupFile.bak'
WITH NORECOVERY
GO

Then restore all transaction log backups made sinds the Full backup with NORECOVERY. Then restore the tail backup WITH RECOVERY.