
Practical guide to Oracle Virtual environments Nelson Calero DOAG – November 2018 Today’s topics • Virtual environments review – Docker – Oracle VirtualBox – Oracle VM – Oracle Cloud • Automation – Vagrant Motivation – Ansible Explore alternatives to create – Terraform database environments • Examples – VirtualBox VMs using Vagrant/Ansible – Docker on Windows Intended audience – RAC using VirtualBox and Docker DBAs and Developers – Terraform for Oracle Cloud instances 2 © 2018 Pythian About me • Database Consultant at Pythian since 2014 • Working with Oracle tools and Linux environments since 1996 • DBA Oracle (2001) & MySQL (2005) • Co-founder and President of the Oracle user Group of Uruguay (2009) • LAOUC Director of events (2013) • Computer Engineer (1998) • Oracle ACE (2014), Oracle ACE Director (2017) • Oracle Certified Professional 10g/11g/12c, OCE, Cloud DB & Infra • Amazon Solutions Architect – Associate (2016) • Google Cloud Architect (2017), Google Cloud Data Engineer (2017) • Oracle University Instructor (2011) • Blogger and speaker: Oracle Open World, Collaborate, OTN Tour, Regional conferences http://www.linkedin.com/in/ncalero @ncalerouy 3 © 2018 Pythian 500+ Technical Experts Helping Peers Globally 3 Membership Tiers Connect: • Oracle ACE Director [email protected] • Oracle ACE bit.ly/OracleACEProgram • Oracle ACE Associate Facebook.com/oracleaces @oracleace Nominate yourself or someone you know: acenomination.oracle.com Introduction to Virtual environments Sharing server resources isolating processes KVM, Oracle VM, VirtualBox, … LXC, WPAR, Docker, … 7 https://docs.docker.com/get-started/ Introduction to Virtual environments • Hypervisors (Server virtualization) – Type 1: run directly in host’s hardware • Xen, Oracle VM, Hyper-V, Vmware ESX, KVM, … – Type 2: run on a OS (host) • VMware Workstation, VirtualBox, QEMU, … • Containers (OS virtualization) – Share OS kernel and libraries – Solaris Zones (2004), LXC (2008), Docker (2013) – MOS 2216342.1 Oracle Support for Database Running on Docker Supported SI on Oracle Linux 7 with UEK4 (and later) or RHEL7 8 © 2018 Pythian Not only server virtualization • Data virtualization – Delphix, … • Storage snapshots (vendor based) – SMO, NetAPP, Oracle ACFS, .. – gDBClone – clone Oracle databases using ACFS snapshots http://www.oracle.com/technetwork/indexes/samplecode/gdbclone-download-2295388.html • Cloud provisioning – Compute instances – managed hypervisor – Bare Metal – bring your own hypervisor (only on OCI, not classic) – Containers – as managed services or DIY in BM 9 © 2018 Pythian Today’s focus: VMs and containers 10 © 2018 Pythian Containers with Docker • Creates process with access to same OS binaries and resources from the host, executing programs in isolation as if they were inside a VM • Runs on any OS - Download latest binary from https://www.docker.com - On Windows it creates a VirtualBox VM to execute containers inside it VM needs CPU, disk and RAM adjustments to be useful • Commands: - docker-machine: manage machines running Docker (Windows/Mac before v1.12) - docker o build: Build an image from a Dockerfile o run: Run a command in a new container o exec: Run a command in a running container 11 © 2018 Pythian Docker – command line Windows – control VM status D:\>docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default - virtualbox Running tcp://192.168.99.100:2376 v18.01.0-ce Commands: D:\>docker attach Attach local standard input, output, and error streams to a running contain build Build an image from a Dockerfile Management Commands: commit Create a new image from a container's changes checkpoint Manage checkpoints cp Copy files/folders between a container and the local filesystem config Manage Docker configs create Create a new container container Manage containers deploy Deploy a new stack or update an existing stack diff Inspect changes to files or directories on a container's filesystem image Manage images events Get real time events from the server network Manage networks exec Run a command in a running container node Manage Swarm nodes export Export a container's filesystem as a tar archive plugin Manage plugins history Show the history of an image images List images secret Manage Docker secrets import Import the contents from a tarball to create a filesystem image service Manage services info Display system-wide information stack Manage Docker stacks inspect Return low-level information on Docker objects swarm Manage Swarm kill Kill one or more running containers load Load an image from a tar archive or STDIN system Manage Docker login Log in to a Docker registry volume Manage volumes logout Log out from a Docker registry logs Fetch the logs of a container pause Pause all processes within one or more containers port List port mappings or a specific mapping for the container 12 ps List containers ... Docker – configuration Dockerfile – instructions to execute when a container starts FROM oraclelinux:7-Slim # Pull base image … USER Oracle RUN $INSTALL_DIR/$INSTALL_DB_BINARIES_FILE EE … CMD exec $ORACLE_BASE/$RUN_FILE Base image usually are OS images, not including Oracle binaries (license restriction) Exception: Oracle provided images: - Docker Store: https://store.docker.com/images/oracle-database-enterprise-edition - Oracle Container Registry: https://container-registry.oracle.com Useful github repositories: – https://github.com/oracle/docker-images/OracleDatabase - RAC and Single instance – https://github.com/Seth-Miller/12c-rac-docker - pioneer RAC configuration 13 © 2018 Pythian Docker – creating a container Install github repository D:\GitHub>git clone https://github.com/oracle/docker-images.git Cloning into 'docker-images'... remote: Counting objects: 7740, done. remote: Compressing objects: 100% (36/36), done. rRemote: Total 7740 (delta 18), reused 45 (delta 16), pack-reused 7688 Receiving objects: 100% (7740/7740), 9.70 MiB | 870.00 KiB/s, done. Resolving deltas: 100% (4286/4286), done. Checking connectivity... done. Checking out files: 100% (968/968), done. Download Oracle installation files from OTN: • http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html • Copy to directory D:\GitHub\docker-images\OracleDatabase\dockerfiles\12.1.0.2 Create the container (11.2.0.2 XE, 12.1.0.2 / 12.2.0.1 / 18.3.0 EE or SE2 as of November 2018): D:\GitHub\12.1.0.2/…>docker build -t oracle/database:12.1.0.2-ee -f Dockerfile.ee . 14 © 2018 Pythian Docker – creating a container Status D:\>docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE oracle/database 12.1.0.2-ee c175ddb41772 4 minutes ago 10.6GB oraclelinux 7-slim 9870bebfb1d5 2 months ago 118MB Start the container (Windows example): D:\>docker run --name ora121 -p 1521:1521 -p 5500:5500 -e ORACLE_SID=orcl -e ORACLE_PDB=pdb1 -e ORACLE_PWD=Oracle_123 -e ORACLE_CHARACTERSET=AL32UTF8 -v //c/users/calero/.docker/persistentdisk/ora121://opt/oracle/oradata oracle/database:12.1.0.2-ee Status of running containers D:\>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2c1afcad6a50 oracle/database:12.1.0.2-ee "/bin/sh -c 'exec $O…" 11 hours ago Up 11 hours (healthy) 0.0.0.0:1521->1521/tcp, 0.0.0.0:5500->5500/tcp ora121 15 © 2018 Pythian Docker – connecting to Oracle Connect to database running in container – using host Oracle client D:\>docker-machine ip 192.168.99.100 C:\Users\calero>sqlplus system/Oracle_123@\"192.168.99.100:1521/orcl\" SQL*Plus: Release 12.1.0.2.0 Production on Sun Feb 4 01:51:50 2018 ... Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options Using sqlplus binary from container D:\>docker exec -ti 2c1afcad6a50 sqlplus pdbadmin/Oracle_123@pdb1 SQL*Plus: Release 12.1.0.2.0 Production on Sun Feb 4 16:23:47 2018 ... Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options 16 © 2018 Pythian Docker - images from container-registry Register in container-registry.oracle.com Start session D:\>docker login container-registry.oracle.com Username: [email protected] Password: xxx Login Succeeded Download image D:\>docker pull container-registry.oracle.com/database/enterprise:12.2.0.1 12.2.0.1: Pulling from database/enterprise 9bd4d110366e: Downloading [> ] 2.668MB/143MB af8b29651e27: Download complete Step by step guide: http://databaseindex.blogspot.com/2018/04/oracle-12c-docker-windows-ocr.html 17 © 2018 Pythian Example – Oracle DB using Docker Image Check local images D:\>docker images REPOSITORY TAG IMAGE ID CREATED SIZE container-registry.oracle.com/database/enterprise 12.2.0.1 12a359cd0528 5 months ago 3.44GB Define image settings D:\>echo DB_MEMORY=1Gb >ora.conf Start the container D:\>docker run -d -it --name ora122 -P --env-file ora.conf container-registry.oracle.com/database/enterprise:12.2.0.1 5896d37c1cae083c9ab82ec52cf9900a3b22a012b5257c1cb065a6093d7d55c5 Check running containers D:\>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5896d37c1cae container-registry.oracle.com/database/enterprise:12.2.0.1 "/bin/sh -c '/bin/ba…" 24 minutes ago Up 24 minutes (healthy) 0.0.0.0:32769->1521/tcp, 0.0.0.0:32768->5500/tcp ora122 18 Summary – Oracle DB using Docker Using images with preinstalled Oracle binaries - Docker Store - Container registry Step-by-step: http://databaseindex.blogspot.com/2018/04/oracle-12c-docker-windows-ocr.html Using Oracle github repository, must
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages49 Page
-
File Size-