Using Virtualization to setup Oracle QA/Development Database Environments<br />2/16/11<br />1<br />
Using Virtualization to setup Oracle QA/Development Database Environments<br />Rocky Mountain Training Days<br />Feb. 16, ...
Presentation Agenda<br /><ul><li>Who am I
Describe QA / Development Challenges</li></ul>Pre-Virtual Oracle Environment layout<br />Solaris Zones and ZFS<br />ZFS Co...
Quick Survey<br />How many people are using a form of Virtualization ?<br />16-Feb-2011<br />
Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />16-Feb-2011<br />
Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />Solaris ?<br />16-Feb-2011<br />
Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />Solaris ?<br />Oracle VM ?<br />...
Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />Solaris ?<br />Oracle VM ?<br />...
Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />Solaris ?<br />Oracle VM ?<br />...
Michael J. Gangler (Mike)<br />Database Specialist – Ithaka<br />Working with Oracle, MSSQL, MySQL<br />Working with Oracl...
Ithaka’s mission<br />ITHAKA is a not-for-profit organization dedicated to helping the academic community take full advant...
Ithaka’s Services<br />Ithaka S+R works with initiatives and organizations to develop sustainable business models and cond...
16-Feb-2011<br />
Pre-Virtual Environment<br />16-Feb-2011<br />
Database / Application Specifics<br />Oracle 10.2.0.4<br />SGA – 11 gb<br />Oracle Dataguard / standby used<br />Data is r...
QA / Development Challenges<br />QA requires restoration from Production  - Long export / Import times – (6-8 Hours)<br />...
Pre-Virtual QA Environment<br />16-Feb-2011<br />Qa.jstor.org<br />Data Replication<br />Data Replication<br />Web<br />Ap...
Pre-Virtual QA Steps<br />Export Production database – 2 hours<br />Zip production export – 30 minutes<br />Copy productio...
Virtual Environment<br />Zones & ZFS<br />16-Feb-2011<br />
Solaris Zones<br />16-Feb-2011<br />20<br />
ZFS<br />16-Feb-2011<br />21<br />ZFS is a combined file system and logical volume manager designed by Sun Microsystems. <...
Support for high storage capacities
Integration of the concepts of file system and volume management
Can provide snapshots and copy-on-write clones
Continuous integrity checking and automatic repair
RAID-Z and native NFSv4 ACLs.
ZFS is implemented as open-source software</li></li></ul><li>Solaris ZFS<br />16-Feb-2011<br />22<br />
ZFS Commands Used<br />16-Feb-2011<br />23<br /><ul><li>“zfs snapshot” - performs a copy of the data
“zoneadm” – halts and starts the local zones
“zfs destroy” – removing a clone or zpool
“zfs clone” -  Writeable snapshots ,resulting in two independent file systems that share a set of blocks.
“zfs list” – lists out all the snapshots
“zfs set mountpoint” – allocates an area data to a mountpoint
“zfs set zoned”  - turns on/off the local zones</li></li></ul><li>ZFS Snapshot<br /><ul><li>An advantage of copy-on-write ...
ZFS Snapshot - Example<br />[oracle@aa2vps217]$ su<br />Password: <br /># zfs snapshot tank/zones/aa2vps217-u01@20100701<b...
Virtual Environment<br />Process and setup<br />16-Feb-2011<br />
16-Feb-2011<br />27<br />Virtual QA environment<br /><ul><li>Qa.jstor.org</li></ul>1 physical Machine<br />1 Global Zone<b...
Master
Web
Slave</li></ul>1 physical Machine<br />1 Global Zone<br />3 Zones<br /><ul><li>ff
Upcoming SlideShare
Loading in …5
×

Mgangler Virtualization

466 views

Published on

  • Be the first to comment

  • Be the first to like this

