October 31, 2008

return of the clones: oracle and zfs

1. Create a zpool.


zpool create orapool mirror c1t1d0 c1t2d0


2. Create the zfs file system and create a link to the filesystem (optional but useful)


zfs create orapool/oradata

chown -R oracle:dba /orapool/oradata

zfs create orapool/oradata/testdb1

chown –R oracle:dba /orapool/oradata/testdb1

ln -s /orapool/oradata /oradata


3. After creating the first oracle database with all datafiles and controlfiles in this file system, shut down the database. Remember to generate the sql file for control file recreation.


4. Take the first snapshot of the database. You can start the database back.


zfs snapshot orapool/oradata/testdb1@first


5. Clone the database to and create an additional one called testdb2


zfs clone orapool/oradata/testdb1@first orapool/oradata/testdb2


6. Duplicate the admin folder and edit the int.ora file. Add an entry in oratab.


cp –r testdb1 testdb2


7. Perform an oraenv to set the environment to the new database. Proceed as ususal with the startup nomount pfile=xxxx and call the create control file sql file that was generated.

Now for the real surprise! When you list the file system it’s observed that only the changed blocks are added to the new file system. That’s a whoppingly huge saving of disk space!!!