Snapshot clones using ACFS in 12c

 

woman-64145_640

After reading through some of the 12c manuals this feature stood out as something that could potentially save a huge amount of time and disk space to provision test environments.

Our current environments host multiple copies of the same data (derived from the same source), each copy being 300GB in size and taking several hours to create (using TTS).

From reading the concepts for 12c we can make each environment a PDB and use snapshot clone to very quickly (and without huge amount of disk space). This is my initial blog on setting the architecture up.

Initially the install of grid infrastructure was done on SLES11sp0 which seemed to go OK……. But after a lot of messing around and looking at weird errors from various utilities we realised that SLES11sp0 didn’t work and in fact we had to be on SLES11sp2 as a minimum (mental note here to RTFM before doing installs….)

So now we have 12c grid infrastructure installed and a nice new +ASM instance.

SO first up we create a volume in ASM to be used to host an ACFS filesystem. I was exceptionally lazy and did this in cloud control (never thought I'd see they day where i started giving up CLI….). This worked fine and gave no errors. so far so good….

Next we have to create a database whose files are located on this new ACFS filesystem (now here I’m not sure if the whole CDB has to be on acfs or if just the PDB has to be – i put the whole thing on ACFS but that may not be necessary).

Again i did this using a GUI (DBCA) – first time I’ve used it for about 10 years – surprisingly good.

That all worked fine though it did seem to report it needed a lot more space than it actually did.

OK so now we have a CDB with a seed PDB created all on ACFS filesystem – great! but next comes the interesting part….

First lets create a new PDB as a copy from the seed database:

SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 25 10:25:26 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics
and Real Application Testing options

SQL> CREATE PLUGGABLE DATABASE ENDUR01 ADMIN USER PDBADMIN IDENTIFIED BY password;

Pluggable database created.

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ENDUR01                        MOUNTED
SQL> alter pluggable database endur01 open;

Pluggable database altered.

SQL> alter session set container=ENDUR01;

Session altered.

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/oracle/ASCF/ENDCON/datafile/o1_mf_undotbs1_98st553x_.dbf
/oracle/ASCF/ENDCON/EBFEC8C01ED34958E0430200007F1DB6/datafile/o1_mf_system_9969d
y5p_.dbf

/oracle/ASCF/ENDCON/EBFEC8C01ED34958E0430200007F1DB6/datafile/o1_mf_sysaux_9969d
y5o_.dbf

SQL>

So we’ve created a new database called ENDUR01 and we can see all the files are in the /oracle/ASCF filesystem (sorry about the spelling but too difficult to get the unix team to change it again…)

So now we want to clone this as a snapshot clone – lets see what happens…….

create pluggable database endur02 from endur01 snapshot copy;

ORA-604 signalled during:  create pluggable database endur02 from endur01 snapshot copy...

and

ORA-17517 Database cloning using storage snapshot failed on file :

Not looking good…..

Lets see what’s in the trace file

*** 2013-11-20 17:12:22.543
*** SESSION ID:(299.145) 2013-11-20 17:12:22.543
*** SERVICE NAME:(SYS$USERS) 2013-11-20 17:12:22.543
*** MODULE NAME:(sqlplus@(TNS V1-V3)) 2013-11-20 17:12:22.543
*** ACTION NAME:() 2013-11-20 17:12:22.543
*** CONTAINER ID:(1) 2013-11-20 17:12:22.543

skgfr_clone_volume acfstuil failed 1, 262144
snapshot is not supported because Oracle ADVM low
Cloning an ACFS volume failed for file:/oracle/ASCF/ENDCON/EB9FABB5D83A2241E0430200007F25B5/datafile/o1_mf_system_98sth130_.dbf

Nothing that obvious but the line:

snapshot is not supported because Oracle ADVM low

is interesting

There is loads of free space in the ACFS filesystem but none free in the ASM disk group on which the ACFS is created. I decided to try shrinking acfs a bit to see what happened (again using the GUI – sorry…..)

SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 25 10:53:38 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics
and Real Application Testing options

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ENDUR01                        READ WRITE NO
SQL>
SQL> alter pluggable database endur01 close;

Pluggable database altered.

SQL> alter pluggable database endur01 open read only;

Pluggable database altered.

SQL> create pluggable database endur02 from endur01 snapshot copy;

Pluggable database created.

SQL>

And it worked!

 

Now we just need to open it

 

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ENDUR01                        READ ONLY  NO
         4 ENDUR02                        MOUNTED
SQL> alter pluggable database endur02 open;

Pluggable database altered.

 

And we have out snapshot clone available.

Now need to do a lot more testing to check performance and how much disk space is really used and find any issues out…..


1 comments:

  1. Hi Richard,

    Great post. I ran into the same error message when attempting an ACFS-based snapclone as well. And regardless of how I adjusted storage space it wouldn't go away. I ended up using strace on the parallel process doing the cloning, which was communicating via pipe to the dism background process, which was in turn logging to $CRS_HOME/log/(hostname)/acfs/commands/acfscmds.log. And it told the real story:

    2014-09-22 12:04:37.568: [acfsutil][15404] Start: /sbin/acfsutil.bin snap create -w 039E7E911AFA286CE0530A38A8C0ED02 /acfsmounts/snapclones
    2014-09-22 12:04:37.572: [acfsutil]acfsutil snap create: ACFS-03048: Snapshot operation could not complete.
    2014-09-22 12:04:37.573: [acfsutil]acfsutil snap create: ACFS-03174: The Oracle ASM Dynamic Volume Manager (Oracle ADVM) compatibility attribute for the disk group is less than 11.2.0.3.0.

    So "Oracle ADVM low" can actually mean pretty well any error from the acfsutil snapshot create command.

    Cheers,

    Marc

    ReplyDelete