Search

Backup-SqlDatabase: –ServerInstance parameter error by Ana Mihalj

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)
0
User(s) can reproduce this bug
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 (expand)

Product Language

English

Version

SQL Server 2012 - Developer Edition

Category

Tools (SSMS, Agent, Profiler, Migration, etc.)

Operating System

Windows 7 Enterprise

Operating System Language

English

Steps to Reproduce

Run Powershell with imported SQLPS module.
execute:
Backup-SqlDatabase -ServerInstance SQL2008R2\DEFAULT -Database model

Actual Results

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

Expected Results

backup finished correctly.

Platform

X64

Virtualization

 
File Attachments
0 attachments
Sign in to post a comment.
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