Last active
November 22, 2018 03:19
-
-
Save kevinke/8996dc420030c099f8cdfbb741345dda to your computer and use it in GitHub Desktop.
Revisions
-
kevinke revised this gist
Nov 22, 2018 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,4 +50,8 @@ and restore with this: pg_restore 'pr_pro_db_test.dump' -F c -v -O -d ghl_pr_development -U 'postgres' -h localhost -p 15432 don't need -c and -C if you restore to another database create database with owner createdb -e -O <username> digital -h <host> -p <port> -U <root> -
kevinke renamed this gist
Nov 22, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
kevinke revised this gist
Sep 18, 2018 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,4 +44,10 @@ WHERE -- don't kill the connections to other databases AND datname = 'database_name'; and restore with this: pg_restore 'pr_pro_db_test.dump' -F c -v -O -d ghl_pr_development -U 'postgres' -h localhost -p 15432 don't need -c and -C if you restore to another database -
kevinke revised this gist
Sep 18, 2018 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,18 +30,18 @@ connection related param SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE -- don't kill my own connection! pid <> pg_backend_pid() -- don't kill the connections to other databases AND datname = 'database_name'; -
kevinke revised this gist
Sep 18, 2018 . 1 changed file with 12 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,12 +27,21 @@ connection related param -d: dbname [//]: # kill active session before restore db dump SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE -- don't kill my own connection! pid <> pg_backend_pid() -- don't kill the connections to other databases AND datname = 'database_name'; -
kevinke revised this gist
Sep 17, 2018 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,18 +3,27 @@ pg_dump -F c -v -O -c --if-exists -C -U 'root' -h '139.198.176.101' -p '15432' - dump related param -f [file path]: send output to the specified file -F [format]: c is for custom format -v: verbose -O: (an upcase 'Oscar') do not output commands to set ownership of objects -c: output commands to clean (drop) database objects prior to outputting the commands for creating them --if-exists: se conditional commands (i.e. add an IF EXISTS clause) when cleaning database objects. -C: begin the output with a command to create the database itself and reconnect to the created database. connection related param -h: host -p: port -U: user -d: dbname [//]: # kill active session before restore db dump -
kevinke created this gist
Sep 17, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ pg_dump -F c -v -O -c --if-exists -C -U 'root' -h '139.198.176.101' -p '15432' -d 'qingcloud' -f 'pr_pro_db_test.dump' dump related param -f [file path]: send output to the specified file -F [format]: c is for custom format -v: verbose -O: (an upcase 'Oscar') do not output commands to set ownership of objects -c: output commands to clean (drop) database objects prior to outputting the commands for creating them --if-exists: se conditional commands (i.e. add an IF EXISTS clause) when cleaning database objects. -C: begin the output with a command to create the database itself and reconnect to the created database. connection related param -h: host -p: port -U: user -d: dbname [//]: # kill active session before restore db dump SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE -- don't kill my own connection! pid <> pg_backend_pid() -- don't kill the connections to other databases AND datname = 'database_name';