Tuesday, 8 September 2015

Add User in SQL Server 2005/2008/2010/2012/2014

As salamo alaikum wa rahmatullah

Problem - Suppose you have installed the sql server with 'domainname\username' and forgot the enable sa user. for example 'test.com\admin'
Now you join the different domain - 'example.com\admin', now you are trying to access with new domain connection.
your management studio is unable to connect with the current domain user.

Solution - Follow the following step ..

First stop MSSQLSERVER services from the services.
write sqlcmd in run 
SQLCMD run as administrator

c:\> sc start MSSQLSERVER -m (MSSQLSERVER is service name)

C:\>SQLCMD -s GREENTECHAX (GREENTECHAX is instance name)
1>use master
2>go
1>Sp_addsrvrolemember  'fccdynamics\administrator', 'sysadmin'
2>go
1>Sp_addsrvrolemember  'domain\account', 'sysadmin' <CR>
2>Go

After that, Restart the service and start the ssms.
you are able to now connect with new domain.
--
Thanks and Regards
Mohammad Shahnawaz
Passion for Oracle

No comments:

Post a Comment