EDIT zu beheben:Powershell: Backup-SQLDatabase versagt Pfad
Ich fand heraus, dass ich auch die ServerInstance angeben benötigt:
Backup-SqlDatabase -ServerInstance [ServerName] -Database [DBName] -BackupFile "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\Copy.bak"
ORIGINAL POST:
Ich versuche, Sichern Sie eine Datenbank mit dem Cmdlet Backup-Sqldatabase. Dies ist das Skript i zu laufen bin versucht:
Backup-SqlDatabase -Database "LokalUdvikling" -CompressionOption "On" -CopyOnly -Path “C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA" -BackUpFile "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\Copy.bak"
Dies führt zu diesem Fehler:
Backup-SqlDatabase : Failed to resolve the path ‘C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL’ to an object of type 'Microsoft.S
qlServer.Management.Smo.Server'. Either set your location to the proper context, or use the -Path parameter to specify the location.
At line:1 char:1
+ Backup-SqlDatabase
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (C:\Program File...SQLSERVER\MSSQL:String) [Backup-SqlDatabase], SqlPowerShellContextException
+ FullyQualifiedErrorId : ContextError,Microsoft.SqlServer.Management.PowerShell.BackupSqlDatabaseCommand
Der Pfad, in dem die Datenbankdateien befinden. Was mache ich falsch?
Ich hoffe wirklich, dass jemand helfen kann/klären Dinge :)