Mgangler Virtualization

  1. 1. Using Virtualization to setup Oracle QA/Development Database Environments<br />2/16/11<br />1<br />
  2. 2. Using Virtualization to setup Oracle QA/Development Database Environments<br />Rocky Mountain Training Days<br />Feb. 16, 2011<br />Mike Gangler – Ithaka / JSTOR<br />
  3. 3. Presentation Agenda<br /><ul><li>Who am I
  4. 4. Describe QA / Development Challenges</li></ul>Pre-Virtual Oracle Environment layout<br />Solaris Zones and ZFS<br />ZFS Commands Used<br />Virtual Oracle Environment layout<br />Steps required – Zones<br />Scripts required<br />Demo if time / Wifi<br />Recap and QA<br />16-Feb-2011<br />3<br />
  5. 5. Quick Survey<br />How many people are using a form of Virtualization ?<br />16-Feb-2011<br />
  6. 6. Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />16-Feb-2011<br />
  7. 7. Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />Solaris ?<br />16-Feb-2011<br />
  8. 8. Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />Solaris ?<br />Oracle VM ?<br />16-Feb-2011<br />
  9. 9. Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />Solaris ?<br />Oracle VM ?<br />Other ?<br />16-Feb-2011<br />
  10. 10. Quick Survey<br />How many people are using a form of Virtualization ?<br />VMWARE ?<br />Solaris ?<br />Oracle VM ?<br />Other ?<br />How many are running oracle instances on these VM machines ?<br />16-Feb-2011<br />
  11. 11. Michael J. Gangler (Mike)<br />Database Specialist – Ithaka<br />Working with Oracle, MSSQL, MySQL<br />Working with Oracle since Oracle Version 5<br />IOUG<br />Executive Vice President – Finance<br />Director of Membership services<br />www.ioug.org<br />April 10 – 14 – Collaborate –Orlando<br />Southeast Michigan Oracle Professionals (SEMOP)<br />Past President and Current Director<br />www.semop.org<br />Michigan Oracle User Summit (MOUS)<br />Database / Tech. director<br />www.mous.us<br />Wednesday November 30th – Schoolcraft College<br />16-Feb-2011<br />
  12. 12. Ithaka’s mission<br />ITHAKA is a not-for-profit organization dedicated to helping the academic community take full advantage of rapidly advancing information and networking technologies. We serve scholars, researchers, and students by providing the content, tools, and services needed to preserve the scholarly record and to advance research and teaching in sustainable ways. We are committed to working in collaboration with other organizations to maximize benefits to our stakeholders.<br />16-Feb-2011<br />11<br />
  13. 13. Ithaka’s Services<br />Ithaka S+R works with initiatives and organizations to develop sustainable business models and conducts research and analysis on the impact of digital media on the academic community as a whole. www.ithaka.org<br />JSTOR helps scholars, researchers, and students discover, use, and build upon a wide range of content in a trusted digital archive of over 1,200 academic journals and other content. JSTOR uses information technology and tools to increase productivity and facilitate new forms of scholarship. www.jstor.org<br />Portico preserves scholarly literature published in electronic form—more than 10,000 e-journals and 28,000 e-books—and ensures that these materials remains accessible to future scholars, researchers, and students. www.portico.org<br />16-Feb-2011<br />12<br />
  14. 14. 16-Feb-2011<br />
  15. 15. Pre-Virtual Environment<br />16-Feb-2011<br />
  16. 16. Database / Application Specifics<br />Oracle 10.2.0.4<br />SGA – 11 gb<br />Oracle Dataguard / standby used<br />Data is replicated via application and Daemons<br />1 schema – 160 – 200 gb<br />Holds only pointers versus actual files<br />Files are stored at each data center<br />Software is a 3rd party application <br />16-Feb-2011<br />15<br />
  17. 17. QA / Development Challenges<br />QA requires restoration from Production - Long export / Import times – (6-8 Hours)<br />QA restore every 1 – 2 weeks.<br />Multi-Data Center requires additional work and headaches<br />Development needs many restores due to changes and testing <br />Application written data replication (Versus Database)<br />16-Feb-2011<br />16<br />
  18. 18. Pre-Virtual QA Environment<br />16-Feb-2011<br />Qa.jstor.org<br />Data Replication<br />Data Replication<br />Web<br />App<br />Master<br />Web App<br />Slave<br />Web App<br />Slave<br />Data<br />Center<br />1<br />Data<br />Center <br />2<br />Data Center<br />3<br />17<br />
  19. 19. Pre-Virtual QA Steps<br />Export Production database – 2 hours<br />Zip production export – 30 minutes<br />Copy production export file to sites<br />Manchester, England – 3 hours<br />Princeton , NJ – 1.5-2 hours<br />Ann Arbor – 1 hour<br />Unzip export file – 30 minutes<br />Import export file – 3 – 5 hours<br />Total Time for all 3 sites (approx) – 10 – 12 hours<br />16-Feb-2011<br />18<br />
  20. 20. Virtual Environment<br />Zones & ZFS<br />16-Feb-2011<br />
  21. 21. Solaris Zones<br />16-Feb-2011<br />20<br />
  22. 22. ZFS<br />16-Feb-2011<br />21<br />ZFS is a combined file system and logical volume manager designed by Sun Microsystems. <br />ZFS includes :<br /><ul><li>data integrity (protection against bit rot, etc.)
  23. 23. Support for high storage capacities
  24. 24. Integration of the concepts of file system and volume management
  25. 25. Can provide snapshots and copy-on-write clones
  26. 26. Continuous integrity checking and automatic repair
  27. 27. RAID-Z and native NFSv4 ACLs.
  28. 28. ZFS is implemented as open-source software</li></li></ul><li>Solaris ZFS<br />16-Feb-2011<br />22<br />
  29. 29. ZFS Commands Used<br />16-Feb-2011<br />23<br /><ul><li>“zfs snapshot” - performs a copy of the data
  30. 30. “zoneadm” – halts and starts the local zones
  31. 31. “zfs destroy” – removing a clone or zpool
  32. 32. “zfs clone” - Writeable snapshots ,resulting in two independent file systems that share a set of blocks.
  33. 33. “zfs list” – lists out all the snapshots
  34. 34. “zfs set mountpoint” – allocates an area data to a mountpoint
  35. 35. “zfs set zoned” - turns on/off the local zones</li></li></ul><li>ZFS Snapshot<br /><ul><li>An advantage of copy-on-write is that when ZFS writes new data, the blocks containing the old data can be retained, allowing a snapshot version of the file system to be maintained. ZFS snapshots are created very quickly, since all the data composing the snapshot is already stored; they are also space efficient, since any unchanged data is shared among the file system and its snapshots.</li></ul>Runs from the Master site<br />Need Root password<br />All oracle processes need to be shutdown<br />User must be in NON- /u01 directory<br />16-Feb-2011<br />24<br />
  36. 36. ZFS Snapshot - Example<br />[oracle@aa2vps217]$ su<br />Password: <br /># zfs snapshot tank/zones/aa2vps217-u01@20100701<br /># zfs list<br />NAME USED AVAIL REFER MOUNTPOINT<br />tank 849G 624G 267K /tank<br />tank/zones 821G 624G 26K /tank/zones<br />tank/zones/aa2vps217-u01 677G 624G 400G /u01<br />tank/zones/aa2vps217-u01@20100602 133G - 162G -<br />tank/zones/aa2vps217-u01@20100701 0G - 447G -<br />16-Feb-2011<br />
  37. 37. Virtual Environment<br />Process and setup<br />16-Feb-2011<br />
  38. 38. 16-Feb-2011<br />27<br />Virtual QA environment<br /><ul><li>Qa.jstor.org</li></ul>1 physical Machine<br />1 Global Zone<br />3 Zones<br />Web<br />Slave<br /><ul><li>Web
  39. 39. Master
  40. 40. Web
  41. 41. Slave</li></ul>1 physical Machine<br />1 Global Zone<br />3 Zones<br /><ul><li>ff
  42. 42. Db
  43. 43. Master
  44. 44. Db
  45. 45. Slave
  46. 46. Db
  47. 47. slave</li></li></ul><li>Virtual QA Steps<br />Export Production database – Not Required – Using Previous nights backup * cron job copies it to master site nightly<br />Zip production export – N/A<br />Unzip Export File – 30 Minutes<br />Import Export File to MASTER ONLY ! - 2 – 3 Hours<br />Run ZFS SNAPSHOT Master Only – 5 Minutes<br />Run ZFS CLONE to slave sites (run from global Zone) - 10 Mins<br />Run script to change database names (Each site) – 5 Minutes<br />Total Time for all 3 sites (approx) – 3 – 4 Hours <br />16-Feb-2011<br />28<br />
  48. 48. ZFS Cloning Process<br />Runs from the Global Zone Site – Must be root user<br />Cloning steps:<br /><ul><li>Halt the zones</li></ul>zoneadm –z <slave> halt<br /><ul><li>Destroy the old u01 directories (slave machines only)</li></ul>zfs destroy –r tank/zones/<slave>-u01<br /><ul><li>Clone the master u01 directory to the slaves</li></ul>Zfs clone tank/zones/<master>-u01@`date +%Y%m%d` tank/zones/<slave1>-u01<br />16-Feb-2011<br />29<br />
  49. 49. ZFS Cloning Process (Con’t)<br /><ul><li>List out Zone copies</li></ul>Zfs list –o name,origin<br /><ul><li>Set the mount points</li></ul>Zfs set mountpoint=/u01 tank/zones/<slave>-u01<br /><ul><li>Set the zone back on</li></ul>Zfs set zoned=on tank/zones/<slave>-u01<br /><ul><li>Reboot the zones</li></ul>Zoneadm –z <slave> boot<br /><ul><li>List out Zone copies – same as above</li></ul>16-Feb-2011<br />30<br />
  50. 50. 16-Feb-2011<br />31<br />ZFS Clone Example<br />Example Clone Script – Page 1<br />#!/usr/bin/env bash<br />export PATH=/usr/local/bin:$PATH<br />host=aa2x4240-04<br />echo =====Must be run as SU======<br />echo =====Cloning omega - 217, 218, 219 ======<br />echo =====listing out the zone copies=======<br />echo zfs list -o name,origin<br />zfs list -o name,origin<br />echo =====halting zones=======<br />zoneadm -z aa2vps218 halt<br />zoneadm -z aa2vps219 halt<br />
  51. 51. 16-Feb-2011<br />32<br />ZFS Clone Example – Page 2<br />Example Clone Script – Page 2 (cont)<br />echo =====destroying old u01 directories======<br />zfs destroy -r tank/zones/aa2vps218-u01<br />zfs destroy -r tank/zones/aa2vps219-u01<br />echo =====cloning snapshots===========<br />zfs clone tank/zones/aa2vps217-u01@`date +%Y%m%d` tank/zones/aa2vps218-u01<br />zfs clone tank/zones/aa2vps217-u01@`date +%Y%m%d` tank/zones/aa2vps219-u01<br />echo =====listing out the new zone copies======<br />echo zfs list -o name,origin<br />zfs list -o name,origin<br />
  52. 52. 16-Feb-2011<br />33<br />ZFS Clone Example – Page 3<br />Example Clone Scripts – Page 3 (cont)<br />echo =====setting the mount points========<br />zfs set mountpoint=/u01 tank/zones/aa2vps218-u01<br />zfs set mountpoint=/u01 tank/zones/aa2vps219-u01<br />echo =====set zoned=on===========<br />zfs set zoned=on tank/zones/aa2vps218-u01<br />zfs set zoned=on tank/zones/aa2vps219-u01<br />echo =====boot machines=======<br />zoneadm -z aa2vps218 boot<br />zoneadm -z aa2vps219 boot<br />echo =====listing out the new zone copies======<br />zfs list -o name,origin<br />
  53. 53. After Clone Script - Slaves<br />NOTE – used if the database name needs to be the same<br />Rename listener.ora, tnsnames.ora with new machine name<br />Clean up Grid Control – <br />Remove entries from sysman/emd directory<br />Change sysman/emd/targets.xml – new machine<br />Change sysman/emd/emd.proprties – new machine name<br />16-Feb-2011<br />34<br />
  54. 54. After Clone Example Script - Slaves<br />NOTE – used if the database name needs to be the same<br />Runs on Slave Sites – as Oracle User<br />Needs to be in $HOME <br />#!/bin/bash <br />### set -xv<br />oldmach=$1<br />newmach=$2<br />for FILE in $ORACLE_HOME/network/admin/*.ora<br />do<br />sed -e 's/'"$oldmach"'/'"$newmach"'/g' $FILE > tmp.out<br />mvtmp.out $FILE<br />done<br />16-Feb-2011<br />35<br />
  55. 55. After Clone Example Script – Slaves – part 2<br />rm -r -f $AGENT_HOME/sysman/emd/core*.*<br />rm -r -f $AGENT_HOME/sysman/emd/state/*<br />rm -r -f $AGENT_HOME/sysman/emd/upload/*<br />rm -r -f $AGENT_HOME/sysman/emd/recv/*<br />rm -r -f $AGENT_HOME/sysman/emd/collection/*<br />rm -r -f $AGENT_HOME/sysman/emd/lastupld.xml<br />rm -r -f $AGENT_HOME/sysman/emd/agntstmp.txt<br />for FILE in $AGENT_HOME/sysman/emd/targets.xml<br />do <br />sed -e 's/'"$oldmach"'/'"$newmach"'/g' $FILE > tmp.out<br />mvtmp.out $FILE<br />Done<br />for FILE in $AGENT_HOME/sysman/config/emd.properties<br />do <br />sed -e 's/'"$oldmach"'/'"$newmach"'/g' $FILE > tmp.out<br />mvtmp.out $FILE<br />done<br />exit 0<br />16-Feb-2011<br />36<br />
  56. 56. 16-Feb-2011<br />37<br />Example Run – ZFS Clone – Page 1<br /># ./clone-presentation.sh<br />=====Must be run as SU======<br />=====Cloning omega - 97, 98, 99 and ======<br />=====halting zones=======<br />zoneadm -z aa2vps98 halt<br />zoneadm -z aa2vps99 halt<br />=====destroying old u01 directories======<br />zfs destroy -r tank/zones/aa2vps98-u01<br />zfs destroy -r tank/zones/aa2vps99-u01<br />=====cloning snapshots===========<br />zfs clone tank/zones/aa2vps97-u01@20101012 tank/zones/aa2vps98-u01<br />zfs clone tank/zones/aa2vps97-u01@20101012 tank/zones/aa2vps99-u01<br />=====setting the mount points========<br />zfs set mountpoint=/u01 tank/zones/aa2vps98-u01<br />zfs set mountpoint=/u01 tank/zones/aa2vps99-u01<br />cannot mount '/u01': directory is not empty<br />property may be set but unable to remount filesystem<br />=====set zoned=on===========<br />zfs set zoned=on tank/zones/aa2vps98-u01<br />zfs set zoned=on tank/zones/aa2vps99-u01<br />=====boot machines=========<br />zoneadm -z aa2vps98 boot<br />zoneadm -z aa2vps99 boot<br />
  57. 57. 16-Feb-2011<br />38<br />Example Run – ZFS Clone – Page 2<br />=====listing out the new zone copies======<br />zfs list -o name,origin<br />NAME ORIGIN<br />tank -<br />tank/snaps -<br />tank/swap1 -<br />tank/zones -<br />tank/zones/aa2vps191 -<br />tank/zones/aa2vps191-u01 -<br />tank/zones/aa2vps247-v01 -<br />tank/zones/aa2vps247-v01@20081106_detached -<br />tank/zones/aa2vps247-v02 -<br />tank/zones/aa2vps247-v02@20081105_detached -<br />tank/zones/aa2vps248-v01 tank/zones/aa2vps247-v01@20081106_detached<br />tank/zones/aa2vps248-v02 tank/zones/aa2vps247-v02@20081105_detached<br />tank/zones/aa2vps249-v01 tank/zones/aa2vps247-v01@20081106_detached<br />tank/zones/aa2vps249-v02 tank/zones/aa2vps247-v02@20081105_detached<br />tank/zones/aa2vps97 tank/zones/aa2vps98@200909131322-migration<br />tank/zones/aa2vps97-u01 -<br />tank/zones/aa2vps97-u01@20101008 -<br />tank/zones/aa2vps98 tank/zones/aa2vps99@200909131307-migration<br />tank/zones/aa2vps98@200909131322-migration -<br />tank/zones/aa2vps98-u01 tank/zones/aa2vps97-u01@20101008<br />tank/zones/aa2vps99 -<br />tank/zones/aa2vps99@200909131307-migration -<br />tank/zones/aa2vps99-u01 tank/zones/aa2vps97-u01@20101008<br /># <br />
  58. 58. 16-Feb-2011<br />39<br />TIPS<br /><ul><li>Keep the zone root, Oracle Binaries and Oracle data on the SAN
  59. 59. Keep the resource management simple – Use dedicated CPU feature in lieu resource pools
  60. 60. To Prevent potential problems in the global zone:
  61. 61. Create a separate file system for each local zone root
  62. 62. Avoid using bock/raw devices in non-global zones
  63. 63. For Greater Isolation of Environments:
  64. 64. Keep the zone root, Oracle Binaries and Oracle data on separate file systems and mounts.
  65. 65. Install Oracle inside each non-global zone rather than sharing binaries from the global zone.</li></li></ul><li>Conclusion<br />16-Feb-2011<br />40<br /><ul><li>Virtualization can reduce down time
  66. 66. Very Efficient with Test and QA databases
  67. 67. I haven’t tried it with Production databases, but we do use it for Production Web Servers
  68. 68. Need to understand all the applications on the local zones
  69. 69. You can clone across local zones and global zones
  70. 70. Concepts can be used with any virtualization software (VMWARE, etc).</li></li></ul><li>Q & A<br />Thank youMichael.Gangler@ithaka.org<br />Feb. 16, 2011<br />41<br />

×