Hello Victoria,

> You need to do it with 2 sessions.
>
> According MySQL manual:
>
> If you are using a Veritas filesystem, you can do:
>
>    1. From a client (or Perl), execute: FLUSH TABLES WITH READ LOCK.
>    2. From another shell, execute: mount vxfs snapshot.
>    3. From the first client, execute: UNLOCK TABLES.
>    4. Copy files from snapshot.
>    5. Unmount snapshot.

Thank you for the answer. My backup script is a Perl script and it
keeps the MySQL connection during the snapshot. Here it is :


#!/usr/bin/perl

use strict;
use DBI;

my $dbh = DBI->connect("dbi:mysql:", "login", "pass", {RaiseError => 1});

print "Flushing database with read lock...\n";
$dbh->do("FLUSH TABLES WITH READ LOCK");

print "Creating snapshot...\n";
system("lvcreate -L 10G -c 256k -s -n backup /dev/vgdata/data");

print "Unlocking database...\n";
$dbh->do("UNLOCK TABLES");

print "Closing MySQL connection...\n";
$dbh->disconnect;

print "Mounting snapshot...\n";
system("mount /backup");

print "Backuping snapshot...\n";
system("cd /backup ; /usr/bin/time tar cvf /dev/st0 *");

print "Snapshot statistics... please check it doesn't get full!\n";
system("lvdisplay /dev/vgdata/backup");

print "Rewinding and ejecting tape...\n";
system("mt -f /dev/st0 eject");

print "Destroying snapshot...\n";
system("umount /backup");
system("lvremove -f /dev/vgdata/backup");

print "Backup successfully done!\n\n";


I check the console output in the mail that cron automatically sends,
and everything is correct (no error message). Is there anything wrong in
this script ?

Regards

Antoine.




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to