SlideShare a Scribd company logo
1 of 27
Reduce resource consumption and clone in 
seconds your oracle virtual environment on 
your laptop using linux containers and 
btrfs 
Bertrand Drouvot
About Me 
Oracle DBA since 1999 
OCP 9i,10g,11g 
Rac certified Expert 
Exadata certified implementation specialist 
Blogger since 2012 
@bertranddrouvot 
BasketBall fan
Will present 
Linux containers (LXC) 
btfrs FileSystem 
Use case to minimise resource consumption on your laptop 
From an oracle DBA point of view 
Use case 1: Clone a database software home to apply cpu 
october on it 
Use case 2: Clone a database to apply cpu october on it 
Use cases 1 and 2: Without and With LXC 
Use case 3: Clone a PDB 
Disable COW on a subvolume (Performance reason) and Snap it
Will not present 
In depth Linux containers (LXC) 
In depth btfrs FileSystem
LXC 
1. Linux Containers (LXC) allow running multiple isolated 
Linux instances (containers) on the same host. 
2. A way to isolate a group of processes from the others 
on a running Linux system. 
3. Resource management and resource isolation features 
(Cgroups and name spaces). 
4. Processes can have their own private view of the 
operating system with its own process ID (PID) space, 
file system structure and network interfaces.
LXC (http://www.oracle.com/technetwork/server-storage/ 
linux/technologies/oracle-linux-containers- 
1898044.html)
btrfs 
1. Supports large files and file systems. 
2. Offers integrated volume management. 
3. Has built-in RAID functionality. 
4. Keeps data secure using copy-on-write (COW) and 
checksumming techniques. 
5. Provides writable snapshots. 
6.COW comes with some advantages, but can negatively 
affect performance with large files that have small random 
writes. It is recommended to disable COW for database 
files and virtual machine images.
Copy on write (COW) snapshot
How does it help? 
We can clone in seconds (and using few disk 
space): 
Linux containers 
Oracle software 
Oracle databases (Non CDB, CDB and PDB) 
Only on playground environment! (btrfs not 
officially supported by oracle see 236826.1& 
1601759.1)
Let’s setup the VM, LXC and btrfs (1/7) 
Let’s create a OEL 6.5 virtual machine (named lxc) using 
virtualbox. This virtual machine will host our Linux containers, 
oracle software and databases 
Install lxc and btrfs into the virtual machine created previously
Let’s setup the VM, LXC and btrfs (2/7) 
Install a btrfs file system into the virtual machine (this file 
system will receive the oracle software and databases). To do 
so, add a disk to your virtualbox machine, start the machine 
and launch the fs creation:
Let’s setup the VM, LXC and btrfs (3/7) 
Add a btrfs file system into the virtual machine (this file system 
will receive the linux containers). To do so, add a disk to your 
virtualbox machine, start the machine and launch the fs 
creation:
Let’s setup the VM, LXC and btrfs (4/7) 
Create 2 btrfs subvolumes for the database software and 
databases:
Let’s setup the VM, LXC and btrfs (5/7) 
Add into /etc/hosts the machine (VM) name (LXC in our case):
Let’s setup the VM, LXC and btrfs (6/7) 
Install the 12cR1 database software with: 
Create a simple database with datafiles, redologs and 
controlfile located into the /btrfs/databases folder:
Let’s setup the VM, LXC and btrfs (7/7) 
Create a linux container (using oracle template) that will be the 
source of all our new containers: 
lxc-create --name cont_source -B btrfs --template oracle -- -- 
url http://public-yum.oracle.com -R 6.latest -r "perl sudo 
oracle-rdbms-server-12cR1-preinstall" 
Look at the “-B btrfs” argument to specify that the linux 
container is created on a BTRFS file system (and then would be 
able to use the snapshot capability during LXC clone creation).
Use case 1: clone db software + install CPU October 
Check FS size: btrfs filesystem df /btrfs 
Create a snapshot of the /btrfs/u01 subvolume: btrfs su 
snapshot /btrfs/u01 /btrfs/u01_patch 
Check FS size: btrfs filesystem df /btrfs 
Install CPU October 2014 
Check FS size: btrfs filesystem df /btrfs
Use case 2: clone database + install CPU October 
Check FS size: btrfs filesystem df /btrfs 
Clone the database directory: btrfs su snapshot 
/btrfs/databases /btrfs/databases_patch 
Check FS size: btrfs filesystem df /btrfs 
Apply the CPU on the cloned database BDTDB_CPU: 
Check FS size: btrfs filesystem df /btrfs
Use cases 1 and 2: with LXC (1/4) 
Clone the cont_source linux container machine: lxc-clone -s 
-t btrfs -o cont_source -n cpu_oct 
Clone the database software: btrfs su snapshot 
/btrfs/u01 /btrfs/u01_cpu_oct 
Clone the database directory: btrfs su snapshot 
/btrfs/databases /btrfs/databases_cpu_oct 
Link the cloned subvolumes to the cloned linux container FS 
(so that everything match the source environment)
Use cases 1 and 2: with LXC (2/4) 
Copy oratab, oraenv, dbhome + create mount point directory 
into the linux container: 
cp -p /usr/local/bin/coraenv /usr/local/bin/dbhome 
/usr/local/bin/oraenv 
/container/cpu_oct/rootfs/usr/local/bin 
cp -p /etc/oratab /container/cpu_oct/rootfs/etc/ 
mkdir -p /container/cpu_oct/rootfs/btrfs/u01 
mkdir -p /container/cpu_oct/rootfs/btrfs/databases 
mkdir -p 
/container/cpu_oct/rootfs/home/oracle/19121550 
Start the cloned linux container: lxc-start -n cpu_oct
Use cases 1 and 2: with LXC (3/4) 
Patch de database software:
Use cases 1 and 2: with LXC (4/4) 
Patch the database:
With / without LXC comparison 
Software cloning: 
No need to create a new oratab entry with LXC (simply copy the oratab to 
the LXC directory). 
No need to update the cloned inventory. 
Database cloning: 
No need to create a new oratab entry with LXC (simply copy the oratab to 
the LXC directory). 
No need to recreate the control file of the duplicated database with LXC. 
The config file of the cloned LXC machine just need to ensure that the cloned 
subvolumes are mounted at the right location.
Use case 3: Duplicate a PDB 
Put PDB1 in read only mode 
alter pluggable database PDB1 open read only; 
Generate the PDB1 xml file 
alter session set container=PDB1; 
exec 
dbms_pdb.describe(pdb_descr_file=>’/home/oracle/pdb1.xml'); 
Create the btrfs clone 
btrfs su snapshot /btrfs/databases/oradata/BDTPDB/PDB1 
/btrfs/databases/oradata/BDTPDB/PDB2 
Create and open the PDB2 PDB 
create pluggable database PDB2 AS CLONE using 
'/home/oracle/pdb1.xml' 
source_file_name_convert=('/btrfs/databases/oradata/BDTPDB/PD 
B1','/btrfs/databases/oradata/BDTPDB/PDB2') nocopy tempfile 
reuse; 
alter pluggable database PDB2 open;
Disable COW on a subvolume (Performance reason) and Snap it (1/2) 
Create a new subvolume 
btrfs subvolume create /btrfs/databases_cowoff 
Disable COW and chown oracle:dba 
chattr +C /btrfs/databases_cowoff 
chown oracle:dba /btrfs/databases_cowoff 
Create a new database (not cloned) 
Check new database is not COW 
lsattr /btrfs/databases_cowoff/oradata/COWOFF/datafile/*
Disable COW on a subvolume (Performance reason) and Snap it (2/2) 
Create a snap 
btrfs su snapshot /btrfs/databases_cowoff 
/btrfs/databases_cowoff_snap 
Create a cloned database 
Check cloned database is not COW 
lsattr /btrfs/databases_cowoff_snap/oradata/COWOFF/datafile/*
Questions?

More Related Content

What's hot

All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restore
Vasudeva Rao
 
Pgbr 2013 postgres on aws
Pgbr 2013   postgres on awsPgbr 2013   postgres on aws
Pgbr 2013 postgres on aws
Emanuel Calvo
 
Column store indexes and batch processing mode (nx power lite)
Column store indexes and batch processing mode (nx power lite)Column store indexes and batch processing mode (nx power lite)
Column store indexes and batch processing mode (nx power lite)
Chris Adkin
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
elliando dias
 

What's hot (20)

Advanced Apache Cassandra Operations with JMX
Advanced Apache Cassandra Operations with JMXAdvanced Apache Cassandra Operations with JMX
Advanced Apache Cassandra Operations with JMX
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restore
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
 
MySQL database replication
MySQL database replicationMySQL database replication
MySQL database replication
 
Xtrabackup工具使用简介 - 20110427
Xtrabackup工具使用简介 - 20110427Xtrabackup工具使用简介 - 20110427
Xtrabackup工具使用简介 - 20110427
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
DataStax: Backup and Restore in Cassandra and OpsCenter
DataStax: Backup and Restore in Cassandra and OpsCenterDataStax: Backup and Restore in Cassandra and OpsCenter
DataStax: Backup and Restore in Cassandra and OpsCenter
 
Mysql database basic user guide
Mysql database basic user guideMysql database basic user guide
Mysql database basic user guide
 
The Best and Worst of Cassandra-stress Tool (Christopher Batey, The Last Pick...
The Best and Worst of Cassandra-stress Tool (Christopher Batey, The Last Pick...The Best and Worst of Cassandra-stress Tool (Christopher Batey, The Last Pick...
The Best and Worst of Cassandra-stress Tool (Christopher Batey, The Last Pick...
 
Pgbr 2013 postgres on aws
Pgbr 2013   postgres on awsPgbr 2013   postgres on aws
Pgbr 2013 postgres on aws
 
PostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
PostgreSQL Performance Tables Partitioning vs. Aggregated Data TablesPostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
PostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
 
PostgreSQL and RAM usage
PostgreSQL and RAM usagePostgreSQL and RAM usage
PostgreSQL and RAM usage
 
Mongodb replication
Mongodb replicationMongodb replication
Mongodb replication
 
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
 
(DAT402) Amazon RDS PostgreSQL:Lessons Learned & New Features
(DAT402) Amazon RDS PostgreSQL:Lessons Learned & New Features(DAT402) Amazon RDS PostgreSQL:Lessons Learned & New Features
(DAT402) Amazon RDS PostgreSQL:Lessons Learned & New Features
 
Column store indexes and batch processing mode (nx power lite)
Column store indexes and batch processing mode (nx power lite)Column store indexes and batch processing mode (nx power lite)
Column store indexes and batch processing mode (nx power lite)
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
 
Dbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easyDbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easy
 
Cassandra at Instagram (August 2013)
Cassandra at Instagram (August 2013)Cassandra at Instagram (August 2013)
Cassandra at Instagram (August 2013)
 
Postgresql Database Administration Basic - Day2
Postgresql  Database Administration Basic  - Day2Postgresql  Database Administration Basic  - Day2
Postgresql Database Administration Basic - Day2
 

Viewers also liked

Cities social issues
Cities social issuesCities social issues
Cities social issues
dwessler
 
Btrfs by Chris Mason
Btrfs by Chris MasonBtrfs by Chris Mason
Btrfs by Chris Mason
Terry Wang
 
Sheepdog- Google Webinar
Sheepdog- Google Webinar Sheepdog- Google Webinar
Sheepdog- Google Webinar
Sheepdog
 
Sheepdog: yet another all in-one storage for openstack
Sheepdog: yet another all in-one storage for openstackSheepdog: yet another all in-one storage for openstack
Sheepdog: yet another all in-one storage for openstack
Liu Yuan
 
B tree file system
B tree file systemB tree file system
B tree file system
Dinesh Gupta
 

Viewers also liked (16)

Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination
 
RAID, Replication, and You
RAID, Replication, and YouRAID, Replication, and You
RAID, Replication, and You
 
I can\'t believe this is butter - A Tour of btrfs
I can\'t believe this is butter - A Tour of btrfsI can\'t believe this is butter - A Tour of btrfs
I can\'t believe this is butter - A Tour of btrfs
 
Cities social issues
Cities social issuesCities social issues
Cities social issues
 
Btrfs by Chris Mason
Btrfs by Chris MasonBtrfs by Chris Mason
Btrfs by Chris Mason
 
Sheepdog- Google Webinar
Sheepdog- Google Webinar Sheepdog- Google Webinar
Sheepdog- Google Webinar
 
LUG-BG 2017 - Rangel Ivanov - Spread some butter - BTRFS
LUG-BG 2017 - Rangel Ivanov - Spread some butter - BTRFSLUG-BG 2017 - Rangel Ivanov - Spread some butter - BTRFS
LUG-BG 2017 - Rangel Ivanov - Spread some butter - BTRFS
 
Btrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current StatusBtrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current Status
 
Sheepdog: yet another all in-one storage for openstack
Sheepdog: yet another all in-one storage for openstackSheepdog: yet another all in-one storage for openstack
Sheepdog: yet another all in-one storage for openstack
 
Introduction to BTRFS and ZFS
Introduction to BTRFS and ZFSIntroduction to BTRFS and ZFS
Introduction to BTRFS and ZFS
 
Case study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File systemCase study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File system
 
B tree file system
B tree file systemB tree file system
B tree file system
 
File System Comparison on Linux Ubuntu
File System Comparison on Linux UbuntuFile System Comparison on Linux Ubuntu
File System Comparison on Linux Ubuntu
 
Btrfs current status and_future_prospects
Btrfs current status and_future_prospectsBtrfs current status and_future_prospects
Btrfs current status and_future_prospects
 
Feature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with EncryptionFeature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with Encryption
 
Container Storage Best Practices in 2017
Container Storage Best Practices in 2017Container Storage Best Practices in 2017
Container Storage Best Practices in 2017
 

Similar to Reduce Resource Consumption & Clone in Seconds your Oracle Virtual Environment on your Laptop using Linux Containers and BTRFS

Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7
Etsuji Nakai
 
CM_SME revised bc635_637PCI_V2_Linux_SDK
CM_SME revised bc635_637PCI_V2_Linux_SDKCM_SME revised bc635_637PCI_V2_Linux_SDK
CM_SME revised bc635_637PCI_V2_Linux_SDK
Chris Muntzer
 
GlusterFS Update and OpenStack Integration
GlusterFS Update and OpenStack IntegrationGlusterFS Update and OpenStack Integration
GlusterFS Update and OpenStack Integration
Etsuji Nakai
 

Similar to Reduce Resource Consumption & Clone in Seconds your Oracle Virtual Environment on your Laptop using Linux Containers and BTRFS (20)

Container & kubernetes
Container & kubernetesContainer & kubernetes
Container & kubernetes
 
Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
CM_SME revised bc635_637PCI_V2_Linux_SDK
CM_SME revised bc635_637PCI_V2_Linux_SDKCM_SME revised bc635_637PCI_V2_Linux_SDK
CM_SME revised bc635_637PCI_V2_Linux_SDK
 
New Features for Multitenant in Oracle Database 21c
New Features for Multitenant in Oracle Database 21cNew Features for Multitenant in Oracle Database 21c
New Features for Multitenant in Oracle Database 21c
 
Linux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of TechnologyLinux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of Technology
 
Rac on NFS
Rac on NFSRac on NFS
Rac on NFS
 
Asterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log RotationAsterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log Rotation
 
Evolution of containers to kubernetes
Evolution of containers to kubernetesEvolution of containers to kubernetes
Evolution of containers to kubernetes
 
GlusterFS Update and OpenStack Integration
GlusterFS Update and OpenStack IntegrationGlusterFS Update and OpenStack Integration
GlusterFS Update and OpenStack Integration
 
First steps on CentOs7
First steps on CentOs7First steps on CentOs7
First steps on CentOs7
 
Bluestore
BluestoreBluestore
Bluestore
 
Bluestore
BluestoreBluestore
Bluestore
 
Kernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and futureKernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and future
 
Docker London: Container Security
Docker London: Container SecurityDocker London: Container Security
Docker London: Container Security
 
Root file system for embedded systems
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systems
 
How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016
 
linux installation.pdf
linux installation.pdflinux installation.pdf
linux installation.pdf
 
9i hp relnotes
9i hp relnotes9i hp relnotes
9i hp relnotes
 
Fossetcon14
Fossetcon14Fossetcon14
Fossetcon14
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 

Reduce Resource Consumption & Clone in Seconds your Oracle Virtual Environment on your Laptop using Linux Containers and BTRFS

  • 1. Reduce resource consumption and clone in seconds your oracle virtual environment on your laptop using linux containers and btrfs Bertrand Drouvot
  • 2. About Me Oracle DBA since 1999 OCP 9i,10g,11g Rac certified Expert Exadata certified implementation specialist Blogger since 2012 @bertranddrouvot BasketBall fan
  • 3. Will present Linux containers (LXC) btfrs FileSystem Use case to minimise resource consumption on your laptop From an oracle DBA point of view Use case 1: Clone a database software home to apply cpu october on it Use case 2: Clone a database to apply cpu october on it Use cases 1 and 2: Without and With LXC Use case 3: Clone a PDB Disable COW on a subvolume (Performance reason) and Snap it
  • 4. Will not present In depth Linux containers (LXC) In depth btfrs FileSystem
  • 5. LXC 1. Linux Containers (LXC) allow running multiple isolated Linux instances (containers) on the same host. 2. A way to isolate a group of processes from the others on a running Linux system. 3. Resource management and resource isolation features (Cgroups and name spaces). 4. Processes can have their own private view of the operating system with its own process ID (PID) space, file system structure and network interfaces.
  • 7. btrfs 1. Supports large files and file systems. 2. Offers integrated volume management. 3. Has built-in RAID functionality. 4. Keeps data secure using copy-on-write (COW) and checksumming techniques. 5. Provides writable snapshots. 6.COW comes with some advantages, but can negatively affect performance with large files that have small random writes. It is recommended to disable COW for database files and virtual machine images.
  • 8. Copy on write (COW) snapshot
  • 9. How does it help? We can clone in seconds (and using few disk space): Linux containers Oracle software Oracle databases (Non CDB, CDB and PDB) Only on playground environment! (btrfs not officially supported by oracle see 236826.1& 1601759.1)
  • 10. Let’s setup the VM, LXC and btrfs (1/7) Let’s create a OEL 6.5 virtual machine (named lxc) using virtualbox. This virtual machine will host our Linux containers, oracle software and databases Install lxc and btrfs into the virtual machine created previously
  • 11. Let’s setup the VM, LXC and btrfs (2/7) Install a btrfs file system into the virtual machine (this file system will receive the oracle software and databases). To do so, add a disk to your virtualbox machine, start the machine and launch the fs creation:
  • 12. Let’s setup the VM, LXC and btrfs (3/7) Add a btrfs file system into the virtual machine (this file system will receive the linux containers). To do so, add a disk to your virtualbox machine, start the machine and launch the fs creation:
  • 13. Let’s setup the VM, LXC and btrfs (4/7) Create 2 btrfs subvolumes for the database software and databases:
  • 14. Let’s setup the VM, LXC and btrfs (5/7) Add into /etc/hosts the machine (VM) name (LXC in our case):
  • 15. Let’s setup the VM, LXC and btrfs (6/7) Install the 12cR1 database software with: Create a simple database with datafiles, redologs and controlfile located into the /btrfs/databases folder:
  • 16. Let’s setup the VM, LXC and btrfs (7/7) Create a linux container (using oracle template) that will be the source of all our new containers: lxc-create --name cont_source -B btrfs --template oracle -- -- url http://public-yum.oracle.com -R 6.latest -r "perl sudo oracle-rdbms-server-12cR1-preinstall" Look at the “-B btrfs” argument to specify that the linux container is created on a BTRFS file system (and then would be able to use the snapshot capability during LXC clone creation).
  • 17. Use case 1: clone db software + install CPU October Check FS size: btrfs filesystem df /btrfs Create a snapshot of the /btrfs/u01 subvolume: btrfs su snapshot /btrfs/u01 /btrfs/u01_patch Check FS size: btrfs filesystem df /btrfs Install CPU October 2014 Check FS size: btrfs filesystem df /btrfs
  • 18. Use case 2: clone database + install CPU October Check FS size: btrfs filesystem df /btrfs Clone the database directory: btrfs su snapshot /btrfs/databases /btrfs/databases_patch Check FS size: btrfs filesystem df /btrfs Apply the CPU on the cloned database BDTDB_CPU: Check FS size: btrfs filesystem df /btrfs
  • 19. Use cases 1 and 2: with LXC (1/4) Clone the cont_source linux container machine: lxc-clone -s -t btrfs -o cont_source -n cpu_oct Clone the database software: btrfs su snapshot /btrfs/u01 /btrfs/u01_cpu_oct Clone the database directory: btrfs su snapshot /btrfs/databases /btrfs/databases_cpu_oct Link the cloned subvolumes to the cloned linux container FS (so that everything match the source environment)
  • 20. Use cases 1 and 2: with LXC (2/4) Copy oratab, oraenv, dbhome + create mount point directory into the linux container: cp -p /usr/local/bin/coraenv /usr/local/bin/dbhome /usr/local/bin/oraenv /container/cpu_oct/rootfs/usr/local/bin cp -p /etc/oratab /container/cpu_oct/rootfs/etc/ mkdir -p /container/cpu_oct/rootfs/btrfs/u01 mkdir -p /container/cpu_oct/rootfs/btrfs/databases mkdir -p /container/cpu_oct/rootfs/home/oracle/19121550 Start the cloned linux container: lxc-start -n cpu_oct
  • 21. Use cases 1 and 2: with LXC (3/4) Patch de database software:
  • 22. Use cases 1 and 2: with LXC (4/4) Patch the database:
  • 23. With / without LXC comparison Software cloning: No need to create a new oratab entry with LXC (simply copy the oratab to the LXC directory). No need to update the cloned inventory. Database cloning: No need to create a new oratab entry with LXC (simply copy the oratab to the LXC directory). No need to recreate the control file of the duplicated database with LXC. The config file of the cloned LXC machine just need to ensure that the cloned subvolumes are mounted at the right location.
  • 24. Use case 3: Duplicate a PDB Put PDB1 in read only mode alter pluggable database PDB1 open read only; Generate the PDB1 xml file alter session set container=PDB1; exec dbms_pdb.describe(pdb_descr_file=>’/home/oracle/pdb1.xml'); Create the btrfs clone btrfs su snapshot /btrfs/databases/oradata/BDTPDB/PDB1 /btrfs/databases/oradata/BDTPDB/PDB2 Create and open the PDB2 PDB create pluggable database PDB2 AS CLONE using '/home/oracle/pdb1.xml' source_file_name_convert=('/btrfs/databases/oradata/BDTPDB/PD B1','/btrfs/databases/oradata/BDTPDB/PDB2') nocopy tempfile reuse; alter pluggable database PDB2 open;
  • 25. Disable COW on a subvolume (Performance reason) and Snap it (1/2) Create a new subvolume btrfs subvolume create /btrfs/databases_cowoff Disable COW and chown oracle:dba chattr +C /btrfs/databases_cowoff chown oracle:dba /btrfs/databases_cowoff Create a new database (not cloned) Check new database is not COW lsattr /btrfs/databases_cowoff/oradata/COWOFF/datafile/*
  • 26. Disable COW on a subvolume (Performance reason) and Snap it (2/2) Create a snap btrfs su snapshot /btrfs/databases_cowoff /btrfs/databases_cowoff_snap Create a cloned database Check cloned database is not COW lsattr /btrfs/databases_cowoff_snap/oradata/COWOFF/datafile/*