SlideShare a Scribd company logo
Practical guide to Oracle
Virtual environments
ODC Tour Latin America – August 2018
Nelson Calero
Today’s topics • Virtual environments review
– Docker
– Oracle VirtualBox
– Oracle VM
– Oracle Cloud
• Automation
– Vagrant
– Ansible
– Terraform
• Examples
– VirtualBox VMs using Vagrant/Ansible
– Docker on Windows
– RAC using VirtualBox and Docker
– Terraform for Oracle Cloud instances
2 © 2018 Pythian
Motivation
Explore alternatives to create
database environments
Intended audience
DBAs and Developers
• 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
About me
3 © 2018 Pythian
http://www.linkedin.com/in/ncalero @ncalerouy
Pythian overview
© 2015 Pythian Confidential4
• 22 Years of data infrastructure management consulting
• 250+ Top brands
• 11800+ Systems under management
• 400+ employees in 35 countries
• 10 Oracle ACEs, 4 ACED,
3 OakTable members, 2 OCM, 6 Microsoft MVPs,
1 Cloudera Champion of Big Data,
AWS Certified Solutions Architect – 2 Professional, 12 Associate
• Oracle, Microsoft, MySQL, Hadoop, Cassandra, MongoDB, and more
• Infrastructure, Cloud, DevOps, and application expertise
5 © 2018 Pythian
Introduction to Virtual environments
6
KVM, Oracle VM, VirtualBox, … LXC, WPAR, Docker, …
Sharing server resources isolating processes
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
– LXC, Docker
– MOS 2216342.1 Oracle Support for Database Running on Docker
 Supported SI on Oracle Linux 7 with UEK4 (and later) or RHEL7
