Restore & Backup using Batch file PostgreSQL


Step 1: Open your IDE (Notepad,Notepad++, Sublime Text)

Backup Code:

@echo off
echo hello backup

REM -h == host, -p == port -u == user 
SET PGPATH="E:\PostgreSQL\9.5\bin\pg_dump.exe"
%PGPATH% -h localhost -p 5432  -U postgres -F t qkbase_db_local > C:\Users\Pukar\Downloads\backupfile\20170331.backup

set /p DUMMY=Press ENTER KEY to EXIT


Step 2: Save File name "batch_file_backup.bat"

Screenshot 




Restore Code:

@echo off
echo hello re-store

REM -h == host, -p == port -u == user 
SET PGPATH="E:\PostgreSQL\9.5\bin\psql.exe" 
%PGPATH% -h localhost -p 5432 -f C:\Users\Pukar\Downloads\backupfile\qkbakup.sql qkbase_db_localv01 postgres 


set /p DUMMY=Press ENTER KEY to EXIT

Screenshot 

Share on Google Plus

About Pukar

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment