How to Build a COW Test Database with Oracle 12c ACFS Snapshots
This guide walks through adding ASM disks, creating an ACFS filesystem, building a RAC database on it, generating read‑only and read‑write snapshots while running DML, and cloning a second database from those snapshots, including optional Data Guard usage for zero‑impact testing.
Background
Customers often hesitate to upgrade Oracle major versions; consultants need to demonstrate benefits such as performance, manageability, new features, and high availability. Oracle 12c enhances ASM, especially ACFS, which can store data files, control files, and log files. Combined with ACFS snapshot (Copy‑On‑Write), a test database can be created quickly and safely.
High‑level Procedure
Add ASM disks to the VM to create an ACFS filesystem.
Create the ACFS filesystem.
Create a database on the ACFS filesystem on node 1.
Run DML on node 1 while generating snapshots.
Use the snapshots to clone a second database on node 2.
Step 1 – Add ASM disks
Three 3 GB VDI disks are created, attached to both RAC nodes, and marked shareable.
VBoxManage createhd --filename asm_acfs_3g_01.vdi --size 3072 --format VDI --variant Fixed VBoxManage createhd --filename asm_acfs_3g_02.vdi --size 3072 --format VDI --variant Fixed VBoxManage createhd --filename asm_acfs_3g_03.vdi --size 3072 --format VDI --variant Fixed VBoxManage storageattach ol6-121-rac1 --storagectl "SATA" --port 5 --device 0 --type hdd --medium asm_acfs_3g_01.vdi --mtype shareable VBoxManage storageattach ol6-121-rac2 --storagectl "SATA" --port 5 --device 0 --type hdd --medium asm_acfs_3g_01.vdi --mtype shareable VBoxManage modifyhd asm_acfs_3g_01.vdi --type shareable fdisk /dev/sdf -> n -> p -> 1 -> 1 -> wStep 2 – Create ACFS filesystem
Create mount point and set ownership.
mkdir -p /mnt/acfs chown oracle:oinstall /mnt/acfsCheck available disks and create diskgroup DG_ACFS.
CREATE DISKGROUP DG_ACFS EXTERNAL REDUNDANCY DISK '/dev/asm_acfs_3g_01' SIZE 3000M, '/dev/asm_acfs_3g_02' SIZE 3000M, '/dev/asm_acfs_3g_03' SIZE 3000M ATTRIBUTE 'compatible.asm'='12.1.0.0.0'; alter diskgroup DG_ACFS set attribute 'compatible.advm'='12.1.0.0.0'; alter diskgroup DG_ACFS add volume VOL1 size 8000M; mkfs -t acfs /dev/asm/vol1-28 acfsutil registry -a /dev/asm/vol1-28 /mnt/acfs mount -t acfs /dev/asm/vol1-28 /mnt/acfsStep 3 – Create database on node 1
Use DBCA to create a database with storage type “file system” and the ACFS mount point. Verify the creation with:
srvctl config database -d acfsdb select file_name from dba_data_files; select name from v$controlfile; select member from v$logfile;Step 4 – Generate snapshots while running DML
Check existing snapshots: acfsutil snap info /mnt/acfs Create a read‑only snapshot: acfsutil snap create asfsdb_snap01 /mnt/acfs Create three read‑write snapshots (use –w flag):
acfsutil snap create -w asfsdb_snap02 /mnt/acfs acfsutil snap create -w asfsdb_snap03 /mnt/acfs acfsutil snap create -w asfsdb_snap04 /mnt/acfsSnapshot info shows names, type (RO/RW), creation time and space usage (e.g., four snapshots using ~2.4 GB).
Step 5 – Clone database on node 2 using a RW snapshot
Copy the pfile from node 1 and modify it to point to the chosen snapshot (e.g., asfsdb_snap04) and set a unique DB name:
*.control_files='/mnt/acfs/.ACFS/snaps/asfsdb_snap04/oradata/acfsdb/control01.ctl','/mnt/acfs/.ACFS/snaps/asfsdb_snap04/oradata/acfsdb/control02.ctl' *.db_unique_name='cowacfs'Start the instance in NOMOUNT, mount the database, then rename datafile, tempfile and controlfile paths to the snapshot locations using generated ALTER DATABASE RENAME FILE statements, for example:
alter database rename file '/mnt/acfs/oradata/acfsdb/sysaux01.dbf' to '/mnt/acfs/.ACFS/snaps/asfsdb_snap04/oradata/acfsdb/sysaux01.dbf';Open the database and verify that data inserted before the snapshot appears after opening the cloned database.
Optional – Use Data Guard for COW testing
Instead of snapshotting the primary, snapshot a Data Guard standby to create a COW test database without impacting production. The architecture consists of a production RAC domain with shared VxFS storage and a disaster‑recovery domain with a single‑node Data Guard standby. Snapshotting the standby leaves the primary untouched while providing a high‑fidelity test environment.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
dbaplus Community
Enterprise-level professional community for Database, BigData, and AIOps. Daily original articles, weekly online tech talks, monthly offline salons, and quarterly XCOPS&DAMS conferences—delivered by industry experts.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
