Migration

Migrating into a pgEdge Cloud Database

The following steps provide a simple way to move an existing PostgreSQL database object to a pgEdge Cloud database:

  • Create the target database in pgEdge Cloud.

  • You must ensure that the object owner exists in the target database. If necessary, connect to the pgEdge 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 public schema on the source database, log in to the target database and drop the public schema. For example:

    DROP SCHEMA 'public' CASCADE

  • Run pg_dump against the source database, including the -Fp flag 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 pgEdge Cloud database; simply append < path_to_file/target_filename to the PSQL connection string displayed in your pgEdge Cloud console and press Return.

For more details, see Taking a Backup and Restoring a Backup.