Home Dashboard Directory Help
Search

Backup-SqlDatabase: –ServerInstance parameter error by Ana Mihalj


Status: 

Closed
 as By Design Help for as By Design


2
0
Sign in
to vote
Type: Bug
ID: 772895
Opened: 11/30/2012 1:32:39 AM
Access Restriction: Public
1
Workaround(s)
view
0
User(s) can reproduce this bug

Description

On Windows 7 I have installed SQL Server 2008 R2 (default instance - 10.50.2500.0) and SQL Server 2012 (named instance - 10.50.2500.0).

Backup-SqlDatabase with parameter –ServerInstance returns error (for both versions):

Backup-SqlDatabase : Failed to connect to server SQL2008R2\DEFAULT.
At line:1 char:1
+ Backup-SqlDatabase -ServerInstance SQL2008R2\DEFAULT -Database model
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo         : NotSpecified: (:) [Backup-SqlDatabase], ConnectionFailureException
    + FullyQualifiedErrorId : Microsoft.SqlServer.Management.Common.ConnectionFailureException,Microsoft.Sql
Server.Management.PowerShell.BackupSqlDatabaseCommand

Backup-SqlDatabase with parameters -Path works correctly:
Backup-SqlDatabase -Path "SQLSERVER:\SQL\SQL2008R2\DEFAULT" -Database model

This also works correctly:
Set-Location SQLSERVER:\SQL\SQL2008R2\DEFAULT\DATABASES
Backup-SqlDatabase -Database model
Details
Sign in to post a comment.
Posted by Microsoft on 10/11/2013 at 7:29 AM
Let us know if this approach worked for you

Thanks
Sethu srinivasan [MSFT]
SQL Server
Posted by Ana Mihalj on 12/3/2012 at 11:54 PM
Thank you Sethu.
Posted by Sethu Srinivasan on 12/3/2012 at 10:08 AM
To connect to default instance, you don't need to specify "DEFAULT" in ServerInstance parameter

Following example backs up model database on default instance on local machine

backup-sqldatabase -serverinstance $ENV:ComputerName -Database model

Thanks
Sethu Srinivasan [MSFT]
SQL Server
Sign in to post a workaround.
Posted by Sethu Srinivasan on 12/3/2012 at 10:08 AM
To connect to default instance, you don't need to specify "DEFAULT" in ServerInstance parameter

Following example backs up model database on default instance on local machine

backup-sqldatabase -serverinstance $ENV:ComputerName -Database model

Thanks
Sethu Srinivasan [MSFT]
SQL Server