Solaris OracleDB zone: Difference between revisions

From Lolly's Wiki
Jump to navigationJump to search
No edit summary
m (Text replacement - "[[Kategorie:" to "[[Category:")
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Kategorie:Solaris]]
[[Category:Solaris|Oracle Zone]]
=Setup Solaris server with OracleDB in a zone=
=Setup Oracle Database on a Solaris zone with CPU limit=
Our setup is a 48GB x86-Server
Our setup is a 48GB x86-Server


==Limit ZFS ARC==
==Limit ZFS ARC==
Add to /etc/system:
Add to /etc/system:
<source lang=bash>
<syntaxhighlight lang=bash>
set zfs:zfs_arc_max = <bytes as hex value>
set zfs:zfs_arc_max = <bytes as hex value>
</source>
</syntaxhighlight>


To calculate your own value:
To calculate your own value:
<source lang=bash>
<syntaxhighlight lang=bash>
# LIMIT_GB=8 ; printf "*\n** Limit ZFS ARC to %dGB\n*\nset zfs:zfs_arc_max = 0x%x\n" ${LIMIT_GB} $[${LIMIT_GB} * 1024 * 1024 * 1024]
# LIMIT_GB=8 ; printf "*\n** Limit ZFS ARC to %dGB\n*\nset zfs:zfs_arc_max = 0x%x\n" ${LIMIT_GB} $[${LIMIT_GB} * 1024 * 1024 * 1024]
*
*
Line 16: Line 16:
*
*
set zfs:zfs_arc_max = 0x200000000
set zfs:zfs_arc_max = 0x200000000
</source>
</syntaxhighlight>


==Create Zone==
==Create Zone==
Set values:
Set values:
<source lang=bash>
<syntaxhighlight lang=bash>
ZONENAME=oracle
ZONENAME=oracle
ZONEPOOL=rpool
ZONEPOOL=rpool
ZONEBASE=/var/zones
ZONEBASE=/var/zones
MAX_SHM_MEMORY=30G
MAX_SHM_MEMORY=30G
LOCKED_MEMORY=30G
MAX_PHYS_MEMORY=34G
SWAP=${MAX_PHYS_MEMORY}
NUMBER_OF_CPUS=2
NUMBER_OF_CPUS=2
</source>
</syntaxhighlight>


Create zone with
Create zone with
<source lang=bash>
<syntaxhighlight lang=bash>
zfs create -o mountpoint=none ${ZONEPOOL}/zones
zfs create -o mountpoint=none ${ZONEPOOL}/zones
zfs create -o compression=on -o mountpoint=${ZONEBASE}/${ZONENAME} ${ZONEPOOL}/zones/${ZONENAME}
zfs create -o compression=on -o mountpoint=${ZONEBASE}/${ZONENAME} ${ZONEPOOL}/zones/${ZONENAME}
Line 39: Line 42:
add dedicated-cpu
add dedicated-cpu
set ncpus=${NUMBER_OF_CPUS}
set ncpus=${NUMBER_OF_CPUS}
end
add capped-memory
set swap=${SWAP}
set physical=${MAX_PHYS_MEMORY}
set locked=${LOCKED_MEMORY}
end
end
set scheduling-class=FSS
set scheduling-class=FSS
Line 46: Line 54:
" | zonecfg -z ${ZONENAME} -f -
" | zonecfg -z ${ZONENAME} -f -


zoneadm -z ${ZONENAME} install
</syntaxhighlight>
</source>


# Enable dynamic pool service to add support for dedicated-cpus
Enable dynamic pool service to add support for dedicated-cpus:
<syntaxhighlight lang=bash>
svcadm enable svc:/system/pools/dynamic
svcadm enable svc:/system/pools/dynamic
</syntaxhighlight>


