Automation Of Oracle Database Cloning Using ACFS

Development teams often need access to production data for performance testing. Multiple copies of the database may lead to storage inefficiencies. Using Oracle ACFS with copy-on-write functionality can streamline cloning processes. This approach ensures efficient data management while optimizing storage and adhering to best practices.
oracle database Cloning Diagram acfs - Blue Crystal Solutions
Understanding when to use Oracle Database Cloning via ACFS

Development teams often require access to production data, or at least similar sized data sets to ensure performance issues are discovered and addressed before full deployment.

The process can be complicated by the presence of multiple teams of developers with potentially overlapping data requirements, non-serializable reports, or projects with incompatible data modifications. As result, you may end up with multiple copies of your production database. 

While this may not be an issue, it can leave you with volumes of data in the range of terabytes or petabytes. Even with modern hardware, it may not be cost efficient to have storage dedicated to idle data. Even if space is not an issue, storing large quantities of unnecessary data adds significant time to the cloning process and goes against best practices. 

For environments with these data requirements you could consider using the Oracle ACFS filesystem with copy-on-write (COW) functionalitycreated on top of Oracle ASM volume.   

This approach can be used for cloning directly from production instance or it can be done in a staging manner using Data Guard standby database for enterprise edition or log shipping based replication for standard edition. 

Example Diagram
oracle database Cloning Diagram acfs - Blue Crystal Solutions
oracle database Cloning Diagram acfs

The primary database provides streaming replication for the standby database, which can be used directly as a source for clones. As soon as managed recovery has stopped, you can create a snapshot of ACFS and the clone database will be started from the snapshot version. The standby database can be started in ‘snapshot’ mode whereby it’s available in read/write mode, data can be redacted according to the security requirements into a sanitised data clone and then all subsequent clones are created using this database. After cloning, the standby database is converted back to managed replication mode.

You can have as many cloned instances as required by enabling the copy-on-write functionality. This is because the space required for the clones only amounts to the modified blocks representing the difference between the source and the clones. This usually equates to control files for the new database, redo logs, temporary files, and changes to data. All original data will be kept only in one copy without requirements for additional space.

In the scenario above we are using a standby database with Oracle enterprise edition, however similar logic can be implemented for other configurations. For example, we can implement it for standard edition databases in recovery mode with log shipping.

ACFS also provides remastering functionality which allows a modified clone to be reverted to a previous configuration at the time of snapshot creation. This is very useful with Oracle standard edition databases, where flashback functionality is not available, as an additional mechanism for code deployments or software upgrades.

It should be mentioned that ACFS usage with Oracle databases is covered by Oracle cloud file system licensing. For all non-Oracle database purposes, it must be licensed separately.

What do you need to begin cloning?
  • Oracle grid Infrastructure with ASM including two network interfaces for public and private interconnect even for single node/non-RAC systems. Virtual interfaces can be provided using n2n software if required. Oracle restart can be used instead, with some limitations such as ACFS not being mounted automatically during start up.
  • Available memory to start clone instances.
Steps to consider when automating cloning procedures
  1. If the source database is in managed recovery mode, stop managed recovery mode temporarily, because without stopping it will corrupt the redo files which will not be possible to apply during the recovery stage
  2. If data redaction is required, the standby database should be converted to snapshot mode before implementing the data changes
  3. Create ACFS snapshot
  4. Setup infrastructure for the cloned databases if required (e.g. spfile, password file etc.) to reflect path changes in spfile of the clone
  5. Create control files for clones with the proper location and database name
  6. Recover the clone database to the point of consistency using available redo/standby redo and archive logs
  7. Open clone with ‘resetlogs’ option

An example script for this process can be found at the following GitHub repository.

If you have questions surrounding cloning of Oracle databases, contact us.

Learn More.

Choosing between Postgres vs SQL Server? It all depends on business needs. Postgres SQL offers flexibility and cost savings, while SQL Server provides enterprise-level support within Microsoft ecosystems. Blue Crystal Solutions optimises database choices with setup, 24x7 monitoring, and migration. Learn more about your SQL Server alternatives and Postgres database comparison.

Your SQL Server backups are critical to ensuring business continuity, data protection, and compliance. Reviewing and optimising your backup and restore jobs with an expert team like ours can give you confidence in your data protection strategy, helping your business stay resilient and prepared.

We’re playing a proactive role in enabling Digital Transformation in Public Sector by building a future where technology benefits everyone - with a focus on Digital Identity. In our involvement with the GX5 series, we are part of the solution to making Government Services more efficient, secure, and accessible for all Australians.

Blue Crystal Solutions: your trusted & innovative IT partner.

Australian owned and operated since 2004, we provide information technology services locally, nationally and beyond.

We are a specialised supplier of Cloud, Application, Database & Infrastructure, Operating System Management, Modernisation and Transformation services. With security at the forefront of everything we do, we can also work with your cyber teams to significantly improve your security posture whilst ensuring all your services with us are fortified by our integrated outage protection and 24×7 monitoring tool, BlueDiamond

Scroll to Top