troubleshooting Question

Problems emptying SharePoint 2010 recycle bin

Avatar of MisUszatek
MisUszatekFlag for United States of America asked on
Microsoft SharePoint
9 Comments1 Solution1740 ViewsLast Modified:
I deleted a bunch of sites from my test site collection on SharePoint 2010. I need to empty all possible stages of the recycle bin to make the database as small as possible. I am currently stuck with one large site sitting in the Site Collection Recycle Bin > Deleted from end user Recycle Bin. The size of this site is about 30GB.

When I am using the UI and try to delete this site it is unresponsive for a while but when it comes back the site is still there. Then I found this Powershell script:

$WebApp=get-spwebapplication "http://mytestserver/"
    foreach ($SPSite in $webApp.Sites)
         #get the collection of webs
      foreach($SPWeb in $SPSite.AllWebs)
             #Empty the 1st Stage Recycle bin items PERMENANTLY
             #Send the 1st Stage Recycle bin items to 2nd Stage
              write-host "End-User Recycle Bin Items Deleted for:"
              write-host $SPWeb.title ":" $SPWeb.URL "`n"
             #Empty SharePoint site collection recycle bin (2nd Stage Recycle bin) or Admin Recycle bin
  write-host "Administrator Recycle bin Items Deleted for:" $SPSite.RootWeb.title "`n"

When I run it it gives me the following error:

Exception calling "DeleteAll" with "0" argument(s): "The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun you
r statement when there are fewer active users. Ask the database administrator to check the lock and memory configuration for this instance, or to check f
or long-running transactions."
At line:18 char:42
+              $SPSite.RecycleBin.DeleteAll <<<< ();
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Not sure what to do with it. Any other ideas how to empty that recycle bin?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros