You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is to restore to my local test instance of SQL Server 2022.
My login is a sysadmin member and default database is master. The command fails with the error message:
Restore-SqlDatabase : Failed to connect to server localhost.
At line:1 char:1
+ Restore-SqlDatabase -ServerInstance localhost -Database MyDB ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Restore-SqlDatabase], ConnectionFailureException
+ FullyQualifiedErrorId : Microsoft.SqlServer.Management.Common.ConnectionFailureException,Microsoft.SqlServer.Management.PowerShell.RestoreSqlDatabaseCommand
When I trace the connection failure I see the following logged:
message Login failed for user 'mycomputer\localadmin'. Reason: Failed to open the explicitly specified database 'MyDB'. [CLIENT: ]
It appears that the Database parameter is being used by the connection to specify a database and as this database is still in recovery (I restored the Full backup separately) it obviously cannot connect to it.
The text was updated successfully, but these errors were encountered:
This ran successfully which seems to back up the suggestion that the -Database parameter when combined with -ServerInstance may be using the Database parameter to set the connection context.
Using version 22.3.0 of the SqlServer module.
I'm trying to restore from URL using the command:
Restore-SqlDatabase -ServerInstance localhost -Database MyDB -BackupFile 'https://storageaccount.blob.core.windows.net/container/filename' -RestoreAction Log -NoRecovery -TrustServerCertificate
This is to restore to my local test instance of SQL Server 2022.
My login is a sysadmin member and default database is master. The command fails with the error message:
When I trace the connection failure I see the following logged:
message Login failed for user 'mycomputer\localadmin'. Reason: Failed to open the explicitly specified database 'MyDB'. [CLIENT: ]
It appears that the Database parameter is being used by the connection to specify a database and as this database is still in recovery (I restored the Full backup separately) it obviously cannot connect to it.
The text was updated successfully, but these errors were encountered: