CHAPTER 26 (Best web hosting) POSTGRESQL ADMINISTRATION The following command
CHAPTER 26 POSTGRESQL ADMINISTRATION The following command connects to a database called customer as the user postgres to a server running on port 5480 and produces a data-only dump that disables triggers on data reload, which is redirected into the file data.sql: pg_dump -U postgres -p 5480 -a –disable-triggers customer > data.sql The last command provides a schema-only dump of the customer table in the company database, excluding the privilege information: pg_dump -t customer –no-privileges -s -f data.sql company As you can see, the pg_dump program is extremely flexible in the output that it can produce. The important thing is to verify your backups and test them by reloading them into development servers before you have a problem. Tip As you may have noticed, we used the file extensions .pgr and .sql for the output files in the preceding examples. While you can actually use any file name and any file extension, we usually recommend using .sql for Plain SQL dumps, and .pgr for custom-formatted dumps that will require pg_restore to reload them. pg_dumpall Although the pg_dump program works very well for backing up a single database, if you have multiple databases installed on a particular cluster, you may want to use the pg_dumpall program. This program works in many of the same ways as pg_dump, with a few differences: pg_dumpall dumps information that is global between databases, such as user and group information, that pg_dump does not back up. All output from pg_dumpall is in plain-text format; it does not support custom or tar archive formats like pg_dump. Due to format limitations, pg_dumpall does not dump large object information. If you have large objects in your database, you need to dump these separately using pg_dump. The pg_dumpall program always dumps output to standard out, so its output must be redirected to a file rather than using a specified file name. Aside from these differences, pg_dumpall works and acts like pg_dump, so if you are familiar with pg_dump, you will understand how to operate pg_dumpall. Tip Remember that pg_dumpall dumps all databases to a single file. If you foresee a need to restore individual databases in a more portable fashion, you may want to stick with using pg_dump for your backup needs.
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.