CHAPTER 26 POSTGRESQL ADMINISTRATION Table 26-5. pg_restore (Web hosting companies)

CHAPTER 26 POSTGRESQL ADMINISTRATION Table 26-5. pg_restore Options Option Explanation s, –schema-only Restores only the database schema, not any of the data. S, –superuser=username Specifies a superuser to use when disabling triggers. t, –table=table Restores only the specified table. T, –trigger=trigger Restores only the specified trigger. v, –verbose Produces verbose output when restoring. x, –no-privileges, –no-acl Does not emit GRANT/REVOKE commands during restore. –disable-triggers Emits commands to disable triggers during a data-only restore. As you can see, most of the options for pg_restore are similar to those for pg_dump. For clarity, let s take a look at some common pg_restore combinations. The first command restores the archive mydb.tar into the database qa on host dev as user postgres: pg_restore -h dev -U postgres -d qa mydb.tar The next command restores the schema (only) found in the custom-formatted archive file mydb.pgr into a database named test: pg_restore -s -d test -Fc mydb.pgr The final command restores the data (only), disabling triggers as it loads, into the database called test, from the custom-formatted archive file called mydb.pgr: pg_restore -a –disable-triggers -d test -Fc mydb.pgr Upgrading Between Versions PostgreSQL development seems to be moving faster than ever these days. At the time of this writing, PostgreSQL 8.1 was being finalized in an effort to begin testing viable beta releases. This is significant because it s a mere six months after the release of 8.0, which makes 8.1 one of the shortest development cycles yet, for a release that certainly will contain a number of highly anticipated features. Because of this pace of development, you need to be aware of how PostgreSQL releases are designed and, more importantly, what steps you need to take when upgrading between versions. Each PostgreSQL release number contains three sections, corresponding to the major (first section), minor (second section), and revision (third section) releases. Revision releases (for example, upgrading from 8.0.2 to 8.0.3) are the easiest to handle, because the on-disk format for database files is usually guaranteed to remain the same, meaning that upgrading is as simple as stopping your server, installing the binaries from the newer version of PostgreSQL right over top the older version, and then restarting your server. On occasion, there may be some additional steps you need to take (running a SQL statement perhaps), so it is best to
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Leave a Reply