Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ The PostgreSQL database pg_dump command line does not enter a password method     - Oracle partition table data migration, process management automation (Database)

- Source compiler install Nginx (Server)

- cp: omitting directory error solutions under Linux (Linux)

- Hadoop connection failed or stuck processing (Server)

- Nginx configuration support f4v video format player (Server)

- The Concept and Semantics of Java Memory Model (Programming)

- Matters Oracle 11.2 single instance when connecting ASM need to pay attention and deal with the problem (Database)

- Python, and / or (Programming)

- To install PostgreSQL 9.4 (Database)

- ls command: 15 Level Linux interview question (Linux)

- Linux system on a virtual machine to access the Internet (Linux)

- Caffe install under Ubuntu 14.04 64bit (Linux)

- OpenSSH version smooth upgrade method (Linux)

- Oracle multi-user concurrency and transaction processing (Database)

- Servlet life cycle code examples (Programming)

- installation process of Matlab 2012a under Ubuntu 14.04 (Linux)

- CentOS NAT iptables (Linux)

- RHEL5 establish a local yum source (Linux)

- xCAT error Unable to dispatch hierarchical sub-command to NORESOLUTION: 3001 (Linux)

- C ++ 11 feature: auto keyword (Programming)

 
         
  The PostgreSQL database pg_dump command line does not enter a password method
     
  Add Date : 2018-11-21      
         
         
         
  For backup PostgreSQL database in one of the official manual of the method is to use "SQL Dump" way (Another way is to back up files directly in the file system, you can refer to the official manual).

The basic usage is as follows:

pg_dump dbname> outfile

First, as demonstrated by the command line, pg_dump command is output to a standard output.

Secondly, pg_dump does not affect the course of their work to other database operations (mainly concerned pg_dump will produce read-write lock (read lock, write lock)), but there are exceptions, and that is what needs to use mutex (exclusive lock) operations such as ALTER TABLE.

Due to the operation and maintenance, it usually requires the use of scripts to perform database backup, instead of manually every day execute the command line and enter the password backup, specifically checked the documents, according to the documentation "31.15. The Password File" section, you can build a profile in the user directory, the password is written in advance in the configuration file, the format of the configuration file is as follows:

hostname: port: database: username: password

Under this document on the need to perform pg_dump command user directory, save as .pgpass file and that the permissions of 600, otherwise PostgreSQL will report

WARNING: password file "/root/.pgpass" has group or world access; permissions should be u = rw (0600) or less

Note: If the database table structure PostgreSQL database (database schema) dependent on OIDs (such as foreign keys), then pg_dump need to add the -o option.

Export PostgreSQL database speed is quite fast, exporting more than 30,000 lines of less than 1s.

Export PostgreSQL database command line examples:

pg_dump -U confluence -d confluence -h 127.0.0.1 -o> /tmp/tmp_confluence_postgresql.sql

among them,

-U That the implementation of user

-d represents the database

-h host indicates

-o expressed support OLDs

NOTE: If you do not use .pgpass files, you can add -W option on the command line, which means a password before performing.

Appendix: PostgreSQL database for some of the basic operation and maintenance operations

Login PostgreSQL database:

psql -U dbuser -d exampledb -h 127.0.0.1 -p 5432

If you do not want to enter a password, you can do:

psql "host = 127.0.0.1 hostaddr = 127.0.0.1 port = 5432 user = yourloginname password = yoursecret"

List Database:

\ L

Exit database console:

\ Q

tag: PostgreSQL database backup, PostgreSQL command line does not enter a password, the basic operation of the export PostgreSQL database, PostgreSQL database, PostgreSQL operation and maintenance tutorial
     
         
         
         
  More:      
 
- Atlassian Linux Shell Scripting the confluence remote backup methods (Linux)
- CentOS7 install MySQL 5.5 (Database)
- Five strokes to find out the IP address you want to know (Linux)
- CentOS source installation GitLab Chinese Version (Server)
- Ubuntu 15.10 / 14.04 install subtitling software Aegisub (Linux)
- Ordinary users how the Linux system shutdown (Linux)
- How to Install 3.16.7 CKT2 kernel in Ubuntu 14.10, Ubuntu 14.04 and its derivative versions (Linux)
- Zookeeper Rights Management and Quota Management (Server)
- SQL Server memory Misunderstanding (Database)
- redis configuration in detail (English) (Database)
- Ubuntu install perfectly handsome terminal Guake 0.8.1 (Linux)
- Try to use Lets Encrypt (Linux)
- Python3 multi-thread download codes (Programming)
- RHEL6.4 x86_64 build SVN service (Server)
- Using 30 seconds to write a detailed analysis of garbage removal system (Linux)
- AngularJS achieve picture upload feature (Programming)
- Cobbler Add custom YUM source (Linux)
- Oracle 11g principle study Dataguard (Database)
- Construction of Android and iOS apps use Jenkins Automation (Programming)
- LVM management reduces swap partition space to the root partition (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.