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
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

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.

We are continuing to grow and are looking for an Application Support and enhancement team member to join our Adelaide based team.

Blue Crystal Solutions is growing and are looking for an experienced Technical Consultant to join our Adelaide office. We are after a candidate who is willing to work as part of a team to deliver exceptional outcomes for our business and our customers.

In an era where data breaches and security threats loom, the significance of robust database security cannot be overstated. Blue Crystal Solutions, a pioneer in database management and security, has once again demonstrated its unparalleled expertise and commitment to safeguarding digital assets.

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