top of page

Refreshing a schema from an Oracle Cloud Infrastructure (OCI) (ADW) production to (UAT) environment

Refreshing a schema from an Oracle Cloud Infrastructure (OCI) Autonomous Data Warehouse (ADW) production environment to a User Acceptance Testing (UAT) environment involves several steps. Below, I'll outline a step-by-step process to achieve this, including using the OCI command line and SQL commands for Oracle databases. This guide assumes that you have the necessary OCI permissions and access to both the ADW production and UAT databases.


Step 1: Pre-Check in Production Environment


Verify Database Health:

  • Check the production database’s health to ensure there are no issues before starting the export. Use SQL commands or OCI console tools.

  • Example SQL command to check database status: SELECT status FROM v$instance;


Validate Schema Objects:

  • Confirm that all necessary schema objects are present and accounted for.

  • Example SQL command to list schema objects: SELECT object_name, object_type FROM all_objects WHERE owner = 'PROD_SCHEMA';

Estimate Data Volume:

  • Estimate the volume of data to be exported to ensure adequate storage space in the UAT environment.

  • Example SQL command to estimate table sizes: SELECT segment_name, SUM(bytes)/1024/1024 AS size_in_MB FROM dba_segments WHERE owner='PROD_SCHEMA' GROUP BY segment_name;


Step 2: Export Schema from Production


Use Data Pump for Export:

  • Log in to your OCI environment or use cloud shell/CLI.

  • Execute the Data Pump export command: expdp admin/password@pdb_name DIRECTORY=data_pump_dir DUMPFILE=ProdSchema_%U.dmp LOGFILE=export.log SCHEMAS=PROD_SCHEMA PARALLEL=4


Monitor Export Process:

  • Track the export process via the log file to ensure there are no errors.

  • Use the following SQL to monitor Data Pump jobs: SELECT * FROM dba_datapump_jobs;


Step 3: Transfer Dump File to UAT


Move Exported Data:

  • If necessary, move the Data Pump dump files from the production object storage to the UAT object storage bucket.

  • Use the OCI CLI to copy files between buckets: oci os object copy --bucket-name prod-bucket --destination-bucket uat-bucket --name ProdSchema.dmp


Step 4: Import Schema into UAT


Use Data Pump for Import:

  • Perform the import using the Data Pump import command: impdp admin/password@uat_pdb_name DIRECTORY=data_pump_dir DUMPFILE=ProdSchema_%U.dmp LOGFILE=import.log REMAP_SCHEMA=PROD_SCHEMA:UAT_SCHEMA TABLE_EXISTS_ACTION=REPLACE

Monitor Import Process:

  • Similar to the export, monitor the import process via the log file or SQL. SELECT * FROM dba_datapump_jobs;


Step 5: Post-Check in UAT Environment


Verify Schema Objects:

  • Check that all objects have been successfully imported into the UAT environment.

  • Example SQL command to verify objects: SELECT object_name, object_type FROM all_objects WHERE owner = 'UAT_SCHEMA';

Validate Data Integrity:

  • Run queries to check the integrity of the data.

  • Example data integrity check: SELECT COUNT(*) FROM UAT_SCHEMA.important_table;

Performance Checks:

  • Conduct performance checks to ensure that the UAT environment is performing as expected with the new data.


Step 6: Documentation and Cleanup


  • Document the Process:

  • Record all steps, commands, and outputs for future reference.

  • Clean Up Resources: Remove any temporary files or logs that are no longer needed to conserve storage.

By following these steps, you can effectively refresh a schema from an ADW production environment to a UAT environment, ensuring that the UAT database is updated with the latest data and schema changes from production.

16 views

Recent Posts

See All

Comentarios


AiTech

©2023 by AiTech

bottom of page