Oracle Linux and Oracle Database - A Trusted Combination

53
Oracle Linux and Oracle Database - A Trusted Combination Presenter: Anton Els Session Details: @aelsnz

Transcript of Oracle Linux and Oracle Database - A Trusted Combination

Page 1: Oracle Linux and Oracle Database - A Trusted Combination

Oracle Linux and Oracle Database - A Trusted Combination

■  Presenter: Anton Els Session Details:

@aelsnz

Page 2: Oracle Linux and Oracle Database - A Trusted Combination

Introduction

■  Vice President Product Development ■  NZOUG Committee (VP) ■  Working with Oracle database since version 7 ■  Interests Include:

▪  Linux, Docker, Oracle Databases, Oracle Backup and Recovery

■  Qualifications: ▪  Oracle Database 11g Certified Master

▪  Oracle 8i, 9i, 10g and 11g OCP

▪  Solaris 10 SCSA and Red Hat 5 RHCSA

▪  B.Sc. Mathematical Sciences and B.Sc. Hons Informatics

■  Presented at Collaborate, NZOUG and db tech showcase

Anton  Els  -­‐  @aelsnz

Page 3: Oracle Linux and Oracle Database - A Trusted Combination

Where do I come from….

Page 4: Oracle Linux and Oracle Database - A Trusted Combination

Who do I work for – Dbvisit Software Limited

■  Software Development Company ■  HQ in New Zealand

▪  US subsidiary and office in Czech Republic ■  Database Replication is our playground! ■  Worldwide leader in DR solutions for Oracle Standard Edition ■  Used in 110+ countries! ■  Product Engineers with “real world” DBA Experience ■  Regular presenters at OOW, Collaborate and NZOUG ■  Passionate about Oracle Technology

Page 5: Oracle Linux and Oracle Database - A Trusted Combination

•  Introduction into the world of Oracle Linux •  Command Line or GUI?

•  Installation and a few tips for Oracle DBAs •  So what is this UEK? •  How does software updates work? •  Things an Oracle DBA should know! •  The /proc filesystem… •  The power of the command line! •  Linux file systems •  Configure Linux for ASM - the easy way! •  Backup and Recovery •  Monitoring •  Conclusion •  Q & A

Agenda

Page 6: Oracle Linux and Oracle Database - A Trusted Combination

Linux is more than just a terminal…..

Page 7: Oracle Linux and Oracle Database - A Trusted Combination

If you want, there is a GUI!

Page 8: Oracle Linux and Oracle Database - A Trusted Combination

Introduction to Oracle Linux

■  Oracle Linux = Oracle Enterprise Linux = Enterprise Linux ■  Linux distribution based on Red Hat Enterprise Linux (RHEL) ■  Binary Compatible with RHEL

▪  Two alternative kernels: Ø  Red Hat Compatible Kernel

Ø  Unbreakable Enterprise Kernel (UEK)

■  Supported Architectures: ▪  i386 (4,5 and 6) ▪  x86_64 (4,5,6 and 7) ▪  ia64 (5.4-5.11 only)

■  Free to Download ▪  Oracle E-delivery ▪  Public Yum Repositories

Page 9: Oracle Linux and Oracle Database - A Trusted Combination

Introduction to Oracle Linux

■  Commercial Options: ▪  Technical Support (Subscription based)

Ø  Starting at US$119 per system (Oracle Linux Network Support)

▪  Access to ULN (Unbreakable Linux network)

■  Current Versions:

Release  Date   Release     Support  Oracle  Database  

2015-­‐03-­‐12 7.1 12.1.0.2  

2014-­‐10-­‐21 6.6 Yes

2014-­‐09-­‐23 5.11 Yes

2011-­‐02-­‐16 4.9 Yes

Page 10: Oracle Linux and Oracle Database - A Trusted Combination

Installing Oracle Linux

■  Various installation options such as: ▪  Network ▪  DVD (ISO) ▪  USB

■  If using OVM or VirtualBox: ▪  Templates available

Page 11: Oracle Linux and Oracle Database - A Trusted Combination

Installing Oracle Linux

DEMO  

Page 12: Oracle Linux and Oracle Database - A Trusted Combination
Page 13: Oracle Linux and Oracle Database - A Trusted Combination

