Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why change user type to SQL user with login is disabled in SSMS?

I backed up a database from a SQL Server 2008 and restored it to my local machine using SQL Server 2012, now I'm trying to login to the server with the copied database user account and I wasn't able to do so.

After googling the issue I found that I have to change the user type from SQL User Without Login to SQL User with Login but the drop-down list is disabled as you can see in the picture below, how can I fix this and is this is the best way of doing what I need to accomplish or do I need to add this user to the server level?

enter image description here

like image 654
Mina Gabriel Avatar asked Aug 14 '14 14:08

Mina Gabriel


People also ask

How do I enable SQL Login?

To enable the System Administrator (SA) loginClick Connect to open the Microsoft SQL Server Management Studio window. Expand Security and then expand Logins. Right-click sa and click Properties. Select Enabled under Login.

How do I enable a disabled SQL Server account?

--how can I get the account to be able. In Object Explorer, expand Security-> Logins->right-click the sql server login-> Properties. On the Status page, in the Login section, click Enabled. If the answer is helpful, please click "Accept Answer" and upvote it.

Can a Login be disabled in SQL Server?

9 Answers. No, it can't be disabled. Distributor_admin is a SQL Server login account which is used by the repl_distributor linked server (remote server) in SQL Server replication.


1 Answers

I remember running into this before when doing backup / restore across servers. Basically it comes down to how SQL Server works. There's SQL Server users & there's database users (SQL Server users who are database users are represented via mappings). They are however not the same thing.

A SQL Server user belongs to the SQL Server, a database user ONLY belongs to the associated database. What happens when you have a database user, but not a SQL Server user? You can't login to SQL Server non-obviously.

Thereby what I do is after moving the database, I add the user I need to login as to SQL Server users using SSMS, remove the old database user (it's got dependencies associated w it that prevent mapping to it) & lastly make a new user on the database by mapping my SQL user to the database w appropriate permissions.

This approach is by no means elegant, but it works 100% of the time w no code needed, & you should consider a more permanent system if you have automated backup / restores happening. For the one off, this is how I've always done it.

like image 51
RandomUs1r Avatar answered Oct 09 '22 05:10

RandomUs1r



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!