$log_backup_file = "C:\Backups\TestDB_Log_Backup.bak";
$sql = "BACKUP LOG TestDB TO DISK = '".$log_backup_file."'";
$stmt = sqlsrv_query($conn, $sql);
if($stmt === false)
{
die(print_r(sqlsrv_errors()));
}
else
{
echo "Transaction log backed up to $log_backup_file";
}
MySQL:
$backup_file = "EDC_".date("Ymd_His").".sql";
$commands = array(
"mysqldump --opt -h $host_name -u $user_name -p$password -v $database > $backup_file","bzip2 $backup_file"
);
// ejecución y salida de éxito o errores
foreach ( $commands as $command ) {
system($command,$output);
echo $output;
}
No hay comentarios:
Publicar un comentario