What is the UEK? (Unbreakable Enterprise Kernel)

■  UEK – Oracle Unbreakable Enterprise Kernel ▪  “Fast”, “Reliable” and “Optimized” for Oracle Software/Hardware ▪  Used in Oracle’s Engineered Systems ▪  Release 1:

Ø  Released in 2010 and based on 2.6.32

Ø  OEL 5.5 / RHEL 5.5 and above

▪  Release 2: Ø  Oracle Linux above 5.8 and 6.2

Ø  Based on 3.0.16

Ø  Actual Displayed version – 2.6.39

▪  Release 3: Ø  Oracle Linux above 6.2 and 7

Ø  Based on 3.8 (latest UEK3u6 – 30 July 2015 – 3.8.13-98)

Page 14: Oracle Linux and Oracle Database - A Trusted Combination

What is the UEK? (Unbreakable Enterprise Kernel)

■  UEK – Oracle Unbreakable Enterprise Kernel ▪  No need to re-install Linux ▪  RHEL Compatible Kernel still provided ▪  Release 1 and 2 for x86 and x86_64 ▪  Release 3 x86_64 only ▪  ASMLib related modules already included

■  Download via: ▪  Oracle Public Yum

Ø  http://public-yum.oracle.com

▪  ULN (Unbreakable Linux Network)

Page 15: Oracle Linux and Oracle Database - A Trusted Combination

Using “yum” ■  yum – Yellowdog Updater, Modified ■  Package Management Utility ■  Using RPM packages ■  Using software repositories

▪  Unbreakable Linux Network (ULN) ▪  Oracle’s Public Repository ▪  Can create your own

■  Big Advantage – dependency management! ■  Download repository configuration file:

▪  cd /etc/yum.repos.d ▪  wget http://public-yum.oracle.com/public-yum-release.repo

■  As easy as “yum update” or “yum install <package>”

Page 16: Oracle Linux and Oracle Database - A Trusted Combination

The Directory Structure

/

/bin /boot /dev /etc /home /lib .. /proc /sbin /tmp /usr /var

So  where  do  we  install  Oracle?  

What  does  it  mean? Where  is  my  “My  Documents”

Page 17: Oracle Linux and Oracle Database - A Trusted Combination

Something to consider

/

/…

/home/oracle

/u01/app/oracle

/u01/app/oracle/product/12.1.0/db_1

Oracle  Base

Oracle  Home

Page 18: Oracle Linux and Oracle Database - A Trusted Combination

Quick tip on /proc /

/bin /boot /dev /etc .. /proc   /sbin /sys /tmp /usr /var

•  What  is  the  “/proc”  filesystem?  •  Look  at  this:  

oracle@dbvlin505[/home/oracle]: ps -ef|grep pmonoracle 24134 1 0 15:48 ? 00:00:00 ora_pmon_testdb

oracle@dbvlin505[/home/oracle]: cat /proc/24134/environ | xargs -0 -n1 |grep ORACLE_HOME ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1/

Oracle  was  started  with  incorrect  ORACLE_HOME  variable  –  extra  slash

oracle@dbvlin505[/home/oracle]: ps -ef|grep pmonoracle 24134 1 0 15:48 ? 00:00:00 ora_pmon_testdboracle@dbvlin505[/home/oracle]: sqlplus /nologSQL*Plus: Release 11.2.0.3.0 Production on Mon May 27 15:48:00 2013Copyright (c) 1982, 2011, Oracle. All rights reserved.SQL> connect / as sysdbaConnected to an idle instance.

Page 19: Oracle Linux and Oracle Database - A Trusted Combination

Useful Commands for the Oracle DBA

■  GUI’s can make things easier, BUT ■  GUI’s are not always available AND ■  Command line might sometimes be faster!

■  Useful Commands: ▪  ps, grep, awk, watch, perl, find, top, sar, lsof, pidstat, strace

■  Not sure how to use them? ▪  Use the man pages:

# man <command>

Example:

# man ps

Page 20: Oracle Linux and Oracle Database - A Trusted Combination

Quick Tip ■  Want to quickly list a directory tree?

