Starting SQL Server in safe mode if engine does not start

Starting SQL Server In Safe Mode (if engine does not start)
If SQL Server Engine Does Not Start - for debugging there are other ways of starting SQL Server
If the SQL Server service will not start try running in safe mode
Can go to c:\program files\microsoft sql server\mssql10.mssqlserver\mssql\binn\ via command prompt
sqlservr -c -f (this gives a verbose output to screen when starting to help diagnose)
OR add -f to start parameters on microsoft sql server services screen to run safe mode as a service
Starting SQL Server In Single User Mode (used for recovering master database)
MSSQL Server can be run in single user mode by using the -m startup parameter on the mssqlserver service.  Use configuration manager - SQL Server Services - SQL Server - Advanced - Startup Parameters and apend -m; to start of parameters. No spaces between this and what follows.  In SQL Server 2012 and 2008 R2 add -m into Startup parameters as a seperate line (Startup parameters not underneath Advanced in this version).
It can also be started from the command prompt sqlservr -c -m -s<instancename>
If Engine does not start due to missing master database files, then master will need to be rebuild:
1: cmd as administrator
2: cd c:\program files\microsoft sql server\120\Setup Bootstrap\SQLServer2014\
3: setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=RAJDBAL01SQD_1 /SQLSYSADMINACCOUNTS=builtin\administrators /SAPWD=<sapassword>

Can now start service and proceed to restore master from backup.

Setting Database to Single User Mode
ALTER DATABASE 'dbname' SET SINGLE_USER;
Setting Database to Multi User Mode
ALTER DATABASE 'dbname' SET MULTI_USER
Setting Database to Emergency Mode
Used if data cannot be accessed in suspect database, will be accessible read only by sysadmin
ALTER DATABASE 'dbname' SET EMERGENCY;
Setting Database to Online
ALTER DATABASE 'dbname' SET ONLINE;
Setting Database to Readonly
Useful for taking a final backup
ALTER DATABASE 'dbname' SET READ_ONLY WITH NO_WAIT;
Setting Database to Read Write
ALTER DATABASE 'dbname' SET READ_WRITE;

Comments

Popular posts from this blog

SQL SERVER – Event ID 107- Report Server Windows Service (MSSQLSERVER) cannot connect to the report server database.

SQL Server Builds Information

Using DBCA silent install and disabling automatic memory management