]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/cats/make_postgresql_catalog_backup.cmd
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / win32 / cats / make_postgresql_catalog_backup.cmd
1 @ECHO off\r
2 REM \r
3 REM  This script dumps your Bacula catalog in ASCII format\r
4 REM  It works for MySQL, SQLite, and PostgreSQL\r
5 REM \r
6 REM   %1 is the name of the database to be backed up and the name\r
7 REM      of the output file (default = bacula\r
8 REM   %2 is the user name with which to access the database\r
9 REM      (default = bacula).\r
10 REM   %3 is the password with which to access the database or "" if no password\r
11 REM      (default "")\r
12 REM \r
13 REM \r
14 @ECHO on\r
15 \r
16 DEL /f "@working_dir_cmd@\%1.sql" 2>nul\r
17 \r
18 SET PGPASSWORD=\r
19 \r
20 IF NOT "%3"=="" SET PGPASSWORD=--password=%3\r
21 "@SQL_BINDIR@\pg_dump" -c -U %2 %1 >"@working_dir_cmd@\%1.sql"\r
22 \r
23 @ECHO off\r
24 REM \r
25 REM   To read back a MySQL database use: \r
26 REM      cd @working_dir_cmd@\r
27 REM      rd /s /q @SQL_BINDIR@\..\data\bacula\r
28 REM      mysql < bacula.sql\r
29 REM \r
30 REM   To read back a SQLite database use:\r
31 REM      cd @working_dir_cmd@\r
32 REM      del /f bacula.db\r
33 REM      sqlite bacula.db < bacula.sql\r
34 REM \r
35 REM   To read back a PostgreSQL database use:\r
36 REM      cd @working_dir_cmd@\r
37 REM      dropdb bacula\r
38 REM      createdb -T template0 -E SQL_ASCII bacula\r
39 REM      psql bacula < bacula.sql\r
40 REM \r
41 EXIT /b 0\r