我想使用Powershell Backup-SqlDatabase
命令备份SQL Server,
问题是我想从远程计算机上执行此操作,并且Backup-SqlDatabase没有IP地址参数。
是否可以使用此命令或任何其他命令远程备份数据库。
我尝试了以下脚本:
$secpasswd = ConvertTo-SecureString "myPass" -AsPlainText -Force;
$mycreds = New-Object System.Management.Automation.PSCredential ("sa", $secpasswd);
Backup-SqlDatabase -ServerInstance "192.168.65.149/sqlserver" -Database "ARM" -Credential $mycreds
其中sqlserver
是数据库的实例,192.168.65.149
是服务器的IP
我遇到以下错误:
Backup-SqlDatabase : Failed to connect to server 192.168.65.149/sqlserver.
At line:1 char:1
+ Backup-SqlDatabase -ServerInstance "192.168.65.149/sqlserver" -Databa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Backup-SqlDatabase], ConnectionFailureException
+ FullyQualifiedErrorId : Microsoft.SqlServer.Management.Common.ConnectionFailureException,Microsoft.SqlServer.Management.PowerShell.BackupSqlDatabaseCommand
谢谢