root@lab1[/]: tree -d -L 5 /u01/u01└── app ├── oracle │   ├── admin │   │   └── testdb │   │   ├── adump │   │   ├── dpdump │   │   ├── pfile │   │   └── scripts │   ├── audit │   ├── cfgtoollogs │   │   ├── dbca │   │   │   └── testdb │   │   └── netca │   ├── checkpoints │   ├── diag

Page 21: Oracle Linux and Oracle Database - A Trusted Combination

Useful Commands for the Oracle DBA

■  The “watch” command ■  Example: watch -n 0.5 "cat /proc/meminfo" oracle@lab1[/home/oracle]: watch -h Usage: watch [options] command

Options: -b, --beep beep if command has a non-zero exit -c, --color interpret ANSI color sequences -d, --differences[=<permanent>] highlight changes between updates -e, --errexit exit if command has a non-zero exit -g, --chgexit exit when output from command changes -n, --interval <secs> seconds to wait between updates -p, --precise attempt run command in precise intervals -t, --no-title turn off header -x, --exec pass command to exec instead of "sh -c"  -h, --help display this help and exit -v, --version output version information and exit For more details see watch(1).

Page 22: Oracle Linux and Oracle Database - A Trusted Combination

Useful Commands for the Oracle DBA

■  The “lsof” command ■  Examples: root@kiwi1-oraclekiwi-com[/root]: lsof -i TCP -P|grep 22sshd 1216 root 3u IPv4 20780 0t0 TCP *:22 (LISTEN)sshd 1216 root 4u IPv6 20782 0t0 TCP *:22 (LISTEN)sshd 5096 root 3u IPv4 107383 0t0 TCP kiwi1.oraclekiwi.com:22->192.168.56.1:50411 (ESTABLISHED)sshd 5099 oracle 3u IPv4 107383 0t0 TCP

root@kiwi1-oraclekiwi-com[/tmp]: ps -ef|grep 19919root 19919 9813 0 18:24 pts/2 00:00:00 vi testfile

root@kiwi1-oraclekiwi-com[/tmp]: lsof -p 19919COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEvi 19919 root cwd DIR 252,1 4096 50331777 /tmpvi 19919 root rtd DIR 252,1 4096 128 /vi 19919 root txt REG 252,1 905984 17289278 /usr/bin/vivi 19919 root mem REG 252,1 58288 33880406 /usr/lib64/....vi 19919 root 2u CHR 136,2 0t0 5 /dev/pts/2vi 19919 root 3u REG 252,1 12288 51674965 /tmp/.testfile.swp

Page 23: Oracle Linux and Oracle Database - A Trusted Combination

Useful Commands for the Oracle DBA

DEMO  

Page 24: Oracle Linux and Oracle Database - A Trusted Combination

watch  –  real  Xme  monitor  for  a  process ps,  grep,  awk  –  find  running  process,  and  idenXfy  the  parent lsof    -­‐  list  open  files  for  process

Page 25: Oracle Linux and Oracle Database - A Trusted Combination

Getting Ready to Install Oracle Database

■  Recommended RPM Packages: ▪  oracle-validated ▪  oracle-rdbms-server-11gR2-preinstall ▪  oracle-rdbms-server-12cR1-preinstall

Page 26: Oracle Linux and Oracle Database - A Trusted Combination

Getting Ready to Install Oracle Database

■  Other recommended packages: ▪  dstat, sysstat, wget, parted, strace, tree, xterm, xclock, unzip,

lsof

■  Easy to install using “yum” yum install dstat sysstat wget parted strace tree xterm xclock \

unzip lsof oracle-rdbms-server-12cR1-preinstall

Page 27: Oracle Linux and Oracle Database - A Trusted Combination

Getting Ready to Install Oracle

■  Create Required Groups ▪  groupadd -g 501 oinstall

▪  groupadd -g 502 dba

▪  groupadd -g 503 oper

▪  groupadd -g 504 asmadmin

▪  groupadd -g 505 asmdba

▪  groupadd -g 506 asmoper

■  Create Users ▪  useradd -u 501 -g oinstall -G dba,asmdba,asmoper,oper \

-c "Oracle Software Owner" oracle

▪  useradd -u 502 -g oinstall -G asmadmin,asmdba,asmoper \

