File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and Relational Databases and the fly likes Taking backuop in Every miniute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Taking backuop in Every miniute" Watch "Taking backuop in Every miniute" New topic
Author

Taking backuop in Every miniute

Kasun Wixkramanayake
Ranch Hand

Joined: Feb 09, 2010
Posts: 74
I need To get a MYSql database backup automatically and need to Save it in a Folder in every minute
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

Is your database especially small? If not, backing it up directly can take longer than a minute and may slow down performance. I would suggest a MySQL replication pattern.


[OCA 8 Book] [Blog]
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

Write a simple batch/shell-script that will copy the database file into your required location with timestamp prefixed to the file name. Schedule the batch/shell-script to be executed for the frequency you desire.


S.D. MADHAN
Not many get the right opportunity !
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

That overlooks the issue that running a backup every 1 minute would seriously hurt performance on a database. Scheduling a script to run a backup is fine, but every 1 minute would have serious consequences. This is one of those situations where there is a mismatch between the problem being solved and the proposed solution, namely that keeping a database in sync should not involve spamming backups but instead should rely on a replication pattern.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Taking backuop in Every miniute