Postgre Tools and Commands
Adding another PG server on same machine with another port:
Create second data directory, copy into it postgres.conf, change port into it
Run: pg_ctl register -N %PG_SERVICE_NAME% -D %PG_DATADIR% -U "NT AUTHORITY\NetworkService"
DB Backup:
Use pg_dump to create the backup file
Import into your local server (use your postgres superuser)
Assign your local dba user to the new database via privileges in PG Admin
Create Postgre server user, assign to DBA role and add it to the db:
"SELECT current_database();" -- to get dbName
CREATE USER ""{newUser}"" WITH PASSWORD '{newPassword}';
GRANT CONNECT ON DATABASE ""{dbName}"" TO ""{newUser}"";
GRANT dba TO ""{newUser}"";
Last updated