-c "Clusterware Owner" grid

OpXonal  add  groups: •  backupdba•  dgdba•  kmdba

Page 28: Oracle Linux and Oracle Database - A Trusted Combination

Getting Ready to Install Oracle

■  READ THE ORACLE INSTALLATION GUIDE!!!! ■  Follow the pre-requisite checks/tasks!! ■  Do not install Oracle in :

▪  /home/oracle/……. ■  Oracle Installation Options

▪  Response files (silent install) ▪  Using the DBCA in the Linux GUI ▪  Using VNC ▪  Using x-windows/X11 forwarding:

—  Make sure it is enabled in SSH (/etc/ssh/sshd_config)

—  ssh –C –X oracle@kiwi01

—  Test using “xclock”

Page 29: Oracle Linux and Oracle Database - A Trusted Combination

Oracle Linux – Key File Systems ■  Large number of File Systems Supported:

▪  ext3 —  Journaling file system – Max 2TB files and 16TB file system size

▪  ext4 —  Improved ext3 – 16TB file/file system limit

▪  ocfs2 —  Clustered file system with COW, 16TB file/file system limit

▪  BTRFS —  COW file system, snapshots, rollback, compression 16EB limit

▪  vfat —  developed by MS-DOS, known as fat32, max file size 2GB

▪  Xfs ß Now the default root file system in Oracle Linux 7 —  high-performance journaling file system, 100TB limit, only x86_64

Page 30: Oracle Linux and Oracle Database - A Trusted Combination

Oracle Linux and OCFS2

■  Oracle Cluster File System (version 2)

▪  Integrated at 2.6.16 of kernel (experimental)

▪  2.6.19 – stable

▪  2.6.29 – improved

■  Free to use under GNU General Public License (GPL)

■  Supported under Oracle Linux

■  Used extensively by Oracle VM

Page 31: Oracle Linux and Oracle Database - A Trusted Combination

Oracle Linux and OCFS2

■  Does not have to be used for Clusters! ▪  Use it as a local File System and get benefits of:

—  “File Snapshots” using the “reflink”

—  It is FAST!

—  Ever wondered how OVM is creating those clones so quickly?

■  Useful Utilities: ▪  https://oss.oracle.com/~smushran/reflink-tools/

Page 32: Oracle Linux and Oracle Database - A Trusted Combination

Oracle Linux and OCFS2

DEMO  

Page 33: Oracle Linux and Oracle Database - A Trusted Combination

Quickly  clone  a  test  database  from  /u02/oradata1/QA1  to  /u02/oradata1/QA2  

Page 34: Oracle Linux and Oracle Database - A Trusted Combination

BTRFS

■  Considered by some as the “next-generation” filesystem ▪  Can handle 16EB filesystems ▪  Online grow and shrink ▪  Copy-on-write (COW) ▪  Storage Pools

Ø  subvolumes

Ø  snapshots

■  Using BTRFS snapshots does not replace backups!!!!

Page 35: Oracle Linux and Oracle Database - A Trusted Combination

BTRFS

■  General feel is not for production systems… Yet ■  Not supported by Oracle to store database files ■  Recommended to use latest UEK 3

▪  Keep up to date!

■  Other BTRFS Key Features ▪  Checksum function for integrity ▪  Transparent compression ▪  Transparent defragmentation ▪  Integrated LVM (Logical Volume Management) – RAID0/1/10/5/6

Page 36: Oracle Linux and Oracle Database - A Trusted Combination

BTRFS Example – Create Storage Pool

mkfs.btrfs –L btrfs_pool_label /dev/sdb

▪  Or if testing - do not do this in production! dd if=/dev/zero of=/btrfs_test bs=1M count=1000

losetup /dev/loop0 /btrfs_test

mkfs.btrfs –L test_btrfs_pool_label /dev/loop0

Page 37: Oracle Linux and Oracle Database - A Trusted Combination

Tip – Using blkid command

