Difference between revisions of "Import PostgreSQL Database Dump File"

From Gejoreuy
Jump to navigation Jump to search
Line 9: Line 9:
  
 
<pre>
 
<pre>
[root@openvpn ~]# psql -U username -h hostname -d desintationdb -p port -f dumpfilename.sql
+
[root@gejoreuy ~]# psql -U username -h hostname -d desintationdb -p port -f dumpfilename.sql
 
</pre>
 
</pre>
  

Revision as of 13:12, 14 October 2019

https://www.compose.com/articles/postgresql-tips-installing-the-postgresql-client/
https://www.alibabacloud.com/help/doc-detail/96785.htm

Purpose

This topic describes how to use the psql command to restore the PostgreSQL data backup files to PostGreSQL DB.

Import the Dump File

[root@gejoreuy ~]# psql -U username -h hostname -d desintationdb -p port -f dumpfilename.sql

Note :
username: The username to log on to the ApsaraDB RDS for PostgreSQL database.
hostname: The hostname of the ApsaraDB RDS for PostgreSQL database.
port: The port number of the ApsaraDB RDS for PostgreSQL database.
desintationdb: The ApsaraDB RDS for PostgreSQL database name.
dumpfilename: The name of the backup file to be restored.