To create a new web application which will use an existing content database we need to do the following.
Open Sql Server Management Studio
To take back up of the database in my case it was ‘WSS_Content_fa5cc7a0686e424bbe4fc128b4a48cf4’
Right click the database — select tasks —select Offline—then select Detach.
Get the mdf and ldf file for the database.
Attach the files and create a new database.
Now to Central Administration Site — Application Management — Create a new web application
Let the name of the database as default.
Now go to Content Database within Application Management — Select the web application just created.
Click on the Database Name — Select Database Status as Offline and Check Remove Content database check box.
Now click on Add Content Database— In the Database Name specify the name of the new restored database.
This is the point we can get this error “A SharePoint database named ‘….. ‘already exists. You must supply another name for the new database”
The solution for this is to go to
SharePoint_Config database —There run this query
delete from Objects where name=’name of restored db’;
Bye
RSS - Posts

N,
when i run the query i get :
Msg 547, Level 16, State 0, Line 1
The DELETE statement conflicted with the REFERENCE constraint “FK_Dependencies1_Objects”. The conflict occurred in database “SharePoint_Config”, table “dbo.Dependencies”, column ‘ObjectId’.
The statement has been terminated.
Any ideas.
Mike
By: Mike on September 29, 2008
at 10:04 pm
Thank you!!
hairpoint.. mean sharepoint bugging me with this for hours!
By: Me on May 11, 2009
at 11:13 pm
Well do you think changing the sharepoint database is recommended. I spoke to people at MS and they say any changes to database is not supported by MS.
By: kaajal on May 21, 2009
at 7:55 pm
Hi Kaajal, making changes to the databases are not supported i.e to either it’s structure or values inside it. However if you are just taking backup and restoring the databases it’s absolutely fine !!
By: Nishant Rana on May 22, 2009
at 5:03 am
But then you said we can modify ( delete from objects) the database and remove the orphan entry
By: kaajal on May 23, 2009
at 5:30 am
I am facing the same problem.
Can anyone guide me.
I am unable to create a new webapplication
as it says a sharepoint database say x already exists.
I guess some reference has been on that.
How to remove that any idea.
Thanks
Shafi
By: Anonymous on August 8, 2009
at 9:49 am
This is not a solution…did you actually test this and try it out before posting?
By: Harjeet on October 7, 2009
at 10:12 pm