0

I don't know why te following database arrive to this point but this is the situation

In master security you can see the defcon\axadmin user with DAXTest database mapped

But if you go to the database secury the user AXAdmin doesn't exist.

I can't edit any information about mapping of AXadmin user because throw the following error:

Also I can't delete this user in master because when I create again have the same mapping.

And if you check with te following sql:

use master
go
select * from syslogins where name='DEFCON\axadmin'
go 

use daxtest
go
select * from sysusers where name='DEFCON\axadmin'
go

You can see the user in master database but doesn't exist in DAXTest

I try to create in DAXTest

CREATE USER [defcon\axadmin] FOR LOGIN [defcon\axadmin];

The user have another session start name

But if I try to edit

ALTER USER [DEFCON\axadmin] WITH LOGIN=[DEFCON\axadmin]

You can't edit the user because doesn't exist

Error:

1
  • Check that you aren't running a case sensitive collation that would impact your queries for checking. Also, worth checking to see if it shows up SELECT dp.name AS DBUser, sp.name AS LoginName FROM sys.database_principals dp JOIN sys.server_principals sp ON dp.sid = sp.sid
    – Nic
    Dec 5 '17 at 15:45
1

Your login DEFCON\axadmin is sysadmin on the current server.

This means that it cannot be mapped to any database as DEFCON\axadmin user, it's already mapped and it's mapped as dbo in any database.

To see this just impersonate this login and ask for a user in that database:

use DAXTest;
execute as login = 'DEFCON\axadmin';
select user;
-- you'll see 'dbo' here
select select IS_SRVROLEMEMBER('sysadmin');
-- you'll get 1 here
revert;
3
  • yes you are on the right, but what I have to do to solve my problem? I only can use AxAdmin
    – Ferri
    Dec 5 '17 at 16:16
  • What is your problem? This login already has all possible permissions, you should not map it or give any permission, he has no access problem
    – sepupic
    Dec 5 '17 at 16:20
  • yes, you make me see that isn't a access problem
    – Ferri
    Dec 5 '17 at 16:33
0

It sounds like you are restoring a database on a server that is different from the server that the original backup was made on. If this is the case, then there will be a ghost login for all of the security accounts that were on the database on the original server. Try the following:

USE [DAXTEST]
EXEC sp_dropuser 'DEFCON\axadmin'
GO

USE [DAXTEST]
create user [DEFCON\axadmin] from login [DEFCON\axadmin]
GO

USE [DAXTEST]
exec sp_addrolemember 'db_owner',[DEFCON\axadmin]
GO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.