- Open command prompt (Run -> cmd)
- Change to directory "<<drive>>:\<<installation folder>>\Microsoft SQL Server\100\Setup Bootstrap\Release" (eg: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Release)
- USE THE FOLLOWING COMMAND
If you have SQL configured for Windows Authentication Mode :
setup /ACTION=REBUILDDATABASE /QUIET /INSTANCENAME=<instance name> /SQLSYSADMINACCOUNTS=<accounts>
Eg: setup /ACTION=REBUILDDATABASE /QUIET /INSTANCENAME=SQLEXPRESS /SQLSYSADMINACCOUNTS=mypc\Administrators
If you have SQL configured for Mixed Authentication Mode
setup /ACTION=REBUILDDATABASE /QUIET /INSTANCENAME=<instance name> /SQLSYSADMINACCOUNTS=<accounts> /SAPWD=<password>
When setup has completed rebuilding the system databases, it will return to the command prompt with no messages
After rebuilding the databases, user instance disabled.
You can enable it either using the command prompt tool named sqlcmd or by using Management Studio.
If using Command tool:
C:\>SQLCmd -S.\sqlexpress -E
1> EXEC sp_configure 'user instances enabled', 1
2> go
Configuration option 'user instances enabled' changed from 0 to 1. Run the RECONFIGURE statement to install.
1> RECONFIGURE
2> GO
FOR MORE DETAILS
http://technet.microsoft.com/en-us/library/dd207003%28v=sql.100%29.aspx
http://blogs.msdn.com/b/psssql/archive/2008/08/29/how-to-rebuild-system-databases-in-sql-server-2008.aspx
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/8dabc79b-edef-45fe-a50a-7cf8515c6ed1/how-do-i-run-the-spconfigure-stored-procedure