Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

BACKUP FULL POSTGRESQL COM "PG_DUMPALL"

cls
@echo off
echo "Backup do banco do Adagio-Erato"
  
   for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (
     set dow=%%i
     set month=%%j
     set day=%%k
     set year=%%l
   )
   set datestr=%month%_%day%_%year%
   echo datestr is %datestr%
    
   set BACKUP_FILE=erato_%datestr%.backup
   echo backup file name is %BACKUP_FILE%
   SET PGPASSWORD=5z5w3w1P2hM4
   echo on
   pg_dump -h localhost -p 5433 -U userbkp -F c -b -v -f erato.%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%.backup klios
rem # pause
echo "-- Fim do Backup BD --"

Outro

cls
@echo off
echo "Backup pg_dumpall do Adagio-Erato"
for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (
     set dow=%%i
     set month=%%j
     set day=%%k
     set year=%%l
)
set datestr=%month%_%day%_%year%
echo datestr is %datestr%
set BACKUP_FILE=erato_%datestr%.backup.sql
echo backup file name is %BACKUP_FILE%
SET PGPASSWORD=5z5w3w1P2hM4
echo on
pg_dumpall -g -h localhost -p 5433 -U userbkp -v -f erato_users.backup.sql
pg_dumpall -p 5433 -U userbkp -h localhost -f %BACKUP_FILE%
rem ## pause
echo "-- Fim do Backup BD pg_dumpall --"
  • Renato de O. Lucena
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.