stsadm restore: No content databases are available for this operation but the site collection is scheduled for deletion in at least one content database.

One of my coworker asked me to rename a site url from http://portal/sites/a to http://portal/sites/b in our SharePoint Server 2010 farm because the customer doesn’t like this url.

Sounds pretty easy, right? I thought so, too.  I did the following:

1. In Central Admin, removed the site collection http://portal/sites/a

2. Logged in with farm account, run the following command in console:

stsadm -o backup -url http://portal/sites/a -filename a.bak

Everything is cool, the backup went very smooth.

3. I run another command to create the new site by restore the restore file from step 2.

stsadm -o restore -url http://portal/sites/b -filename a.bak

And i got this:

No content databases are available for this operation but the site collection is scheduled for deletion in at least one content database.  Either wait for the deletion operation to complete or create a content database, and then try the operation again. To create a content database, click “Content databases” on the Application Management page, select the Web application to use, and then click “Add a content database”.

I tried using PowerShell Commandlet.

Restore-SPSite -Identity http://portal/sites/b -path “D:\a.bak”

Similar error as above plus this:

+ CategoryInfo          : InvalidData: (Microsoft.Share…dletRestoreSite: SPCmdletRestoreSite) [Restore-SPSite], InvalidOperationException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite

Google around and I found some people are talking about “Restore the same site to an web application twice”. which is not applicable to me because I already removed the original site. I believe the root cause is the same: conflicting Site Guid. Some people suggested manually run the Gradual  Site Delete timer job you will find in your job definition. This job is default to run at 10PM at night. I manually started this job at least 5 times, still getting same error.

Then finally I got this thread from Google results.

Thanks to Tammy and I don’t have to wait for a few days.

Here is what I did:

1. Run the following commandlet:


Verify the /sites/a is in the results. You will see something like this

WebApplicationId : 476605a1-36c3-45da-8bba-e79817d89659
DatabaseId : 810ec826-8f25-412d-9a50-159406659d52
SiteSubscriptionId : 00000000-0000-0000-0000-000000000000
SiteId : 850b481b-e137-4dfb-9569-137a8be1e00f
Path : /sites/a
DeletionTime : 6/12/2012 7:12:32 PM

2. Run the following:


The command will ask you  the identify of the site, which is /sites/a. Then after you press Y to confirm the deletion.

3.  Go back to Central Administration and Re-Run the “Gradual Site Delete” job.

4. Run

stsadm -o restore -url http://portal/sites/b -filename a.bak

No error this time, instead, it says “Operation Completed Successfully”.

5. All set.

Read More