A very common error in sharepoint when you try to restore sitecollection using powershell. Error message is very clear and simple. All you need to do is ask your database administrator, ensure that content database has enough space and rerun the Restore command. But is it this straightforward? Actually, No!! You would not have been reading this blog if it was this simple.
First time when you tried to restore this sitecollection and you got this error, there was indeed insufficient space in content db. But why I am getting the same error even after enough space is allocated to my db? Answer is, “you cannot restore one backup to the same content database more than once”. This is one of the principles one must know before performing any backup and restore operations. But hold on! We could never restore as there was not enough space, then how come we are restoring it more than once? Thats true BUT when your restored failed first time (due to insufficient space) what sharepoint did internally is, it added an orphaned entry of the backup file in content db. Don’t get confused with the error message ‘make suficient free space…..’, its very generic. Now there IS enough free space but its the orphaned entry which is creating a problem.
Now to get rid of it run this powershell command – Open Sharepoint management Powershell and run this
$db = Get-SPDatabase “Content_DB_Name”;
If you are using Sharepoint 2007, you can use this
stsadm -o databaserepair -url -databasename [-deletecorruption]
stsadm -o databaserepair -url https://xyz -databasename WSS_xyz -deletecorruption