When I tried to restore a SharePoint site from backup using restore-spsite, I ended up with below error:
Restore-SPSite: The operation that you are attempting to perform cannot be completed successfully. No content databases in the web application were available to store your site collection. The existing content databases may have reached the maximum number of site collections, or be set to read-only, or be offline, or may already contain a copy of this site collection. Create another content database for the Web application and then try the operation again.
I used Test-SPContentDatabase, content database repair commands and followed many other approaches to find the orphan site, but all said that there is no orphan item in the content database. Later my colleague said he tried to restore the same backup to another site and to same content database he found successful. Later he deleted the site manually from central admin UI. It stuck me that if my friend would have deleted the site manually then I should find the site in the farm recyclebin, where I can use get-spdeletedsite command to view it.
I restored the deleted site using restore-spdeletedsite and removed from the farm completely using remove-spsite command. later I tried restoring the backup to the same content database and everything worked fine.