Solved

Cannot Authenticate User to Database SQL SERVER 2005

Posted on 2008-06-18
9
632 Views
Last Modified: 2013-11-30
Hello Experts,

I have a SQL Sserver 2005 Database that was created on another system... It is authenticating with the sa password.

When I attach the databse to the new SQL Server, My application (accessing the DB with OleDB SQL Native Client) cannot log onto the SQL Server databse.

When I go to sa properties,  and the User Mapping page, I am unable to map to the desired database. If I create a new database I can map to it. This feels like a SID issue.

Does anyone know how to get around this??

Thanks!
0
Comment
Question by:Saxitalis
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 14

Expert Comment

by:rob_farley
ID: 21818546
Actually, it sounds like you might be in Windows Authentication Only mode. Go to the Security page of the Server properties (instance properties of SQL, in SSMS), and make sure that "SQL Server and Windows Authentication mode" is selected.

Hope this helps. :)

Rob
0
 

Author Comment

by:Saxitalis
ID: 21818563
I am definitely in Mixed mode.

Like I mentioned, I can map any user (includingsa) to a new database of the same name but cannot map to this existing datbase.

It feels like something with the old database that is preventing this from happening. Could it be a SID problem??

Thanks
0
 
LVL 14

Expert Comment

by:rob_farley
ID: 21818580
Yeah, ok... could be a SID thing then. Annoyingly, you can't remove 'dbo', which is the user that maps to 'sa'.

Umm.... let me think and get back to you.

Rob
0
 
LVL 14

Expert Comment

by:Jagdish Devaku
ID: 21820642
Hi,

Try the following...

1. Go to the security folder of the <attached database> and delete all the users in that folder.

2. Now restart the sql services

And try to access the database using sa user...

If its still giving error check the roles under security under <attached database> and delete user defined roles in database roles as well as application roles.

and this might work...

let me know if you face any issues...

all the best...
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 14

Expert Comment

by:rob_farley
ID: 21820731
Is your application accessing the system as sa?
0
 
LVL 14

Expert Comment

by:Jagdish Devaku
ID: 21820758
and check compatibility level of the database you attached. if it is not set to 90 then change it to 90 and restart the server.
0
 
LVL 1

Expert Comment

by:storysoft
ID: 21923269
Try this:
--Add the new login.
USE master
go
EXEC sp_addlogin '[login name]','[password]','[default db]'
go

--Change the user account to link with your login.
USE [your database name here]
go
EXEC sp_change_users_login 'Update_One', '[login name]', '[user in db you want to map to]'
0
 
LVL 14

Expert Comment

by:Jagdish Devaku
ID: 21923321
Try the following...

select @@SERVERNAME

If this returns the same instance name you are using, then its OK...

otherwise change the instance to the current instance you are using...

To change the instance name run the following...

USE MASTER
GO
SP_DROPSERVER '<Old_Instance_name>'
GO
USE MASTER
GO
SP_ADDSERVER '<New_Instance_name>', 'LOCAL'
GO
0
 

Accepted Solution

by:
Saxitalis earned 0 total points
ID: 22196234
I think this was a SID issue due to a DB created on one system and copied over to anotner system - thanks for your comments though!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now