viernes, 27 de febrero de 2015

Fix+Create Database permission denied in database 'master'+SQL Server 2008 R2

Hi guys, In order to fix this you have to follow the next steps:

1.  First then all, Stop SQL Server from Sql Server Configuration Manager
2.  Then, Open a CMD window (as Administrator), execute the following command and don't close this window: 
   "c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -m -s SQLEXPRESS 
3.  After that, just open a new CMD window (as Administrator)  and run the next command:
      sqlcmd -S .\SQLEXPRESS 
     Then, we need to assign the sysadmin role to your user, executing the next 2 lines:
        3.1.  sp_addsrvrolemember 'YourDomain\YourUserName', 'sysadmin' 
        3.2.  GO 
4.  Now, go back to first CMD window and press Ctrl+C and Y (yes) to shutdown SQL Server.  Then, you just need to start SQL Server from Sql Server Configuration Manager. Log into Management Studio, go to  Security / Logins and the user you use should be a "sysadmin."