Thursday, February 6, 2014

Easiest Method to Backup up File Geodatabases

If you are looking to backup your file geodatabase entirely, then this is the simplest approach. Create a windows batch file that copies your geodatabase to your target media, (external hard drive, flash, tape) and add it to the scheduled task at midnight.

Here is the windows batch script, copy it and paste it on a new Notepad window and save it as backupgdb.bat. Replace C:\Data\mygeodatabase.gdb path in the code with your original gdb folder, and replace E:\Backup with your target backup location.

The script will automatically append the current date so you don't have to worry about that.


XCOPY "C:\Data\mygeodatabase.gdb" "E:\Backup\mygeodatabase%date:/=%" /D /E /C /R /I /K /Y

Now add the backupgdb.bat to the scheduled task, following are the necessary steps to do so.

  •  From the start menu, type taskschd.msc to open up the Task Scheduler
  •  Click on Create Basic Task and type in the name of the task BackupGDB, click Next.
  • Select Daily, so the task runs on a daily basis. Click Next.
  • Select the time you want this task to run, leave it at midnight and click Next
  • Select Start a Program then click Next this way we let
  • Windows start our Backupgdb.bat program.
  • Browse to your Backupgdb.bat file.
  • Click Finish and you are done.

You can create multiple batch files to backup to different locations using the same approach I guess. So you might have Backupgdb_Flash.bat, Backupgdb_NetworkDrive.bat etc..

This method might not be efficient if you want to backup a particular dataset in your geodatabase, as it will simply copy your entire geodatabase to a different location. If you have only a single dataset which is being constantly updated while rest of datasets are static, you will end up copying unchanged redundant data everyday. To copy a particular dataset only I recommend using Geodatabase Replication with a python script instead.

No comments:

Post a Comment

Share your thoughts

Note: Only a member of this blog may post a comment.