Link to home
Create AccountLog in
Avatar of jmsjms
jmsjmsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Sharepoint error occurs when re-attaching a content database moved to another server

I copied over the content database of one of our Sharepoint Foundation 2010 to the new SQL 2012 server.

When I try to re-add the content database I get an error from Sharepoint:

Could not connect to THESQL2012SERVER using integrated security: Cannot connect to database master at SQL server at THESQL2012SERVER . The database might not exist, or the current user does not have permission to connect to it.

I'm using windows authentication and the Sharepoint Network Account that runs the old Content Database on the old server is present on the new server.

When I re-attach and connect the old Content database on the old SQL server it works.  I'm running Sharepoint Foundation with SP1 and Febs cumulative update.
Avatar of Melih SARICA
Melih SARICA
Flag of Türkiye image

When u connect to SQL server via managment tool. can u see the Database on the list ?
Is ur Sharepoint user has appropiate rights on that db..
When u copy a db from a server to another , logins and users could ave some problems. try to clean all users in the database and re-map ur logins to that database..
Avatar of jmsjms

ASKER

>When u connect to SQL server via managment tool. can u see the Database on the list ?

Yes

>Is ur Sharepoint user has appropiate rights on that db..

THe Sharepoint User has a default schema of the same name and is a memeber of the  db_Owner role.  

>When u copy a db from a server to another , logins and users could ave some problems. try to clean all users in the database and re-map ur logins to that database..

I've tried that.  The only users are the SPuser, DBO, guest, information_schema and sys.  I tried deleting the SPuser and zapping the login from the main SQL server security folder and redoing it.

I'm not sure how else to test that the SPUser has access as I cant connect to the database using SQLManager as it's a windows authenticated account not a SQL account.
Follow this to check for orphaned users:
http://msdn.microsoft.com/en-gb/library/ms175475.aspx
Avatar of jmsjms

ASKER

Yep did that the last time I tried.

That time the SPUSER was already in the main security section when I attached a copy of the content database.

It came back with no results.
ASKER CERTIFIED SOLUTION
Avatar of colly92002
colly92002
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of codedetox
codedetox

Make sure the application pool account has access to the database. Initially make them db owner and test to see if SharePoint will allow you to re-attach the database. Check the application pool account in IIS.
Avatar of jmsjms

ASKER

I zapped the spuser from the database and set it up again and it still didnt work.

I used the SA SQL account and it worked fine.

I looked again and the DBO account of the database had a login name of DOMAIN\sharepointDatabaseUser.

I didnt notice this SP account was in the database as it didnt show unless you looked at the details of the DBO account.  So I assumed that the SPUSER account that was specifically listed in Security/Users was the one SP was using.

I then added DOMAIN\sharepointDatabaseUser to the Main Security\Logins list and gave it rights, tried connected the Content DB and it worked.

I think I need to check the rights required to ensure that things are tightened down but thats another question.

Many thanks for this !

Cheers
John
That was what i ask u to do .. did u realise that  ?