MySQL Forums
Forum List  »  MyISAM

Backup MySQL MyISAM databases by copying the physical files
Posted by: Timothy Mifsud
Date: April 01, 2016 08:58AM

Hi, I have a Windows Server 2008 R2 machine and on it I have 2 MySQL MyISAM databases. These databases are quite large as they are over 20GB in combined size.

I update these databases once a week. (I disable my web site in the process - but this is OK for me). I then switch off the MySQL server instance, and copy over the physical folders to another backup folder (datestamped - eg: CB1_17_03_2016) on the same server.

What I noticed lately is, though, that in the backup folders, the individual files (or most of them) - .MYD, .MYI, etc. have a different (older) modified date/time than the files in the actual MySQL data folder. It's like the files were copied WITHOUT the changes just made. I am using the following code in a .bat file to copy the data files:

REM--------------------------------------------------------------------------------------------------------------------------------------------
REM Switch off MySQL service, backup the newly updated folders, and switch on MySQL service again.

SET BackupFolder=C:\Backups\Data

FOR /f "tokens=1-5 delims=/ " %%d in ("%date%") DO SET Folder1=%BackupFolder%\CB1_%%d_%%e_%%f
FOR /f "tokens=1-5 delims=/ " %%d in ("%date%") DO SET Folder2=%BackupFolder%\CB2_%%d_%%e_%%f

SET MySqlFolder=...the folder where the MySQL data files are...
robocopy "%MySqlFolder%\cb1" "%Folder1%"
robocopy "%MySqlFolder%\cb2" "%Folder2%"

cd "%MySQLPath%" (set to MySql.exe location)
NET START MySQL
REM--------------------------------------------------------------------------------------------------------------------------------------------

This copying occurs immediately after updating the tables. Do I need to issue a FLUSH TABLES or something like that before switching off the MySQL instance and copying the files?

Thanks in advance,
Tim

Options: ReplyQuote


Subject
Views
Written By
Posted
Backup MySQL MyISAM databases by copying the physical files
2603
April 01, 2016 08:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.