Google Professional Cloud Database Engineer Question 152
Select 3Google Cloud PlatformYour organization is migrating an on-premises PostgreSQL database to Google Cloud. You need to export the data from the on-premises database and import it into a Cloud SQL PostgreSQL instance with minimal downtime. Which of the following steps will ensure a successful migration?
- A
Use the
pg_dumputility to export the database and thegcloud sql import sqlcommand to import it into the Cloud SQL instance. - B
Export the database using
pg_dumpwith the--data-onlyflag and import it usinggcloud sql import csvto handle large data efficiently. - C
Set up the Cloud SQL instance as a replica of the on-premises PostgreSQL database to migrate data with minimal downtime.
- D
Use Database Migration Service (DMS) for PostgreSQL to perform a continuous migration and cutover with minimal downtime.
- E
Directly copy the PostgreSQL data directory from the on-premises server to the Cloud SQL instance.
Show answer and explanation
Correct answers: A, C, D
Explanation
To ensure a successful migration of a PostgreSQL database to Cloud SQL with minimal downtime, you can use pg_dump for exporting and the gcloud sql import sql command for importing smaller databases. For minimal downtime, advanced solutions like setting up the Cloud SQL instance as a replica or using Database Migration Service (DMS) are recommended. Direct copying of data directories is not supported in Cloud SQL, and gcloud sql import csv is not compatible with pg_dump output.
- A. Correct.
Correct. Using
pg_dumpandgcloud sql import sqlis a valid method for exporting and importing data, though it may result in longer downtime depending on the size of the database. - B. Incorrect.
Incorrect. While
pg_dumpwith the--data-onlyflag can export data,gcloud sql import csvis not suitable for importing the dump file frompg_dump. This method is incompatible. - C. Correct.
Correct. Setting up the Cloud SQL instance as a read replica of the on-premises database allows replication of data with minimal downtime before cutting over.
- D. Correct.
Correct. Database Migration Service (DMS) is specifically designed for minimal downtime migrations and supports continuous data synchronization before the final cutover.
- E. Incorrect.
Incorrect. Directly copying the PostgreSQL data directory is not supported for Cloud SQL because of the differences in the underlying infrastructure and configurations.