root@kiwi1-oraclekiwi-com[/]: blkid/dev/sda1: UUID="bf9d4ffc-04b1-4774-830b-bd46b02bde55" TYPE="xfs"/dev/sda2: UUID="KD0boO-PBlP-7WPR-Dbic-1O6h-ZdnL-3LXWtX" TYPE="LVM2_member"/dev/sdc1: LABEL="ASMDISK1" TYPE="oracleasm”……/dev/sdb1: UUID="d2cbf3ae-1758-408f-aaf5-403042cb4352" UUID_SUB="4c22e385-3355-4c20-932a-d1f6e3e5d959" TYPE="btrfs”……/dev/sdd1: UUID="7be9c546-9395-429a-8ff9-9c2ab466a04d" TYPE="ocfs2"/dev/mapper/ol_oel7--base-swap: UUID="60f235e7-5de1-4974-b467-709a6cebb5bf" TYPE="swap"/dev/mapper/ol_oel7--base-root: UUID="1fdfaf7f-b504-494e-85ca-d73329c7e9f2" TYPE="xfs”

Page 38: Oracle Linux and Oracle Database - A Trusted Combination

BTRFS Example – Mount Storage Pool root@kiwi1-oraclekiwi-com[/]: mount /dev/loop0 /u03root@kiwi1-oraclekiwi-com[/]: df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/ol_oel7--base-root 12G 4.9G 6.2G 44% /devtmpfs 2.0G 0 2.0G 0% /devtmpfs 2.0G 631M 1.4G 32% /dev/shmtmpfs 2.0G 9.0M 2.0G 1% /runtmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup/dev/sdb1 30G 15G 15G 51% /u01/dev/sdd1 30G 2.5G 28G 9% /u02/dev/sda1 497M 190M 308M 39% /boot/dev/loop0 1000M 32K 996M 1% /u03

root@kiwi1-oraclekiwi-com[/]: btrfs filesystem df /u03System, single: total=4.00MiB, used=4.00KiBData+Metadata, single: total=8.00MiB, used=28.00KiB

Page 39: Oracle Linux and Oracle Database - A Trusted Combination

BTRFS Example – Create subvolume

root@kiwi1-oraclekiwi-com[/]: btrfs subvolume create u03/sub1Create subvolume 'u03/sub1'

root@kiwi1-oraclekiwi-com[/]: btrfs subvolume list -a /u03ID 256 gen 6 top level 5 path sub1