Install and boot:
<syntaxhighlight lang=bash>
zoneadm -z ${ZONENAME} install
zoneadm -z ${ZONENAME} boot
zoneadm -z ${ZONENAME} boot
zlogin ${ZONENAME} usermod -s /bin/bash root
zlogin ${ZONENAME}
</syntaxhighlight>
CPU-check:
<syntaxhighlight lang=bash>
-bash-3.2# psrinfo -pv
The physical processor has 2 virtual processors (0 1)
  x86 (chipid 0x0 GenuineIntel family 6 model 44 step 2 clock 3059 MHz)
Intel(r) Xeon(r) CPU          X5675  @ 3.07GHz
</syntaxhighlight>
==Create ZPools==
I used this paper: [http://www.oracle.com/technetwork/server-storage/solaris10/config-solaris-zfs-wp-167894.pdf]
Values are for Solaris 10.
<syntaxhighlight lang=bash>
DATABASEPOOL=dbpool
DATABASEPOOL_DATA_VDEV="mirror c1t1d0 c1t2d0"
DATABASEPOOL_ZIL_VDEV="mirror c1t3d0 c1t4d0"
REDOPOOL_NAME=redopool
REDOPOOL_DATA_VDEV="mirror c1t5d0 c1t6d0"
REDOPOOL_ZIL_VDEV="mirror c1t7d0 c1t8d0"
ARCHIVEPOOL=archivepool
ARCHIVEPOOL_DATAV_DEV="mirror c1t9d0 c1t10d0"
DB_BASEPATH=/database
DB_BLOCK_SIZE=8192
</syntaxhighlight>
<syntaxhighlight lang=bash>
zpool create ${DATABASEPOOL} ${DATABASEPOOL_DATA_VDEV} log ${DATABASEPOOL_ZIL_VDEV}
zfs create -o recordsize=${DB_BLOCK_SIZE} -o mountpoint=${DB_BASEPATH}/data ${DATABASEPOOL}/data
zfs set logbias=throughput ${DATABASEPOOL}/data
zfs create -o recordsize=${DB_BLOCK_SIZE} -o mountpoint=${DB_BASEPATH}/index ${DATABASEPOOL}/index
zfs set logbias=throughput ${DATABASEPOOL}/index
zfs create -o mountpoint=${DB_BASEPATH}/temp ${DATABASEPOOL}/temp
zfs set logbias=throughput ${DATABASEPOOL}/temp
zfs create -o mountpoint=${DB_BASEPATH}/undo ${DATABASEPOOL}/undo
zfs set logbias=throughput ${DATABASEPOOL}/undo
</syntaxhighlight>
<syntaxhighlight lang=bash>
zpool create ${REDOPOOL} ${REDOPOOL_DATA_VDEV} log ${REDOPOOL_ZIL_VDEV}
zfs create -o mountpoint=${DB_BASEPATH}/redo ${REDOPOOL}/redo
zfs set logbias=latency ${REDOPOOL}/redo
</syntaxhighlight>
<syntaxhighlight lang=bash>
zpool create ${ARCHIVEBASEPOOL} ${ARCHIVEPOOL_DATA_VDEV}
zfs create -o compression=on -o mountpoint=${DB_BASEPATH}/archive  ${ARCHIVEBASEPOOL}/archive
zfs set primarycache=metadata ${ARCHIVEBASEPOOL}/archive
</syntaxhighlight>

Latest revision as of 00:55, 26 November 2021

Setup Oracle Database on a Solaris zone with CPU limit

Our setup is a 48GB x86-Server

Limit ZFS ARC

Add to /etc/system:

set zfs:zfs_arc_max = <bytes as hex value>

To calculate your own value:

# LIMIT_GB=8 ; printf "*\n** Limit ZFS ARC to %dGB\n*\nset zfs:zfs_arc_max = 0x%x\n" ${LIMIT_GB} $[${LIMIT_GB} * 1024 * 1024 * 1024]
*
** Limit ZFS ARC to 8GB
*
set zfs:zfs_arc_max = 0x200000000

Create Zone

Set values:

ZONENAME=oracle
ZONEPOOL=rpool
ZONEBASE=/var/zones
MAX_SHM_MEMORY=30G
LOCKED_MEMORY=30G
MAX_PHYS_MEMORY=34G
SWAP=${MAX_PHYS_MEMORY}
NUMBER_OF_CPUS=2

Create zone with

zfs create -o mountpoint=none ${ZONEPOOL}/zones
zfs create -o compression=on -o mountpoint=${ZONEBASE}/${ZONENAME} ${ZONEPOOL}/zones/${ZONENAME}
chmod 700 ${ZONEBASE}/${ZONENAME}
printf "
create
set autoboot=true
set zonepath=${ZONEBASE}/${ZONENAME}
add dedicated-cpu
set ncpus=${NUMBER_OF_CPUS}
end
add capped-memory
set swap=${SWAP}
set physical=${MAX_PHYS_MEMORY}
set locked=${LOCKED_MEMORY}
end
set scheduling-class=FSS
set max-shm-memory=${MAX_SHM_MEMORY}
verify
commit
" | zonecfg -z ${ZONENAME} -f -

Enable dynamic pool service to add support for dedicated-cpus:

svcadm enable svc:/system/pools/dynamic

Install and boot:

zoneadm -z ${ZONENAME} install
zoneadm -z ${ZONENAME} boot
zlogin ${ZONENAME} usermod -s /bin/bash root
zlogin ${ZONENAME}

CPU-check:

-bash-3.2# psrinfo -pv
The physical processor has 2 virtual processors (0 1)
  x86 (chipid 0x0 GenuineIntel family 6 model 44 step 2 clock 3059 MHz)
	Intel(r) Xeon(r) CPU           X5675  @ 3.07GHz

Create ZPools

I used this paper: [1] Values are for Solaris 10.

DATABASEPOOL=dbpool
DATABASEPOOL_DATA_VDEV="mirror c1t1d0 c1t2d0"
DATABASEPOOL_ZIL_VDEV="mirror c1t3d0 c1t4d0"

REDOPOOL_NAME=redopool
REDOPOOL_DATA_VDEV="mirror c1t5d0 c1t6d0"
REDOPOOL_ZIL_VDEV="mirror c1t7d0 c1t8d0"

ARCHIVEPOOL=archivepool
ARCHIVEPOOL_DATAV_DEV="mirror c1t9d0 c1t10d0"

DB_BASEPATH=/database
DB_BLOCK_SIZE=8192
zpool create ${DATABASEPOOL} ${DATABASEPOOL_DATA_VDEV} log ${DATABASEPOOL_ZIL_VDEV}

zfs create -o recordsize=${DB_BLOCK_SIZE} -o mountpoint=${DB_BASEPATH}/data ${DATABASEPOOL}/data
zfs set logbias=throughput ${DATABASEPOOL}/data

zfs create -o recordsize=${DB_BLOCK_SIZE} -o mountpoint=${DB_BASEPATH}/index ${DATABASEPOOL}/index
zfs set logbias=throughput ${DATABASEPOOL}/index 

zfs create -o mountpoint=${DB_BASEPATH}/temp ${DATABASEPOOL}/temp
zfs set logbias=throughput ${DATABASEPOOL}/temp

zfs create -o mountpoint=${DB_BASEPATH}/undo ${DATABASEPOOL}/undo
zfs set logbias=throughput ${DATABASEPOOL}/undo
zpool create ${REDOPOOL} ${REDOPOOL_DATA_VDEV} log ${REDOPOOL_ZIL_VDEV}

zfs create -o mountpoint=${DB_BASEPATH}/redo ${REDOPOOL}/redo
zfs set logbias=latency ${REDOPOOL}/redo
zpool create ${ARCHIVEBASEPOOL} ${ARCHIVEPOOL_DATA_VDEV}

zfs create -o compression=on -o mountpoint=${DB_BASEPATH}/archive  ${ARCHIVEBASEPOOL}/archive
zfs set primarycache=metadata ${ARCHIVEBASEPOOL}/archive