I have restored a database but the owner is 'dbo'; I wish to change the owner to 'dba'.
I have tried: sp_changedbowner dba,true; it run successfully but I can't login as dba.
I then tried:
open the database
expand security
right click, choose 'New', then choose 'User'
Entries Under General tab are:
User type is: SQL user with login
User name: dba
Login name: dba
Default schema -> left blank
I did NOT make any other entries on the remaining tabs.
When I click ok, I get this message:
TITLE: Microsoft SQL Server Management Studio
Create failed for User 'dba'. (Microsoft.SqlServer.Smo)
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=16.100.47021.0&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+User&LinkId=20476
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
The login already has an account under a different user name. (Microsoft SQL Server, Error: 15063)
For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver-15063-database-engine-error
BUTTONS:
OK
I am confused by this message: "The login already has an account under a different user name.".
How do I resolve this?
Thanks
I tried to create a 'dba' user in the restored database but was unable to do so.
See above
Related
We are using SQL server 2014, we update a password for a user login here
we click properties on a given login account and change the password here
we are certain we entering it correctly when we then try to login to the server using the login and password we get the following error
I don't know where else to look and what else to change -- when we do the same process on a different server it works without issue. But here its failing.
Where should we look and what else do we need to troubleshoot. Could it be we don't have access to certain databases, how do we fix this.
These are some of the errors coming through in the system logs
Message
Login failed for user ‘abc’. Reason: Failed to open the explicitly specified database ‘AMS'. [CLIENT---]
Message
Login failed for user 'abc’. Reason: Failed to open the database ‘Budget’ specified in the login properties. [CLIENT: ---]
Message
Login failed for user ‘abc’. Reason: Password did not match that for the login provided. [CLIENT: ----]
You must set a default database where the user AND relative login can access.
Logins are objects with a password
Users are objects, mapped to Logins, added to SQL Server entities.
Under Server -> Security -> Logins
Unser Database -> Security -> Users
Check also if the user is correctly mapped to the login.
To solve your problem you can set the master database as the default for your login.
You can find out more about the error in the SQLServer logs as described here https://learn.microsoft.com/en-us/sql/relational-databases/performance/view-the-sql-server-error-log-sql-server-management-studio?view=sql-server-ver16.
If you are looking for a quick fix to your problem, you can either:
assign more server roles to your login
or grant it an individual permission
use master;
grant CONNECT ANY DATABASE TO <login>;
I'm trying to make a new login in SSMS. I need it for the presistnase.xml in java jpa.
I click in security -> logins -> new login and I choose SQL Server Authentication.
I write user name and password.
Them i try to connect with the new login, and I get the following message:
TITLE: Connect to Server
------------------------------
Cannot connect to DESKTOP-MJ1GR85.
------------------------------
ADDITIONAL INFORMATION:
Login failed for user 'n'. (Microsoft SQL Server, Error: 18456)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476
there are two steps: create a user, then give that user a role in the selected database. eg:
-- create a user:
CREATE LOGIN myUserName WITH PASSWORD=N'newPassword', DEFAULT_DATABASE = MASTER,
DEFAULT_LANGUAGE = US_ENGLISH;
-- give that user access to the database, by allocating a role in the db:
ALTER ROLE [db_owner] ADD MEMBER [myUserName];
note: I wouldn't recommend a user name as short as n
I am attempting to run a snapshot for replication using the following settings.
-Publisher [CUST-5NSA] -PublisherDB [Ticketing] -Distributor [CUST-5NSA] -Publication [TicketingBase] -ReplicationType 2
-DistributorSecurityMode 1
When this runs I get the following error:
Connecting to Distributor CUST-5NSA The replication agent had
encountered an exception Source: Replication Exception Type:
Microsoft.SQLServer.Replication.ConnectionFailureException Exception
Message: Login failed for user 'CUST-5NSA\Administrator' Message Code:
18456
The strange thing is that the event viewer shows that the error is actually that the administrator account doesn't exist which is impossible since I can log in with it.
But even more important there is no setting that I can find that uses the administrator account for replication. We have another account that we use for all the replication settings.
Can anyone point to where this login is coming from?
Go to Replication/Local Publications. Right click on your publication and select Properties. In the Publication Properties dialog, from the left panel, select Agent Security.
Now you can check security settings of Snapshot Agent ( and also Log Reader Agent ) by clicking on the associated Security Settings button. After clicking that button, you see a dialog that by selecting 'Using the following SQL Server login', you can provide the credentials of a SQL Server account on the Publisher that has enough permissions to access the Publisher database or just select 'By impersonating the process account' to use Windows Authentication.
When I start deploying, I get this error:
Internal error: The operation terminated unsuccessfully.
Errors in the high-level relational engine. The database operation was cancelled because of an earlier failure.
Errors in the OLAP storage engine: An error occurred while the dimension, with the ID of 'Dim Customer', Name of 'Customer' was being processed.
OLE DB error: OLE DB or ODBC error: Login failed for user 'NT Service\MSSQLServerOLAPService'.; 28000; Cannot open database
"AdventureWorksDW2012" requested by the login. The login failed.; 42000.
What's wrong? and how can I fix it?
Had the same problem and Daniel's Meresa answer was helpful. The detailed resolution in may case was to run SQL Management Studio and in Object Explorer select Security - Logins - Right click - "New Login...". Fill in the following login name "NT Service\MSSQLServerOLAPService" and check sysadmin in Server Roles. It should be enough.
The error says, you need to add 'NT Service\MSSQLServerOLAPService' user to "AdventureWorksDW2012" database. You can do this in SSMS. Connect to your "AdventureWorksDW2012" database. Under Security-> User, add new user 'NT Service\MSSQLServerOLAPService' with db_datareader, db_owner(Optional) property [Membership, Owned_Schemas tab]
Have a look at the impersonation options on the data source you defined in analysis services that holds the source data of the customer dimension. There you can configure what credentials SSAS should use to connect to the data source.
MSDN entry on impersonation options
make sure you add the user 'NT Service\MSSQLServerOLAPService' into the database and assign the appropriate role read...also make sure to select use service account option under impersonation option in the cube source.
I have downloaded database and attached it to my local sql server, however I can't seem to change the password of one the existing user's on the db.
Using the following command:
ALTER LOGIN [NotificationsUser] WITH PASSWORD = 'password';
I get the error:
Msg 15151, Level 16, State 1, Line 1
Cannot alter the login
'NotificationsUser', because it does
not exist or you do not have
permission.
Is this possible?, what access permissions do I need to change user permissions anyway ?
If you've attached this database to your local SQL server then you'll need to do a couple of things:
If you haven't already done so, create user logins on your SQL server to match the ones that exist in the attached database. It's simpler to do this before attaching the database. But it can be done after the DB has been attached.
Because the SID's of the users in the newly attached database won't be the same as the newly created logins you'll need to resolve this using the sp_change_users_login stored procedure. The database user's are in effect orphaned.
For example if you have:
SQL Login: bob Attached database user: bob
Open a new query in SQL Management Studio for the attached database then run:
sp_change_users_login #action='report'
If you have "orphaned" users in your database then you'll see a result set that looks like:
UserName UserSID
bob 0x57F6DFA5D5D7374A97769856E7CB5610
To reconnect this user to a SQL login execute:
sp_change_users_login #action='update_one',
#loginname='bob',
#usernamepattern='bob'
I think you're confusing a database user with a server login.
Your database may have a user in it called NotificationUser but this needs to be associated with a server login, which is the object you're trying to alter with the script. A database restore from a different server won't have created this server login so there's a good chance it doesn't exist on your server. More info here