Trying to take remote backup of sql server database using Perl. But somehow getting following error :
Backup Error: 3041, Severity: 16, State: 1.
BACKUP failed to complete the command BACKUP DATABASE testdb. Check the backup application log for detailed messages.
The scripts looks like :
use DBI;
my $dsn = 'DBI:ODBC:Driver={SQL Server}';
my $host = 'hostname';
my $database = 'dbname';
my $user = 'sa';
my $auth = 'xxxxxxx';
my $dbh = DBI->connect("$dsn;Server=$host",
$user,
$auth,
{ RaiseError => 1,
AutoCommit => 1}
) || die "Database connection not made: $DBI::errstr";
my $sql = "BACKUP DATABASE testdb TO DISK='d:\sql_share\backup.bak'";
my $sth = $dbh->prepare( $sql );
$sth->execute();
print "\nexecuted";
$sth->finish();
$dbh->disconnect();
using the same script able to create database, query database etc. on remote server.
\in double quotes has a meaning. Escape the backslashes.