I. Using the svn built-in backup function for full backup requires the following two files to be placed in the parent directory of the repository.
1) simplebackup. bat
@ ECHO is backing up version library % 1 ......
@ % Svn_home % \ bin \ svnadmin hotcopy % 1% backup_directory % \ % 2
@ Echo version library % 1 successfully backed up to % 2!
(Note: The content of this file is in these three lines, and no modification is required)
2) backup. bat
Echo off
Rem subversion installation directory
Set svn_home = "F: \ Program Files \ subversion"
Parent directory of all REM versions
Set svn_root = E: \ svnrepository
Rem Backup Directory
Set backup_svn_root = F: \ share \ All (If it is another host in the LAN, \ 192.168.0 can be written after the equal sign. * \ share \ All, but note that the share folder must be set to share, which can be both read and written so that the repository can be written in)
Set backup_directory = % backup_svn_root % \ % Date :~ 0, 10%
If exist % backup_directory % goto checkback
Echo create Backup Directory % backup_directory %> % svn_root %/backup. Log
Mkdir % backup_directory %
Rem verifies whether the directory is a version library. If yes, the name backup is taken out.
For/R % svn_root % I in (.) Do @ if exist "% I \ conf \ svnserve. conf" % svn_root % \ simplebackup. Bat "% ~ Fi "% ~ Ni
Goto end
: Checkback
Echo Backup Directory % backup_directory % already exists. Please clear it.
Goto end
: End
(Note: backup. the bat file only needs to modify the three paths in red based on the actual situation. If the folder name in the path contains spaces, the entire path must be enclosed in double quotation marks, for example, the installation directory of the subversion in the preceding example)
The result of full backup is to generate a folder named by date in the target path (in the above example, under the All folder), which contains various warehouses.
Ii. Incremental Backup
I do not know how to write the Incremental backup script, so I can only use it honestly.
Click Start -- run -- cmd
Enter the binfile in the installation path of the svn server.
Cd f: \ Program Files \ subversion \ bin
Svnadmin dump E: \ svnrepository \ Local -- Revision -- incremental> E: \ zengliang \ add (Note: Do not have spaces between revision and incremental and the two crossbars. This is verified later, the image below is incorrect)
The above command means to incrementally back up the 9th to 13 versions of the local repository to the zengliang folder of the edisk. After running the command, a file named add is generated. Run the command to see
If you want to restore the Incremental Backup back, use the svnadmin load command, for example
Svnadmin load E: \ svnrepository \ Local <E: \ zengliang \ add
The following figure shows how to run the command:
Currently, our company's SVN Database Backup adopts the weekly full backup and daily Incremental backup policy. In this way, if a fault occurs, you can obtain the last full backup file, after that, you can restore the Incremental backup to the backup by version. For full backup, you can set the task plan of the system and run it regularly.