7 © 2018 Pythian
Not only server virtualization
• Data virtualization
– Delphix, …
• Storage snapshots (vendor based)
– SMO, NetAPP, Oracle ACFS, ..
– gDBClone – clone databases based on 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 new OCI, not classic)
– Containers – as managed services or DIY in BM
8 © 2018 Pythian
Today’s focus: VMs and containers
9 © 2018 Pythian
Containers with Docker
10
• 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
© 2018 Pythian
Docker – command line
Windows – control VM status
11
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
Management Commands:
checkpoint Manage checkpoints
config Manage Docker configs
container Manage containers
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
volume Manage volumes
D:>docker Commands:
attach Attach local standard input, output, and error streams to a running contain
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
deploy Deploy a new stack or update an existing stack
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
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
ps List containers
...
Docker – configuration
12
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
© 2018 Pythian
Docker – creating a container
13
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.
Create the container (11.2.0.2 XE, 12.1.0.2 or 12.2.0.1 EE or SE as of March 2018):
D:GitHub12.1.0.2/…>docker build -t oracle/database:12.1.0.2-ee -f Dockerfile.ee .
Download Oracle installation files from OTN:
• http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
• Copy to directory D:GitHubdocker-imagesOracleDatabasedockerfiles12.1.0.2
© 2018 Pythian
Docker – creating a container
14
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
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
© 2018 Pythian
Docker – connecting to Oracle
15
Using sqlplus binary from container
Connect to database running in container – using host Oracle client
D:>docker-machine ip
192.168.99.100
C:Userscalero>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
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
© 2018 Pythian
Docker - images from container-registry
Register in container-registry.oracle.com
Start session
Download image
Step by step guide:
16
D:>docker login container-registry.oracle.com
Username: nelson.calero@gmail.com
Password: xxx
Login Succeeded
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
http://databaseindex.blogspot.com/2018/04/oracle-12c-docker-windows-ocr.html
© 2018 Pythian
Example – Oracle DB using Docker Image
Check local images
17
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
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 download binaries from OTN
- Step-by-step example on Windows 10:
http://www.oracle.com/technetwork/es/articles/datawarehouse/oracle12c-docker-win10-4485487-esa.html
More examples:
- Standby: https://github.com/jamesattard/oracle-xe-docker
- RAC: https://github.com/Seth-Miller/12c-rac-docker
https://github.com/oracle/docker-images/tree/master/OracleDatabase/RAC
18 © 2018 Pythian
Docker - creating a container
19
Demo
© 2018 Pythian
Hypervisors – Oracle VM (type 1)
• Xen Kernel – UEK R4 as of July 2018 with OVM 3.4.4
• Server needs to boot with it (reinstall needed if other OS was used)
• Minimal resources used by OVM server (1 CPU 2Gg RAM)
• VMs uses free available server’s resources
– can be created from OVS using CLI (xm) or using OVM manager web client
– RAM/CPUs can be allocated dynamically without restarting VMs (up to max config)
– Only supported method to reduce license costs (hard partitioning)
– HA configuration allowed with clustered repositories (using SAN, not with local HDs)
– Windows, Linux and Solaris guests
• OVM Manager
– Needs to be installed in a different server
– Uses MySQL as metadata repository
20 © 2018 Pythian
Oracle VM - examples
21 © 2018 Pythian
[root@ovs ~]# xm list
Name ID Mem VCPUs State Time(s)
0004fb00000600001000d7829bf5a105 4 30723 4 -b---- 2415636.4
0004fb0000060000cf08a173c50efdc1 2 13063 4 r----- 784876.4
Domain-0 0 1958 20 r----- 1211462.2
[root@ovs /OVS/Repositories]# ls -l */VirtualMachines/*/vm.cfg
-rw------- 1 root root 1950 Apr 19 02:37
0004fb00000300005b800c75ea8932be/VirtualMachines/0004fb00000600001000d7829bf5a105/vm.cfg
-rw-r--r-- 1 root root 1946 Apr 19 02:36
0004fb00000300005b800c75ea8932be/VirtualMachines/0004fb0000060000cf08a173c50efdc1/vm.cfg
[root@ovs ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 20
Hypervisor vendor: Xen
Virtualization type: none
[root@ovs ~]# cd
/OVS/Repositories/*/VirtualMachines
[root@ovs VirtualMachines]# grep cpus
0004fb0000060000cf08a173c50efdc1/vm.cfg
maxvcpus = 4
vcpus = 4
cpus = '0-3‘ # '2,3'
Oracle VM Manager console
22 © 2018 Pythian
VirtualBox VMs (type 2)
• Run on any OS (Linux, Windows, Mac)
• Download binaries for your platform
• How to create your Oracle VM?
– a) Download OS ISO+ Oracle binaries
Create VM, boot from ISO, install OS + DB, create DB
– b) Download VM template - all pre(installed/configured)
http://www.oracle.com/technetwork/community/developer-vm/index.html
– c) use tools to automate a)
• Several github repos available (details later)
• Allows to customize your VM and create your own template
23 © 2018 Pythian
Example – Oracle DB using Vbox
© 2015 Pythian Confidential24
25
CLI tools
• VBox: VBoxManage
post creation steps?
• Docker: dockerfile
– ENTRYPOINT – commands to execute when container is run
– CMD – provide default parameters for ENTRYPOINTS or executing an ad-hoc command
26
C:Program FilesOracleVirtualBox> ./VBoxManage list vms
"Oracle DB Developer VM" {6f3d3706-a84d-4163-9bf7-14da26393179}
"oracle-OEL69" {2b835d64-f868-44d8-88e9-9f214dd2fb7d}
"oel68-asm2" {e4d7eb54-2159-4398-a49a-3c2ccfe3cc86}
"oel68-asm1" {bc5e8bc7-3e15-47a1-b81c-2d7bca77b7dd}
"ora12c-si-asm-oel682" {a7318e8a-5b6d-496f-992c-46f84108d345}
"ora12c-si-asm-oel681" {19e74473-bb07-423d-914c-354dc94d6b61}
"default" {fbe05e1e-3c50-4f8f-ba29-6a795a56bdc8}
© 2018 Pythian
Automation tools
Vagrant (from HashiCorp)
- Manage VMs with a standard workflow
- Out of the box with support for VirtualBox,
Hyper-V, and Docker
- Uses CLI (Vbox, Vmware, Docker) to
manage lifecycle
- Handles CLI parameters accordingly with
their different versions
- Automatic ssh setup, etc
- Configuration files, providers, plugins
- Use case: few local VMs
- Runs on any OS – Linux, Windows, Mac
27
Ansible (from RedHat)
• Automation tool using a simple configuration
language
• Agentless, uses OpenSSH and WinRM
• Provisioning, configuration management and
workload orchestration
• Available on Linux and Mac
Terraform (from HashiCorp)
• Build infrastructure, complex sets, local and
remote using simple language
• Runs on any OS
© 2018 Pythian
Vagrant
28
$ vagrant init hashicorp/precise64
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'hashicorp/precise64'...
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Waiting for machine to boot...
$ vagrant ssh
vagrant@precise64:~$ _
Install latest binaries: https://www.vagrantup.com/downloads.html
OS Images
- Called box: used to create your VM.
- Public catalog: https://app.vagrantup.com/boxes/search
- or create your own, or use from any URL
Vagrantfile
- Configuration and provisioning steps
- Ruby syntax
- Created with defaults using init
Simple example: creating a VM based
on precise64 image (Ubuntu 12.04 64-
bit) from their public catalog
© 2018 Pythian
Vagrant
Provisioning: execute steps after it is running
- part of initial up process, or called manually
- Built-in types: Shell, Ansible, Chef, Docker, Puppet, Salt, …
Sample Vagrantfile using a shell provisioner
Providers: virtual machine to manage
- Out of the box for: VirtualBox (default), Docker, Hyper-V
- More can be installed as plugins: Vmware, Custom
29 © 2018 Pythian
Vagrant.configure("2") do |config|
config.vm.provision "shell",
inline: "echo Hello, World"
end
Vagrant - commands
30
D:GitHub>vagrant box list
bento/oracle-6.9 (virtualbox, 201801.02.0)
kikitux/oracle6-racattack (virtualbox, 16.01.01)
oravirt/ol67 (virtualbox, 20170424)
oravirt/ol68 (virtualbox, 20170418)
oravirt/ol72 (virtualbox, 20170425)
D:GitHub>vagrant
Usage: vagrant [options] <command> [<args>]
box manages boxes: installation, removal, etc.
init initializes a new Vagrant environment by creating a Vagrantfile
validate validates the Vagrantfile
up starts and provisions the vagrant environment
provision provisions the vagrant machine
push deploys code in this environment to a configured destination
port displays information about guest port mappings
status outputs status of the vagrant machine
connect connect to a remotely shared Vagrant environment
suspend suspends the machine
resume resume a suspended vagrant machine
halt stops the vagrant machine
destroy stops and deletes all traces of the vagrant machine
reload restarts vagrant machine, loads new Vagrantfile configuration
snapshot manages snapshots: saving, restoring, etc.
ssh connects to machine via SSH
powershell connects to machine via powershell remoting
rdp connects to machine via RDP
Ansible
• Install binaries in a control machine (Windows not supported)
• No agent – uses ssh to connect to remote machines
• Inventory to define machines to use - /etc/ansible/hosts
• Playbook: language used for configuration, deployment, and orchestration
– YAML format
– tags and actions to execute
– conditional control: when, loop, until
– this is the main code to keep under source control
• Modules describing resources and desired state
– Created by us or built-in modules: http://docs.ansible.com/modules_by_category.html
– Can be executed directly or inside playbooks
31 © 2018 Pythian
Ansible playbooks
Sample playbook – playbook.yml
To execute it:
32
- hosts: webservers
remote_user: root
tasks:
- name: ensure apache is at the latest version
yum:
name: httpd
state: latest
- name: write the apache config file
template:
src: /srv/httpd.j2
dest: /etc/httpd.conf
$ ansible-playbook playbook.yml
© 2018 Pythian
Oracle VBox VMs using Vagrant/Ansible (1)
Repository with several configurations: https://github.com/oravirt/
Example for single instance: vagrant-vbox-si-asm
 Customization explained: ${INST_DIR}/README.md
 Code to change:
o vagrant-vbox-si-asmhosts.yml:
o vagrant-vbox-si-asmextra-provisionansible-oraclegroup_vars
 Copy binary files from OTN - ${INST_DIR}vagrant-vbox-si-asmswrepo
33
basename_vm: ora12c-si-asm-oel68
num_vm: 2
base_priv_ip: 172.16.56.30 # (your chosen IP)
oracle_install_version_gi: 12.1.0.2
oracle_version_db: 12.1.0.2
© 2018 Pythian
Oracle VBox VMs using Vagrant/Ansible (2)
To create the VM without installing Oracle:
To install Oracle after the VM is created:
All together:
34
D:GitHubvboxsi2vagrant-vbox-si-asm>vagrant provision
==> oel68-asm1: Running provisioner: ansible_local...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.2.1.0).
…
PLAY [all] *********************************************************************
TASK [setup] *******************************************************************
ok: [oel68-asm1]
TASK [init : Install packages] *************************************************
ok: [oel68-asm1] => (item=[u'ntp', u'dnsmasq'])
…
$ vagrant up
$ setup=true ; vagrant up
© 2018 Pythian
Oracle VBox VMs using Vagrant/Ansible
DEMO time
More step-by-step examples:
- Oracle Standby 12c using vagrant-vbox-si-asm:
http://databaseindex.blogspot.com/2018/02/crear-oracle-standby-12c-usando.html
- Oracle 12c VM on Windows 10 using ubuntu shell (WLS) and ansible:
http://databaseindex.blogspot.com/2018/03/oracle-12c-vagrant-windows-wls-ubuntu.html
35 © 2018 Pythian
Oracle RAC VBox VMs
• Similar approach: https://github.com/racattack/racattack-ansible-oracle
• Implements configuration described in RAC Attack handbook:
https://en.wikibooks.org/wiki/RAC_Attack_-_Oracle_Cluster_Database_at_Home/RAC_Attack_12c
• Customization explained
in project readme (README.md)
on Vagrantfile:
step-by-step example on Windows:
http://databaseindex.blogspot.com/2017/04/automatizar-instalacion-de-oracle-rac.html
36 © 2018 Pythian
#############################
##### BEGIN CUSTOMIZATION #####
#############################
#define number of nodes
num_APPLICATION = 0
num_LEAF_INSTANCES = 0
num_DB_INSTANCES = 1
#define number of cores for guest
num_CORE = 1
#define memory for each type of node in MBytes
memory_APPLICATION = 1500
memory_LEAF_INSTANCES = 2300
memory_DB_INSTANCES = 3072
Oracle RAC with Docker
As pointed earlier: https://github.com/oracle/docker-images/tree/master/OracleDatabase/RAC
Several containers needs to be created:
- OracleConnectionManager: bind single port to host and serve containers on different ports
- OracleRACStorageServer: Oracle ASM on NFS Server for RAC testing
- OracleRealApplicationClusters: RAC instance, minimum two
Several steps for each container.
37 © 2018 Pythian
VMs in Oracle Cloud
• Infrastructure services
– Database Cloud Service (DBCS): all managed, pre-built configurations
– Compute (OCI or OCI-C): install DB manually as in VirtualBox
– Bare Metal and BYOH (OCI): entire server, can install OVM or use as Compute
• Container services
• Automation
– Terraform for OCI and OCI-C
– Orchestration for OCI-C
– REST API
Upcoming example – already in my other session about that topic
38 © 2018 Pythian
Example: OCI Instance using Terraform
• Download Terraform binary (my example uses v0.11.3)
– https://www.terraform.io/downloads.html
• Download Terraform OCI-provider (using v2.1.0)
– https://github.com/oracle/terraform-provider-oci/releases
• Create .tf HCL Project (based on examples):
– https://github.com/oracle/terraform-provider-oci/tree/master/docs/examples
• Configure your account Access (env-vars.ps1)
– Tenancy and user OCIDs, fingerprint, private key, region
• Terraform Plan
• Terraform Apply
• Step by step guide: https://community.oracle.com/docs/DOC-1019936
39 © 2018 Pythian
ncalero@H6RMYZ1:/mnt/d/GitHub/terraform-OCI/$ ls
block.tf compute.tf env-vars.ps1 outputs.tf userdata
datasources.tf network.tf provider.tf remote-exec.tf variables.tf
ncalero@H6RMYZ1:/mnt/d/GitHub/terraform-OCI$ cat /mnt/c/users/calero/AppData/Roaming/terraform.rc
providers { oci = "d:softterraform-provider-oci_v2.1.0.exe" }
40 © 2018 Pythian
PS D:GitHubterraform-OCI> cat ./env-vars.ps1
$env:TF_VAR_tenancy_ocid="ocid1.tenancy.oc1..aaaaaaaaw5hodl4pajmymyo62bwkj4kokziowmjkvj7fvmgt4lqia3yg7km"
$env:TF_VAR_user_ocid="ocid1.user.oc1..aaaaaaaaiyhrscq7rhfiyhrscql4tb3ojto2ysw72l656yknkyqau2lxotqf"
$env:TF_VAR_compartment_ocid="ocid1.compartment.oc1.. aaaaaaaakdevdha7q7yjdheridcy63sgv2syefv7x46u67jk4hj"
$env:TF_VAR_region="us-ashburn-1“
$env:TF_VAR_fingerprint="db:a3:b8:59:ce:05:ff:78:c0:fb:aa:ca:d7:09:77:ad"
$env:TF_VAR_private_key_path="C:Userscalero.ocioci_api_key.pem"
### Public/private keys used on the instances
$env:TF_VAR_ssh_public_key = Get-Content C:Userscalero.sshid_rsa.pub -Raw
$env:TF_VAR_ssh_private_key = Get-Content C:Userscalero.sshid_rsa -Raw
PS D:GitHubterraform-OCI> ./env-vars.ps1
ncalero@H6RMYZ1:/mnt/d/GitHub/terraform-OCI$ cat compute.tf
resource "oci_core_instance" "DemoInstance" {
availability_domain =
"${lookup(data.oci_identity_availability_domains.ADs.availability_domains[0],"name")}"
compartment_id = "${var.compartment_ocid}"
display_name = "Demo-Instance"
image = "${lookup(data.oci_core_images.OLImageOCID.images[0], "id")}"
shape = "${var.InstanceShape}"
subnet_id = "${oci_core_subnet.SN-DemoSubnetAD1.id}"
metadata {
ssh_authorized_keys = "${var.ssh_public_key}"
user_data = "${base64encode(file(var.InstanceBootStrap))}"
}
}
ncalero@H6RMYZ1:/mnt/d/GitHub/terraform-OCI/demo$ cat provider.tf
provider "oci" {
tenancy_ocid = "${var.tenancy_ocid}"
user_ocid = "${var.user_ocid}"
fingerprint = "${var.fingerprint}"
private_key_path = "${var.private_key_path}“
region = "${var.region}"
}
41 © 2018 Pythian
42 © 2018 Pythian
43 © 2018 Pythian
© 2015 Pythian Confidential44
PS D:GitHubterraform-OCI> d:softterraform graph | dot -Tpng -o demo-graph.png
Terraform apply
© 2015 Pythian Confidential45
Summary
Comparing options to create an Oracle instance using dataguard (2 VMs)
Notes:
* host CPU can be shared among VMs but performance will be impacted. Use 1 CPU per VM for prod
** only as described in MOS 2216342.1 - SI on OEL7 with UEK4 or RHEL7 as of July 2018
*** once familiar with the tool and concepts
46
Solution Host OS Disk
space
CPU
min.
License Creation
effort
Production
support
OVM OVM 2xVM+ 1 (*) VM CPUs Medium yes
VirtualBox any 2xVM 1 (*) Entire host Easy (***) no
Docker any 1xVM+ 1 (*) Entire host Easy (***) yes (**)
Cloud any 2xVM 1 (*) VM shape Easiest yes
© 2018 Pythian
References - documentation
• Virtualization concepts: https://en.wikipedia.org/wiki/X86_virtualization
• Docker documentation: https://docs.docker.com/
• Oracle database on Docker – github project: https://github.com/oracle/docker-images
• VirtualBox user guide: https://www.virtualbox.org/manual/ch01.html
• Oracle VM documentation: https://www.oracle.com/technetwork/documentation/vm-096300.html
• Vagrant documentation: https://www.vagrantup.com/intro/index.html
• Ansible user guide: https://docs.ansible.com/ansible/latest/user_guide/index.html
• Terraform documentation: https://www.terraform.io/intro/index.html
47 © 2018 Pythian
THANK YOU
Questions?
48
calero@pythian.com
@ncalerouy
http://www.linkedin.com/in/ncalero
© 2017 Pythian

More Related Content

PDF
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
PDF
Welcome to databases in the Cloud
PDF
Automate the operation of your Oracle Cloud infrastructure v2.0
PDF
Automate your oracle cloud infrastructure operations v2.0 - OOW19
PDF
Oracle Exadata Cloud Services guide from practical experience - OOW19
PDF
Automate your Oracle Cloud Infrastructure operation
PDF
SSL certificates in the Oracle Database without surprises
PDF
Docker Concepts for Oracle/MySQL DBAs and DevOps
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Welcome to databases in the Cloud
Automate the operation of your Oracle Cloud infrastructure v2.0
Automate your oracle cloud infrastructure operations v2.0 - OOW19
Oracle Exadata Cloud Services guide from practical experience - OOW19
Automate your Oracle Cloud Infrastructure operation
SSL certificates in the Oracle Database without surprises
Docker Concepts for Oracle/MySQL DBAs and DevOps

What's hot (20)

PDF
Extreme Replication - RMOUG Presentation
PDF
Oracle Drivers configuration for High Availability
PDF
Moving your Oracle Databases to the Oracle Cloud
PDF
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
PPTX
ECO 2022 - OCI and HashiCorp Terraform
PDF
Oracle virtualbox basic to rac attack
PDF
VMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPS
PDF
20171104 hk-py con-mysql-documentstore_v1
PDF
Heat - keep the clouds up
PDF
Oracle WebLogic 12c New Multitenancy features
PPTX
Oracle GoldenGate 21c New Features and Best Practices
PDF
Monoliths to the cloud!
PDF
Oracle WebLogic Server 12c with Docker
PPTX
Oracle GoldenGate 18c - REST API Examples
PPTX
A Second Look at Oracle RAC 12c
PPTX
Database As A Service: OEM + ODA (OOW 15 Presentation)
PDF
MySQL 5.7: Focus on InnoDB
PDF
Rapid Home Provisioning
PPTX
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
PPTX
OEM12c, DB12c and You! - RMOUG TD2014 Edition
Extreme Replication - RMOUG Presentation
Oracle Drivers configuration for High Availability
Moving your Oracle Databases to the Oracle Cloud
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
ECO 2022 - OCI and HashiCorp Terraform
Oracle virtualbox basic to rac attack
VMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPS
20171104 hk-py con-mysql-documentstore_v1
Heat - keep the clouds up
Oracle WebLogic 12c New Multitenancy features
Oracle GoldenGate 21c New Features and Best Practices
Monoliths to the cloud!
Oracle WebLogic Server 12c with Docker
Oracle GoldenGate 18c - REST API Examples
A Second Look at Oracle RAC 12c
Database As A Service: OEM + ODA (OOW 15 Presentation)
MySQL 5.7: Focus on InnoDB
Rapid Home Provisioning
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
OEM12c, DB12c and You! - RMOUG TD2014 Edition
Ad

Similar to Practical guide to Oracle Virtual environments (20)

PPTX
Docker 101 describing basic docker usage
PPTX
Oracle database on Docker Container
PPTX
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
PPTX
Docker
PPTX
Docker 101 - Nov 2016
PDF
Docker for developers
PDF
Docker containers & the Future of Drupal testing
PPTX
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
PDF
Docker Introduction
PPTX
Accelerate your development with Docker
PDF
Accelerate your software development with Docker
PPTX
Docker 1.11 Presentation
PDF
Introduction to Docker and Monitoring with InfluxData
PPTX
Docker Ecosystem on Azure
PPTX
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
PPTX
Docker and kubernetes
PPTX
Docker DANS workshop
 
PDF
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
PDF
Using Docker to build and test in your laptop and Jenkins
PPTX
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker 101 describing basic docker usage
Oracle database on Docker Container
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker
Docker 101 - Nov 2016
Docker for developers
Docker containers & the Future of Drupal testing
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Docker Introduction
Accelerate your development with Docker
Accelerate your software development with Docker
Docker 1.11 Presentation
Introduction to Docker and Monitoring with InfluxData
Docker Ecosystem on Azure
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
Docker and kubernetes
Docker DANS workshop
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Ad

More from Nelson Calero (20)

PDF
Database automation guide - Oracle Community Tour LATAM 2023
PDF
Terraform Tips and Tricks - LAOUC 2022
PDF
Oracle on kubernetes 101 - Dec/2021
PDF
Redefining tables online without surprises
PPTX
Protect Sensitive Data: Implementing Fine-Grained Access Control in Oracle
PDF
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
PDF
Oracle Exadata Maintenance tasks 101 - OTN Tour 2015
PDF
My Experience Using Oracle SQL Plan Baselines 11g/12c
PDF
Oracle RAC sin sorpresas - v2014
PDF
Alta disponibilidad con Pacemaker
PDF
AROUG BIDAY 2013 - Automatizar procesos de ETL con PL/SQL
PDF
MariaDB y FOSS en infraestructura de salud y estándares
PDF
UYOUG 2012 - Oracle RAC 11gR2 - New features
PDF
Collaborate 2012 - Administering MySQL for Oracle DBAs
PDF
Collaborate 2012 - RMAN Eliminate the mystery
PDF
Collaborate 2012 - Administering MySQL for Oracle DBAs
PDF
Collaborate 2012 - RMAN eliminate the mystery
PDF
Alternativas de alta disponiblidad en MySQL - MySQL Meetup - Montevideo - Mar...
PDF
Difusión UYOUG 2012 - Oracle Developer Day - Montevideo
PDF
OOW LatinAmerica 2011 - RMAN sin misterios
Database automation guide - Oracle Community Tour LATAM 2023
Terraform Tips and Tricks - LAOUC 2022
Oracle on kubernetes 101 - Dec/2021
Redefining tables online without surprises
Protect Sensitive Data: Implementing Fine-Grained Access Control in Oracle
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Oracle Exadata Maintenance tasks 101 - OTN Tour 2015
My Experience Using Oracle SQL Plan Baselines 11g/12c
Oracle RAC sin sorpresas - v2014
Alta disponibilidad con Pacemaker
AROUG BIDAY 2013 - Automatizar procesos de ETL con PL/SQL
MariaDB y FOSS en infraestructura de salud y estándares
UYOUG 2012 - Oracle RAC 11gR2 - New features
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - RMAN Eliminate the mystery
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - RMAN eliminate the mystery
Alternativas de alta disponiblidad en MySQL - MySQL Meetup - Montevideo - Mar...
Difusión UYOUG 2012 - Oracle Developer Day - Montevideo
OOW LatinAmerica 2011 - RMAN sin misterios

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PPTX
Spectroscopy.pptx food analysis technology
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Big Data Technologies - Introduction.pptx
PDF
Approach and Philosophy of On baking technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
cuic standard and advanced reporting.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction
Spectroscopy.pptx food analysis technology
MIND Revenue Release Quarter 2 2025 Press Release
Big Data Technologies - Introduction.pptx
Approach and Philosophy of On baking technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Programs and apps: productivity, graphics, security and other tools
The AUB Centre for AI in Media Proposal.docx
cuic standard and advanced reporting.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Diabetes mellitus diagnosis method based random forest with bat algorithm
Chapter 3 Spatial Domain Image Processing.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Digital-Transformation-Roadmap-for-Companies.pptx
Understanding_Digital_Forensics_Presentation.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Spectral efficient network and resource selection model in 5G networks

Practical guide to Oracle Virtual environments

  • 1. Practical guide to Oracle Virtual environments ODC Tour Latin America – August 2018 Nelson Calero
  • 2. Today’s topics • Virtual environments review – Docker – Oracle VirtualBox – Oracle VM – Oracle Cloud • Automation – Vagrant – Ansible – Terraform • Examples – VirtualBox VMs using Vagrant/Ansible – Docker on Windows – RAC using VirtualBox and Docker – Terraform for Oracle Cloud instances 2 © 2018 Pythian Motivation Explore alternatives to create database environments Intended audience DBAs and Developers
  • 3. • 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 About me 3 © 2018 Pythian http://www.linkedin.com/in/ncalero @ncalerouy
  • 4. Pythian overview © 2015 Pythian Confidential4 • 22 Years of data infrastructure management consulting • 250+ Top brands • 11800+ Systems under management • 400+ employees in 35 countries • 10 Oracle ACEs, 4 ACED, 3 OakTable members, 2 OCM, 6 Microsoft MVPs, 1 Cloudera Champion of Big Data, AWS Certified Solutions Architect – 2 Professional, 12 Associate • Oracle, Microsoft, MySQL, Hadoop, Cassandra, MongoDB, and more • Infrastructure, Cloud, DevOps, and application expertise
  • 5. 5 © 2018 Pythian
  • 6. Introduction to Virtual environments 6 KVM, Oracle VM, VirtualBox, … LXC, WPAR, Docker, … Sharing server resources isolating processes https://docs.docker.com/get-started/
  • 7. 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 – LXC, Docker – MOS 2216342.1 Oracle Support for Database Running on Docker  Supported SI on Oracle Linux 7 with UEK4 (and later) or RHEL7 7 © 2018 Pythian
  • 8. Not only server virtualization • Data virtualization – Delphix, … • Storage snapshots (vendor based) – SMO, NetAPP, Oracle ACFS, .. – gDBClone – clone databases based on 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 new OCI, not classic) – Containers – as managed services or DIY in BM 8 © 2018 Pythian
  • 9. Today’s focus: VMs and containers 9 © 2018 Pythian
  • 10. Containers with Docker 10 • 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 © 2018 Pythian
  • 11. Docker – command line Windows – control VM status 11 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 Management Commands: checkpoint Manage checkpoints config Manage Docker configs container Manage containers image Manage images network Manage networks node Manage Swarm nodes plugin Manage plugins secret Manage Docker secrets service Manage services stack Manage Docker stacks swarm Manage Swarm system Manage Docker volume Manage volumes D:>docker Commands: attach Attach local standard input, output, and error streams to a running contain build Build an image from a Dockerfile commit Create a new image from a container's changes cp Copy files/folders between a container and the local filesystem create Create a new container deploy Deploy a new stack or update an existing stack diff Inspect changes to files or directories on a container's filesystem events Get real time events from the server exec Run a command in a running container export Export a container's filesystem as a tar archive history Show the history of an image images List images import Import the contents from a tarball to create a filesystem image info Display system-wide information inspect Return low-level information on Docker objects kill Kill one or more running containers load Load an image from a tar archive or STDIN login Log in to a Docker registry 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 ps List containers ...
  • 12. Docker – configuration 12 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 © 2018 Pythian
  • 13. Docker – creating a container 13 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. Create the container (11.2.0.2 XE, 12.1.0.2 or 12.2.0.1 EE or SE as of March 2018): D:GitHub12.1.0.2/…>docker build -t oracle/database:12.1.0.2-ee -f Dockerfile.ee . Download Oracle installation files from OTN: • http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html • Copy to directory D:GitHubdocker-imagesOracleDatabasedockerfiles12.1.0.2 © 2018 Pythian
  • 14. Docker – creating a container 14 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 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 © 2018 Pythian
  • 15. Docker – connecting to Oracle 15 Using sqlplus binary from container Connect to database running in container – using host Oracle client D:>docker-machine ip 192.168.99.100 C:Userscalero>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 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 © 2018 Pythian
  • 16. Docker - images from container-registry Register in container-registry.oracle.com Start session Download image Step by step guide: 16 D:>docker login container-registry.oracle.com Username: nelson.calero@gmail.com Password: xxx Login Succeeded 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 http://databaseindex.blogspot.com/2018/04/oracle-12c-docker-windows-ocr.html © 2018 Pythian
  • 17. Example – Oracle DB using Docker Image Check local images 17 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 download binaries from OTN - Step-by-step example on Windows 10: http://www.oracle.com/technetwork/es/articles/datawarehouse/oracle12c-docker-win10-4485487-esa.html More examples: - Standby: https://github.com/jamesattard/oracle-xe-docker - RAC: https://github.com/Seth-Miller/12c-rac-docker https://github.com/oracle/docker-images/tree/master/OracleDatabase/RAC 18 © 2018 Pythian
  • 19. Docker - creating a container 19 Demo © 2018 Pythian
  • 20. Hypervisors – Oracle VM (type 1) • Xen Kernel – UEK R4 as of July 2018 with OVM 3.4.4 • Server needs to boot with it (reinstall needed if other OS was used) • Minimal resources used by OVM server (1 CPU 2Gg RAM) • VMs uses free available server’s resources – can be created from OVS using CLI (xm) or using OVM manager web client – RAM/CPUs can be allocated dynamically without restarting VMs (up to max config) – Only supported method to reduce license costs (hard partitioning) – HA configuration allowed with clustered repositories (using SAN, not with local HDs) – Windows, Linux and Solaris guests • OVM Manager – Needs to be installed in a different server – Uses MySQL as metadata repository 20 © 2018 Pythian
  • 21. Oracle VM - examples 21 © 2018 Pythian [root@ovs ~]# xm list Name ID Mem VCPUs State Time(s) 0004fb00000600001000d7829bf5a105 4 30723 4 -b---- 2415636.4 0004fb0000060000cf08a173c50efdc1 2 13063 4 r----- 784876.4 Domain-0 0 1958 20 r----- 1211462.2 [root@ovs /OVS/Repositories]# ls -l */VirtualMachines/*/vm.cfg -rw------- 1 root root 1950 Apr 19 02:37 0004fb00000300005b800c75ea8932be/VirtualMachines/0004fb00000600001000d7829bf5a105/vm.cfg -rw-r--r-- 1 root root 1946 Apr 19 02:36 0004fb00000300005b800c75ea8932be/VirtualMachines/0004fb0000060000cf08a173c50efdc1/vm.cfg [root@ovs ~]# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 20 Hypervisor vendor: Xen Virtualization type: none [root@ovs ~]# cd /OVS/Repositories/*/VirtualMachines [root@ovs VirtualMachines]# grep cpus 0004fb0000060000cf08a173c50efdc1/vm.cfg maxvcpus = 4 vcpus = 4 cpus = '0-3‘ # '2,3'
  • 22. Oracle VM Manager console 22 © 2018 Pythian
  • 23. VirtualBox VMs (type 2) • Run on any OS (Linux, Windows, Mac) • Download binaries for your platform • How to create your Oracle VM? – a) Download OS ISO+ Oracle binaries Create VM, boot from ISO, install OS + DB, create DB – b) Download VM template - all pre(installed/configured) http://www.oracle.com/technetwork/community/developer-vm/index.html – c) use tools to automate a) • Several github repos available (details later) • Allows to customize your VM and create your own template 23 © 2018 Pythian
  • 24. Example – Oracle DB using Vbox © 2015 Pythian Confidential24
  • 25. 25
  • 26. CLI tools • VBox: VBoxManage post creation steps? • Docker: dockerfile – ENTRYPOINT – commands to execute when container is run – CMD – provide default parameters for ENTRYPOINTS or executing an ad-hoc command 26 C:Program FilesOracleVirtualBox> ./VBoxManage list vms "Oracle DB Developer VM" {6f3d3706-a84d-4163-9bf7-14da26393179} "oracle-OEL69" {2b835d64-f868-44d8-88e9-9f214dd2fb7d} "oel68-asm2" {e4d7eb54-2159-4398-a49a-3c2ccfe3cc86} "oel68-asm1" {bc5e8bc7-3e15-47a1-b81c-2d7bca77b7dd} "ora12c-si-asm-oel682" {a7318e8a-5b6d-496f-992c-46f84108d345} "ora12c-si-asm-oel681" {19e74473-bb07-423d-914c-354dc94d6b61} "default" {fbe05e1e-3c50-4f8f-ba29-6a795a56bdc8} © 2018 Pythian
  • 27. Automation tools Vagrant (from HashiCorp) - Manage VMs with a standard workflow - Out of the box with support for VirtualBox, Hyper-V, and Docker - Uses CLI (Vbox, Vmware, Docker) to manage lifecycle - Handles CLI parameters accordingly with their different versions - Automatic ssh setup, etc - Configuration files, providers, plugins - Use case: few local VMs - Runs on any OS – Linux, Windows, Mac 27 Ansible (from RedHat) • Automation tool using a simple configuration language • Agentless, uses OpenSSH and WinRM • Provisioning, configuration management and workload orchestration • Available on Linux and Mac Terraform (from HashiCorp) • Build infrastructure, complex sets, local and remote using simple language • Runs on any OS © 2018 Pythian
  • 28. Vagrant 28 $ vagrant init hashicorp/precise64 $ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'hashicorp/precise64'... ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Waiting for machine to boot... $ vagrant ssh vagrant@precise64:~$ _ Install latest binaries: https://www.vagrantup.com/downloads.html OS Images - Called box: used to create your VM. - Public catalog: https://app.vagrantup.com/boxes/search - or create your own, or use from any URL Vagrantfile - Configuration and provisioning steps - Ruby syntax - Created with defaults using init Simple example: creating a VM based on precise64 image (Ubuntu 12.04 64- bit) from their public catalog © 2018 Pythian
  • 29. Vagrant Provisioning: execute steps after it is running - part of initial up process, or called manually - Built-in types: Shell, Ansible, Chef, Docker, Puppet, Salt, … Sample Vagrantfile using a shell provisioner Providers: virtual machine to manage - Out of the box for: VirtualBox (default), Docker, Hyper-V - More can be installed as plugins: Vmware, Custom 29 © 2018 Pythian Vagrant.configure("2") do |config| config.vm.provision "shell", inline: "echo Hello, World" end
  • 30. Vagrant - commands 30 D:GitHub>vagrant box list bento/oracle-6.9 (virtualbox, 201801.02.0) kikitux/oracle6-racattack (virtualbox, 16.01.01) oravirt/ol67 (virtualbox, 20170424) oravirt/ol68 (virtualbox, 20170418) oravirt/ol72 (virtualbox, 20170425) D:GitHub>vagrant Usage: vagrant [options] <command> [<args>] box manages boxes: installation, removal, etc. init initializes a new Vagrant environment by creating a Vagrantfile validate validates the Vagrantfile up starts and provisions the vagrant environment provision provisions the vagrant machine push deploys code in this environment to a configured destination port displays information about guest port mappings status outputs status of the vagrant machine connect connect to a remotely shared Vagrant environment suspend suspends the machine resume resume a suspended vagrant machine halt stops the vagrant machine destroy stops and deletes all traces of the vagrant machine reload restarts vagrant machine, loads new Vagrantfile configuration snapshot manages snapshots: saving, restoring, etc. ssh connects to machine via SSH powershell connects to machine via powershell remoting rdp connects to machine via RDP
  • 31. Ansible • Install binaries in a control machine (Windows not supported) • No agent – uses ssh to connect to remote machines • Inventory to define machines to use - /etc/ansible/hosts • Playbook: language used for configuration, deployment, and orchestration – YAML format – tags and actions to execute – conditional control: when, loop, until – this is the main code to keep under source control • Modules describing resources and desired state – Created by us or built-in modules: http://docs.ansible.com/modules_by_category.html – Can be executed directly or inside playbooks 31 © 2018 Pythian
  • 32. Ansible playbooks Sample playbook – playbook.yml To execute it: 32 - hosts: webservers remote_user: root tasks: - name: ensure apache is at the latest version yum: name: httpd state: latest - name: write the apache config file template: src: /srv/httpd.j2 dest: /etc/httpd.conf $ ansible-playbook playbook.yml © 2018 Pythian
  • 33. Oracle VBox VMs using Vagrant/Ansible (1) Repository with several configurations: https://github.com/oravirt/ Example for single instance: vagrant-vbox-si-asm  Customization explained: ${INST_DIR}/README.md  Code to change: o vagrant-vbox-si-asmhosts.yml: o vagrant-vbox-si-asmextra-provisionansible-oraclegroup_vars  Copy binary files from OTN - ${INST_DIR}vagrant-vbox-si-asmswrepo 33 basename_vm: ora12c-si-asm-oel68 num_vm: 2 base_priv_ip: 172.16.56.30 # (your chosen IP) oracle_install_version_gi: 12.1.0.2 oracle_version_db: 12.1.0.2 © 2018 Pythian
  • 34. Oracle VBox VMs using Vagrant/Ansible (2) To create the VM without installing Oracle: To install Oracle after the VM is created: All together: 34 D:GitHubvboxsi2vagrant-vbox-si-asm>vagrant provision ==> oel68-asm1: Running provisioner: ansible_local... Vagrant has automatically selected the compatibility mode '2.0' according to the Ansible version installed (2.2.1.0). … PLAY [all] ********************************************************************* TASK [setup] ******************************************************************* ok: [oel68-asm1] TASK [init : Install packages] ************************************************* ok: [oel68-asm1] => (item=[u'ntp', u'dnsmasq']) … $ vagrant up $ setup=true ; vagrant up © 2018 Pythian
  • 35. Oracle VBox VMs using Vagrant/Ansible DEMO time More step-by-step examples: - Oracle Standby 12c using vagrant-vbox-si-asm: http://databaseindex.blogspot.com/2018/02/crear-oracle-standby-12c-usando.html - Oracle 12c VM on Windows 10 using ubuntu shell (WLS) and ansible: http://databaseindex.blogspot.com/2018/03/oracle-12c-vagrant-windows-wls-ubuntu.html 35 © 2018 Pythian
  • 36. Oracle RAC VBox VMs • Similar approach: https://github.com/racattack/racattack-ansible-oracle • Implements configuration described in RAC Attack handbook: https://en.wikibooks.org/wiki/RAC_Attack_-_Oracle_Cluster_Database_at_Home/RAC_Attack_12c • Customization explained in project readme (README.md) on Vagrantfile: step-by-step example on Windows: http://databaseindex.blogspot.com/2017/04/automatizar-instalacion-de-oracle-rac.html 36 © 2018 Pythian ############################# ##### BEGIN CUSTOMIZATION ##### ############################# #define number of nodes num_APPLICATION = 0 num_LEAF_INSTANCES = 0 num_DB_INSTANCES = 1 #define number of cores for guest num_CORE = 1 #define memory for each type of node in MBytes memory_APPLICATION = 1500 memory_LEAF_INSTANCES = 2300 memory_DB_INSTANCES = 3072
  • 37. Oracle RAC with Docker As pointed earlier: https://github.com/oracle/docker-images/tree/master/OracleDatabase/RAC Several containers needs to be created: - OracleConnectionManager: bind single port to host and serve containers on different ports - OracleRACStorageServer: Oracle ASM on NFS Server for RAC testing - OracleRealApplicationClusters: RAC instance, minimum two Several steps for each container. 37 © 2018 Pythian
  • 38. VMs in Oracle Cloud • Infrastructure services – Database Cloud Service (DBCS): all managed, pre-built configurations – Compute (OCI or OCI-C): install DB manually as in VirtualBox – Bare Metal and BYOH (OCI): entire server, can install OVM or use as Compute • Container services • Automation – Terraform for OCI and OCI-C – Orchestration for OCI-C – REST API Upcoming example – already in my other session about that topic 38 © 2018 Pythian
  • 39. Example: OCI Instance using Terraform • Download Terraform binary (my example uses v0.11.3) – https://www.terraform.io/downloads.html • Download Terraform OCI-provider (using v2.1.0) – https://github.com/oracle/terraform-provider-oci/releases • Create .tf HCL Project (based on examples): – https://github.com/oracle/terraform-provider-oci/tree/master/docs/examples • Configure your account Access (env-vars.ps1) – Tenancy and user OCIDs, fingerprint, private key, region • Terraform Plan • Terraform Apply • Step by step guide: https://community.oracle.com/docs/DOC-1019936 39 © 2018 Pythian
  • 40. ncalero@H6RMYZ1:/mnt/d/GitHub/terraform-OCI/$ ls block.tf compute.tf env-vars.ps1 outputs.tf userdata datasources.tf network.tf provider.tf remote-exec.tf variables.tf ncalero@H6RMYZ1:/mnt/d/GitHub/terraform-OCI$ cat /mnt/c/users/calero/AppData/Roaming/terraform.rc providers { oci = "d:softterraform-provider-oci_v2.1.0.exe" } 40 © 2018 Pythian PS D:GitHubterraform-OCI> cat ./env-vars.ps1 $env:TF_VAR_tenancy_ocid="ocid1.tenancy.oc1..aaaaaaaaw5hodl4pajmymyo62bwkj4kokziowmjkvj7fvmgt4lqia3yg7km" $env:TF_VAR_user_ocid="ocid1.user.oc1..aaaaaaaaiyhrscq7rhfiyhrscql4tb3ojto2ysw72l656yknkyqau2lxotqf" $env:TF_VAR_compartment_ocid="ocid1.compartment.oc1.. aaaaaaaakdevdha7q7yjdheridcy63sgv2syefv7x46u67jk4hj" $env:TF_VAR_region="us-ashburn-1“ $env:TF_VAR_fingerprint="db:a3:b8:59:ce:05:ff:78:c0:fb:aa:ca:d7:09:77:ad" $env:TF_VAR_private_key_path="C:Userscalero.ocioci_api_key.pem" ### Public/private keys used on the instances $env:TF_VAR_ssh_public_key = Get-Content C:Userscalero.sshid_rsa.pub -Raw $env:TF_VAR_ssh_private_key = Get-Content C:Userscalero.sshid_rsa -Raw PS D:GitHubterraform-OCI> ./env-vars.ps1
  • 41. ncalero@H6RMYZ1:/mnt/d/GitHub/terraform-OCI$ cat compute.tf resource "oci_core_instance" "DemoInstance" { availability_domain = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[0],"name")}" compartment_id = "${var.compartment_ocid}" display_name = "Demo-Instance" image = "${lookup(data.oci_core_images.OLImageOCID.images[0], "id")}" shape = "${var.InstanceShape}" subnet_id = "${oci_core_subnet.SN-DemoSubnetAD1.id}" metadata { ssh_authorized_keys = "${var.ssh_public_key}" user_data = "${base64encode(file(var.InstanceBootStrap))}" } } ncalero@H6RMYZ1:/mnt/d/GitHub/terraform-OCI/demo$ cat provider.tf provider "oci" { tenancy_ocid = "${var.tenancy_ocid}" user_ocid = "${var.user_ocid}" fingerprint = "${var.fingerprint}" private_key_path = "${var.private_key_path}“ region = "${var.region}" } 41 © 2018 Pythian
  • 42. 42 © 2018 Pythian
  • 43. 43 © 2018 Pythian
  • 44. © 2015 Pythian Confidential44 PS D:GitHubterraform-OCI> d:softterraform graph | dot -Tpng -o demo-graph.png
  • 45. Terraform apply © 2015 Pythian Confidential45
  • 46. Summary Comparing options to create an Oracle instance using dataguard (2 VMs) Notes: * host CPU can be shared among VMs but performance will be impacted. Use 1 CPU per VM for prod ** only as described in MOS 2216342.1 - SI on OEL7 with UEK4 or RHEL7 as of July 2018 *** once familiar with the tool and concepts 46 Solution Host OS Disk space CPU min. License Creation effort Production support OVM OVM 2xVM+ 1 (*) VM CPUs Medium yes VirtualBox any 2xVM 1 (*) Entire host Easy (***) no Docker any 1xVM+ 1 (*) Entire host Easy (***) yes (**) Cloud any 2xVM 1 (*) VM shape Easiest yes © 2018 Pythian
  • 47. References - documentation • Virtualization concepts: https://en.wikipedia.org/wiki/X86_virtualization • Docker documentation: https://docs.docker.com/ • Oracle database on Docker – github project: https://github.com/oracle/docker-images • VirtualBox user guide: https://www.virtualbox.org/manual/ch01.html • Oracle VM documentation: https://www.oracle.com/technetwork/documentation/vm-096300.html • Vagrant documentation: https://www.vagrantup.com/intro/index.html • Ansible user guide: https://docs.ansible.com/ansible/latest/user_guide/index.html • Terraform documentation: https://www.terraform.io/intro/index.html 47 © 2018 Pythian