Migrating into a Distributed Database
The following steps provide a simple way to move an existing PostgreSQL database object to a pgEdge Distributed PostgreSQL (Cloud Edition) database:
-
Create the target database in Cloud.
-
You must ensure that the object owner exists in the target database. If necessary, connect to the Cloud database with psql or pgAdmin and create the owner (opens in a new tab) of the object. The following simple syntax creates a PostgreSQL role with login privileges:
CREATE ROLE role_name LOGIN PASSWORD 'safe_password' -
If the object is in the
publicschema on the source database, log in to the target database and drop thepublicschema. For example:DROP SCHEMA 'public' CASCADE -
Run pg_dump against the source database, including the
-Fpflag to generate a plain-text file that recreates the object being moved with SQL commands. Include the appropriate pg_dump flags (opens in a new tab) to identify the objects that are being included and excluded from the dump file. For example:pg_dump -Fp -h domain_name -U user_name -d database_name -n schema_name > path_to_file/target_filename -
Use psql to replay the script into your Cloud database; simply append
< path_to_file/target_filenameto thePSQLconnection string displayed in your Cloud console and pressReturn.
For more details, see Taking a Backup and Restoring a Backup.