
Hi @sns ,
You could first use the Test-SPContentDatabase command to check if there exsit orphan sites.
Test-SPContentDatabase -name WSS_Content_DB -webapplication https://sitename
Similar posts for your reference:
Find Orphan Sites Under Specific Content Database - Sharepoint 2013 Powershell
Delete orphan site collection
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.