Posted by: Nishant Rana | August 26, 2008

“A SharePoint database named ‘….. ‘already exists. You must supply another name for the new database.” – Using Sql Server BackUp and Restore of Content Database.

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 Offlinethen 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


Responses

  1. 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

  2. Thank you!!

    hairpoint.. mean sharepoint bugging me with this for hours!

  3. 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.

  4. 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 !!

  5. But then you said we can modify ( delete from objects) the database and remove the orphan entry

  6. 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

  7. This is not a solution…did you actually test this and try it out before posting?


Leave a response

Your response:

Categories