root@kiwi1-oraclekiwi-com[/]: btrfs subvolume show /u03/*/u03/sub1

Name: sub1uuid: 9ad33e28-d98a-ad46-89fc-1c11de9424bbParent uuid: -Creation time: 2015-04-13 18:56:44Object ID: 256Generation (Gen): 6Gen at creation: 6Parent: 5Top Level: 5Flags: -Snapshot(s):

Page 40: Oracle Linux and Oracle Database - A Trusted Combination

BTRFS Example – Create subvolume snapshots root@kiwi1-oraclekiwi-com[/u03]: btrfs subvolume snapshot sub1 sub2Create a snapshot of 'sub1' in './sub2'root@kiwi1-oraclekiwi-com[/u03]: btrfs subvolume snapshot -r sub1 sub3Create a readonly snapshot of 'sub1' in './sub3'root@kiwi1-oraclekiwi-com[/u03]: btrfs subvolume show /u03/sub1/u03/sub1Name: sub1uuid: 9ad33e28-d98a-ad46-89fc-1c11de9424bbParent uuid: -Creation time: 2015-04-13 18:56:44Object ID: 256Generation (Gen): 9Gen at creation: 6Parent: 5Top Level: 5Flags: -Snapshot(s):

sub2sub3

root@kiwi1-oraclekiwi-com[/u03]: cd sub3root@kiwi1-oraclekiwi-com[/u03/sub3]: touch testtouch: cannot touch ‘test’: Read-only file system

Page 41: Oracle Linux and Oracle Database - A Trusted Combination

Are you using Oracle RAC and ASM

Need  a  shared  filesystem?  

Page 42: Oracle Linux and Oracle Database - A Trusted Combination

What about ACFS…… ■  Making use of underlying ASM disk groups ■  Oracle ASM is required ■  Easy to configure using “asmca” ■  Files that can be stored direct in ASM are not supported on

ACFS….. prior to 12c… ▪  From 12.1 database files allowed in ACFS! ▪  COMPATIBLE.ADVM must be set to 12.1

■  Ensure Oracle Linux Kernel used, is supported! ▪  ACFS OS Support Certification Matrix - Doc ID 1369107.1 ▪  PSU might be required to enable

■  ACFS features include: ▪  Dynamic file system resizing ▪  Snapshots using copy-on-write

Page 43: Oracle Linux and Oracle Database - A Trusted Combination

Setting up Disks for ASM

■  The quick and easy way: ▪  ASMLib kernel driver part of UEK ▪  Install ASMLib software (rpm)

—  oracleasm-support —  oracleasmlib

–  http://www.oracle.com/technetwork/server-storage/linux/asmlib

▪  Creating ASM Disks: —  Present Storage —  Partition Disk —  Run “oracleasm configure –i” —  Create ASM disks: oracleasm createdisk (as root user)

oracleasm createdisk ASMDISK1 /dev/sdd1—  List ASM disks: oracleasm listdisks —  As Grid owner, run “asmca” to create disk groups or use SQL*Plus

Page 44: Oracle Linux and Oracle Database - A Trusted Combination

Linux Performance Monitoring

■  Swap space ▪  Don’t look at 2 x memory ▪  If using swap space:

—  Review and understand why you are using swap

—  Review “free” command and /proc/meminfo

■  Useful Commands: ▪  sar ▪  vmstat ▪  Iostat ▪  iotop

■  Want to look at more detail: ▪  dtrace and strace

Page 45: Oracle Linux and Oracle Database - A Trusted Combination

Linux Performance Monitoring

DEMO  

Page 46: Oracle Linux and Oracle Database - A Trusted Combination

top,  sar,  vmstat,  iostat,  watch

Page 47: Oracle Linux and Oracle Database - A Trusted Combination

Backup and Recovery

■  Does not have to be complex ■  3rd Party vendor backup solutions

▪  Linux agents available ■  Easier with Virtualization

▪  Snapshot / Clone options ▪  Live migration options

■  Use RMAN!! ■  Backup to Tape or Disk? ■  Why not use reflink and snapshots?

▪  Not on its own, but together with tools such as —  tar, cpio, rsync, gzip, etc

Page 48: Oracle Linux and Oracle Database - A Trusted Combination

Backup and Recovery

■  Useful Linux Commands: ▪  tar ▪  cpio ▪  rsync ▪  gzip

■  Examples:

tar czvf /backups/backupfile.tar.gz .tar xzvf /backups/backupfile.tar.gz

[/home/oracle]: cd /u02/oradata1[/u02/oradata1]: tar cf - | (cd /u02/oradata2; tar xf -)[/u02/oradata1]: find . -print | cpio -pdm /u02/oradata2/

Page 49: Oracle Linux and Oracle Database - A Trusted Combination

Tip - Don’t forget about Data Recovery Advisor

■  Introduced in Oracle 11g ■  Three key commands:

rman> LIST failure

rman> ADVISE failure

rman> REPAIR failure

■  Not available when using Multi-tenancy - CDB/PDB

▪  Expected in 12.2

Page 50: Oracle Linux and Oracle Database - A Trusted Combination

Recommended Reading

Oracle  Linux  7  DocumentaXon   h`ps://docs.oracle.com/cd/E52668_01/index.html Supported  and  Recommended  File  Systems  on  Linux   (Doc  ID  236826.1) List  of  Files  Systems  Supported  in  Oracle  Linux  7   (Doc  ID  1970430.1) Unbreakable  Enterprise  Kernel:  Frequently  Asked  QuesXons  (Doc  ID  1210995.1)

Page 51: Oracle Linux and Oracle Database - A Trusted Combination

Summary

■  Are you looking for an operating system that provides: ▪  Stability ▪  Performance ▪  Scalability ▪  Security ▪  Flexibility

Do  not  be  scared  of  the  command  line  

Page 52: Oracle Linux and Oracle Database - A Trusted Combination

Final Comments…

Page 53: Oracle Linux and Oracle Database - A Trusted Combination

Questions?

Presented By: Anton Els Company: Dbvisit Software Limited Email: [email protected] Twitter: @aelsnz Blog: http://blog.dbvisit.com/author/anton-els/