I tried to rename the site collection host header (see post here) and it did not work, so I found this blog and thought I could give Backup-SPSite
, Remove-SPSite
and Restore-SPSite
a try. I used this code below, of course changed the values.
Backup-SPSite http://server_name/sites/site_name -Path C:\Backup\site_name.bak
Remove-SPSite –Identity http://server_name/sites/site_name –Confirm:$False
Restore-SPSite http://www.example.com -Path C:\Backup\site_name.bak -HostHeaderWebApplication http://server_name
When I tried to restore it back, it said that it could not open database
Restore-SPSite : Cannot open database "SP_Content_1" requested by the login. The login failed. Login failed for user 'domain\svc_farm'. At line:1 char:1 + Restore-SPSite https://newsite -Path D:\backupsite.bak -HostHeader ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share...dletRestoreSite:SPCmdletRestoreSite) [Restore-SPSite], SqlException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite
The database SP_Content_1
does not exist actually. How is it trying to log in when it does not exist? Therefore, I created a database, gave the user access to the database and tried it again.
Restore-SPSite http://www.example.com -Path C:\Backup\site_name.bak -HostHeaderWebApplication http://server_name
This time I am getting the following error.
Restore-SPSite : Invalid object name 'Sites'. At line:1 char:1 + Restore-SPSite https://sitename.com -Path D:\backupsite.bak -HostHeader ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share...dletRestoreSite:SPCmdletRestoreSite) [Restore-SPSite], SqlException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite
The environment is the same one. I have used the Get-SPDeletedSite
and there are no deleted sites as I cleared them all.
Any idea how should I proceed from here?