Best Practices For Oracle On HPUX: Sandy Gruver Senior Technical Consultant HP/Oracle Advanced Technology Center
Best Practices For Oracle On HPUX: Sandy Gruver Senior Technical Consultant HP/Oracle Advanced Technology Center
Oracle on HPUX
Sandy Gruver
Senior Technical Consultant
HP/Oracle Advanced Technology Center
[email protected]
December 8, 2021 2
Before Installing
Oracle on HPUX
December 8, 2021 3
Brief review
HPUX SysAdm tool - SAM
December 8, 2021 4
H/W and S/W requirements
Overall system requirements
• Operating System
− HPUX 11.0 and HPUX 11i.
− Oracle 9i onward is only available for 64 bit HPUX
• S/W requirements
− Any X server supported by the UNIX system
− Need to have ar, cc and ld under /usr/ccs/bin
− Need to have Java make installed
• Physical Memory
− Minimum 256 MB for 9i Server (as per release notes). Suggested to
have around 4 GB or more
• Swap Space
− Twice the amount of physical Memory or Minimum 400 MB
• Disk Space
− Approx 3 GB for Database S/W and additional space for seed database
etc.
December 8, 2021 5
H/W and S/W requirements
Patches are extremely important
• Install the necessary HP-UX patches
− Listed in the Oracle Installation Guide
− For patch bundles:
• http://www.software.hp.com/SUPPORT_PLUS
− For individual patches:
• http://itresourcecenter.hp.com
− To check on patches:
− $ /usr/sbin/swlist -l patch
− $ /usr/sbin/swlist -l patch patch_number
− $ /usr/sbin/swlist -l bundle
• Increase /tmp space to at least 2GB
• Modify Kernel parameters for Oracle
December 8, 2021 6
Enhancing performance of Oracle
enable Sched_Noage
As root, create the file /etc/privgroup
dba MLOCK (for asynch IO)
dba RTSCHED RTPRIO (for priority scheduling)
Issue the commands:
# /usr/sbin/setprivgrp -f /etc/privgroup
# /usr/sbin/getprivgrp dba
Set the HPUX_SCHED_NOAGE Oracle initialization
parameter
− On HP-UX 11.0, the range is 153 to 255
− On HP-UX 11i, the range is 178 to 255
December 8, 2021 7
Oracle Users and Groups
1. Create UNIX groups (oinstall, dba)
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
• ORACLE_HOME
e.g. export ORACLE_HOME=/oracle/9i_64b
• ORACLE_SID
e.g. export ORACLE_SID=oratest
• PATH
e.g. export PATH=$ORACLE_HOME/bin:$PATH
• SHLIB_PATH/LD_LIBRARY_PATH
e.g.
export LD_LIBRARY_PATH=$ LD_LIBRARY_PATH:$ORACLE_HOME/lib64
December 8, 2021 9
File and Directory Setup tasks
• Set the home directory of user oracle to
− $ORACLE_OWNER $HOME directory*
• Set the default shell to /bin/sh for the Bourne shell
• In the .profile, set
− umask 022
− xhost +
• Check the Oracle Inventory information after installation
# more /var/opt/oracle/oraInst.loc
inventory_loc=/u01/app/oracle/oraInventory
inst_group=oinstall
* See simplified OFA later in presentation
December 8, 2021 10
Implementing Asynchronous I/O
NOTE: Done ONLY if using RAW (not fs) storage
December 8, 2021 11
Implementing Asynchronous I/O
December 8, 2021 12
Recommended
Kernel parameter
settings for Oracle
December 8, 2021 13
HP-UX Kernel Settings for Oracle DBs
• Specified in the documentation for Oracle
• See “Oracle Database Installation Guide”
• To list all kernel parameters
$ /usr/sbin/kmtune –l |more
Or use SAM
• To check 32 or 64 bit HP-UX 11.x
$ /bin/getconf KERNEL_BITS
$ 64
• To check 32 or 64 bit Oracle software version
$ cd $ORACLE_HOME/bin
$ file oracle
$ oracle: ELF-64 executable object file - PA-RISC 2.0 (LP64)
December 8, 2021 14
Recommended Minimum
HP-UX Kernel Settings for Oracle DBs
File System buffer-Cache Parameters:
bufpages Pages of static buffer cache – older 0
parm
dbc_max_pct Max dynamic buffer cache between 3 and 10 % of
memory
dbc_min_pct Min dynamic buffer cache between 2 and 5% of
memory
Open or Locked Files Parameters:
December 8, 2021 16
Recommended Minimum
HP-UX Kernel Settings for Oracle DBs
Parameters for Process Management:
maxdsiz Max process data seg size 1073741824 bytes or
for 32bit procs (0x40000000)
maxdsiz_64bit Max process data seg size 2147483648 bytes or
for 64bit procs (0x80000000)
maxssiz Max process storage seg 134217728 bytes
size for 32bit procs
maxssiz_64bit Max process storage seg 1073741824 bytes or
size for 64bit procs (0x40000000)
maxtsize Max process text seg size 128MB
maxuprc Max # of procs/user ((NPROC*9)/10)
max_thread_proc Max threads/proc 256
nkthread Max kernel threads (((NPROC * 7) / 4) + 16)
nproc Max procs/system 4096
December 8, 2021 17
Recommended Minimum
HP-UX Kernel Settings for Oracle DBs
InterProcessCommunication Message Parameters:
msgmap Message map size (2+msgmni)
msgmni Max msg queues nproc
msgseg # segs in msg queue 32767
msgtql Total msgs on system nproc
December 8, 2021 18
Recommended Minimum
HP-UX Kernel Settings for Oracle DBs
InterProcessCommunication Shared Memory Parameters:
shmmax Max shared memory Large enough to hold the entire
segment SGA in one shared memory
segment
shmmni Max segments/system 512
shmseg Max segments/proc 120 per Oracle database
Miscellaneous Parameters:
December 8, 2021 19
Updating Kernel Parameters
OR Use SAM
Edit /stand/vmunix
− Backup /stand/system
− Edit/modify /stand/system
− config /stand/system
? Check that it created
vmunix_test in local directory
− Backup /stand/vmunix
− mv /stand/vmunix_test
/stand/vmunix
− shutdown -r
December 8, 2021 20
Using WLM with
Oracle and HPUX
partitions
December 8, 2021 21
HP Virtual Server Environment:
server resource flexing for applications
Policy engine
provisions server resource pool
resources based on
SLOs and business security
priorities
for each
application.
Oracle Reporting
Apps
December 8, 2021 22
HP Partitioning Continuum
Clustered nodes Hard partitions Virtual partitions Resources partitions
nPar vPar PRM/pSets
hard 1 OS image
OS image OS
Application n
with HW image with guaranteed
with SW
isolation compute
isolation resources
December 8, 2021 24
HP-UX Virtual Partitions
• Why choose vPars over nPars?
Multiple HP-UX instances − vPars provides:
running on the same system or • Dynamic processor movement
without rebooting the partition
in the same nPar • Single cpu granularity
• Can run within an nPar
Dept. A Dept. A Dept. B Dept. B
App 1
HP-UX
App 1’
HP-UX
App 2
HP-UX
App 3
HP-UX
• Why choose vPars over
Revision Revision Revision Revision resource partitions?
A.1 A.2 B.3 B.3
− vPars provides:
• Software fault isolation
• Different versions of the OS
• Application isolation
December 8, 2021 27
File system Options
Using Online JFS improves performance
• Set these mount options
− delaylog
− nodatainlog
− mincache=direct
− convosync=direct
• Enabling largefiles with Online JFS
# fsadm -F vxfs -o largefiles /filesystem
December 8, 2021 28
Oracle db_block_size
• The default Oracle db_block_size on HP-UX is 2048.
• We recommend using:
− db_block_size = 8192 for OLTP Applications
− db_block_size = 8192 to 16384 for DSS/DW Applications
• LVM designed for 8192 blocksize
• Oracle RAC may benefit from a smaller
db_block_size to reduce the amount of data to transfer
between the nodes for cache fusion
• Must be set when creating database
December 8, 2021 29
Data Storage Format
Raw or File System?
December 8, 2021 30
Oracle mapping to LVM
December 8, 2021 31
Space Layout
File System Raw
FS overhead
Oracle Oracle
Data Data
FS file
Logical Volume
Oracle
Data
FS file Oracle
Data
Logical Volume
empty space
Logical Volume
December 8, 2021 32
“Raw” vs. File System
some common misconceptions
PERCEPTION FACT
• Raw requires ugly low- • Raw uses LVM just like
level UNIX commands. file systems.
• Need rocket scientists to • If you manage a FS you
understand & manage. already manage raw.
December 8, 2021 33
Database Administration Example
preparing to create a database
December 8, 2021 34
Database Administration Example
define oracle data commands
CREATEDB: CREATEDB:
STARTUP NOMOUNT STARTUP NOMOUNT
CREATE CONTROLFILE CREATE CONTROLFILE
… …
DATAFILE DATAFILE
'/ora1/data01.dbf' '/dev/vg9idata/rdata01_2000M.dbf'
December 8, 2021 35
Database Administration Example
typical database tasks
MONITOR SPACE
FS: OEM + bdf RAW: OEM
• RMAN & (Storage Data Protector) • RMAN & (Storage Data Protector)
• fbackup • dd
• tar or cpio or dd • optionally pipe to compress
• optionally pipe to compress
December 8, 2021 37
Summary
Raw-based Databases on HP-UX
December 8, 2021 38
Storage Layout
Recommendations
December 8, 2021 39
Storage technology
then vs. now
then now
disk size 1 0 0 -5 0 0 MB 1 0 0 -5 0 0 GB
a rchitecture JBO D RAID a rra ys
on-boa rd ca che none/ tiny la rge
‘a spindle’ one disk a rra y group?
December 8, 2021 40
The usual database layout
• sort database objects by size and expected I/O volume
• implement high-volume objects in striped volumes
with various stripe-widths
• squeeze other objects in where they fit
• monitor performance of individual disks and objects
• play ‘chess’ with file placement to find best
performance
December 8, 2021 41
‘SAME’ technique
(proposed by Oracle’s Juan Loaiza)
• keep it simple
December 8, 2021 42
SAME advantages
December 8, 2021 43
SAME modified for large storage arrays
December 8, 2021 44
Oracle data organization
tablespace
• Objects & Tables
− data, index, etc
tables/o
bjects ‘logical’
• Tablespaces
• Files
− map to space at OS level
file file file file ... ‘physical’
December 8, 2021 45
Oracle mapping to LVM
December 8, 2021 46
EXAMPLE: PV mapping to a disk array
PV mapping to the hp xp array
tablespace tablespace tablespace
oracle
LV LV LV LVM
PV PV PV PV PV vol. grp.
... array
L L L L L L L L L
U UU U U U U UU
N NN N N N N NN
Array (RAID) Array (RAID) Array (RAID)
group
December 8, 2021
group group 47
Implementing SAME
December 8, 2021 48
Implementing SAME
• create LVs using LVM ‘extent striping’
− use 4MB or 8MB extents
December 8, 2021 49
Special Considerations
for Oracle Redo Logs
December 8, 2021 50
Monitor performance & balance I/O
December 8, 2021 51
EXAMPLE: Performance advisor/xp
monitors
• LDEV I/O
• port utilization
• internal bus
utilization
• cache usage
December 8, 2021 52
Optimal Simplified Architecture
a variation on OFA*
The Optimal Simplified Architecture (OSA) recommends three
main directories:
December 8, 2021 54
Optimal Simplified Architecture
Performance Benchmark
December 8, 2021 55
Summary
• stripe everything
equally& simply
• use broad stripe size to
balance overall I/O
• add capacity in broad
stripeset units
• implement using OSA
• monitor performance to
ensure balance
December 8, 2021 56
Backup and
Recovery best
practices
December 8, 2021 57
HP Recommends
• Use standard tools utilizing HP’s Data Protector (DP) and Oracle’s
Recovery Manager (RMAN)
• Define standard backup/recovery processes utilizing standard tools
• Clearly identify support organization’s roles and responsibilities
for database backup and recoveries
• Simplify/standardize backup/recovery procedures
• The overall goal is to reduce support costs
December 8, 2021 58
HP OpenView Storage Data Protector 5.1
Features
December 8, 2021 59
Newest features in Data Protector 5.1
Enhanced functional capabilities for more control:
• Easy to use Oracle restore GUI allowing administrators to select all
or individual RMAN restore options
• Simplified SAN auto-configuration wizard automatically detecting
and configuring the backup drives in the SAN
December 8, 2021 60
Data Protector (Omniback)
service-driven management approach
enterprise-wide protection
management
• simple GUI
December 8, 2021 61
data protector automates scheduling & replication of
images to optimize storage capacity
11:55 a.m.
midnight
time incident
12 hours
recovery image
on tape
December 8, 2021 62 62
Page
EXAMPLE: Oracle9i Backup
using Data Protector with Business Copy on HP storage
1. Running Environment
S “Zero Downtime
Backup”
2. Backup
S S
T T
• Freeze point in time on the disks and split the mirror • Resynchronize the mirror
• Unfreeze the disks and perform backup from the mirror
December 8, 2021 63
EXAMPLE: Oracle9i RAC Restore
using Data Protector with Business Copy on HP storage
S S
T T
S S
T T
December 8, 2021 64
Restoring the data takes time
Instant
Recovery
tape
backup
December 8, 2021 65
Data Protector - Instant Recovery
A new approach
December 8, 2021 66
Data Protector - Instant Recovery
How to use it
December 8, 2021 68
Maintain Version on Disk only
tape
December 8, 2021 69
data protector
breaks the link between data protector
disk-based protection and tape instant recovery
administrators can choose
- disk-only protection, management
- tape-only protection, or system
- scheduled combinations application backup device
depending on the business need server server
of mirrors
December 8, 2021 71
RMAN vs. OS Backup
December 8, 2021 72
RMAN/Data Protector Database Backup
and Recovery Test Results
Test setup
• 200GB test database
• backups and recoveries were done using different numbers of tape drives and RMAN channels
Results
• best database restore performance
• one channel per tape drive during the backup
• double the number of channels during the restore
Recommendation
• allocate 1 or 2 RMAN channels per tape drive to be used for the backup
• allocate twice as many RMAN channels for the recovery
December 8, 2021 73
Backup/Recovery
Suggested Responsibilities
• DBA group responsible for RMAN catalog setup and
maintenance
• DBA group responsible for contacting Backup team for
backup configuration and scheduling
• RMAN/DP Backups handled by Backup team
• Backup failures and monitoring handled by Backup team
• Recovery responsibility can be handled by DBA group (using
RMAN scripts)
• Recovery responsibility will be migrated to Backup team
(Data Protector V5.1 Oracle Restore GUI training needed in
Backup team)
December 8, 2021 74
Other backup considerations
December 8, 2021 75
Another option for Data Replication
Use of Quest SharePlex
December 8, 2021 76
Another option for Data Replication
Use of Quest SharePlex
SharePlex
HP- HP-
UX UX
December 8, 2021 77
Day to day Oracle
DBA hints and
best practices
December 8, 2021 78
SQLPlus Tips
simple formatting commands
SQLPlus - a command line reporting tool
$ sqlplus ‘/ as sysdba’
SQL> select table_name from dba_tables;
Report formatting commands
alter line lengths (in characters)
alter page lengths (in lines)
alter column widths and styles
suppress the display of duplicate column rows
December 8, 2021 79
SQLPlus Example
example SQL query
Give me a list of all tables with their size and tell me if they’ve
been backed up.
December 8, 2021 80
SQLPlus Example
without formatting commands
December 8, 2021 81
SQLPlus Examples setting
formatting commands
December 8, 2021 82
SQLPlus Example
with column formatting
December 8, 2021 83
SQLPlus Examples of
simple formatting commands
1. Alter line lengths
SQL> SET LINESIZE 70
2. Alter page length
SQL> SET PAGESIZE 65
3. Alter column widths and styles.
SQL> COLUMN surname FORMAT A15
SQL> COLUMN surname FORMAT A15 TRUNC
Display only the first 15 characters of the column.
SQL> COLUMN surname FORMAT A15 WRAP
Display multiple lines, splitting after the 15th character
on each line
For a list of column commands
SQL> HELP COLUMN
December 8, 2021 84
Advice for the DBA
DAILY PROCEDURES
Verify all instances are up
NIGHTLY PROCEDURES
WEEKLY PROCEDURES
December 8, 2021 86
Advice for the DBA
MONTHLY PROCEDURES
Review Fragmentation
December 8, 2021 87
Example: Hardware for a
Customer Oracle Installation
Intranet
Development Test/Integration Storage
3 Oracle Instance 4 Oracle Instances
75 Developers up to 200 Active users
redundant network
HP e-Firewall
DMZ Production Backup
1 Oracle Instance CLASS
Ru n A t tn . Fa ul t Re m ot e P ow er
Heartbeat
6000 logged-on users 100/10BaseT Segment - Dedicated Heartbeat
HP9000 L3000
application
CLASS R un Att n . Fau l t D is k A Di sk B R em ote Powe r
servers
CLASS
Ru n Att n . Faul t Remote Powe r
HP9000 2000
2x (Windows) 4x DLT
HP NetServer, LH3000r HP9000 N4000 HP9000 SD32000 HP9000 SD32000 Library
HP VirtualVault
2x 800 MHZ CPUs 8x 550 MHZ CPUs 32x 550 MHz CPUs 32 CPUs (550MHz)
2 GB Memory 16 GB Memory 64 GB Memory 64 GB Memory
CLASS R un Att n . Fau l t D is k A Di sk B R em ote Powe r
2 Giga Ethernet Cards 2 Giga Ethernet Card one partition one partition
2 Fibre Channel Cards 2x 36 GB Disk
2x 36 GB Disk
December 8, 2021 88
High Availability
for Oracle on
HPUX
December 8, 2021 89
Leading Causes of Data Loss
Software
Malfunction
14%
Human Error
Viruses
32%
7%
Natural Disasters
3%
Hardware or System
Malfunction
44%
December 8, 2021 90
HP & Oracle handle all causes of
downtime
System MC/SG or RAC on HP,
Failure Fast Restart
December 8, 2021 91
HP ServiceGuard cluster
• Non-Shared
Database
Virtual Server with virtual IP Address
• Provides 16 node
failover solution
December 8, 2021 92
HP ServiceGuard cluster
Node 2 • Balance workload after
a node failure
Pkg D • Minimize impact on
remaining nodes
Pkg E
Node 1
Node 3
Pkg A
Pkg A
Pkg F
Pkg B Pkg B
Pkg H
Pkg I
December 8, 2021 93
HP ServiceGuard Software Stack
Active Active
Oracle
Instance 1
failover
Application 2
HP HP
MC/ServiceGuard MC/ServiceGuard
Database for
Oracle
Exclusive Instance 1 Exclusive
Access Access
Application 2
Storage
December 8, 2021 94
Limits of Cold Failover Clusters
• Scalability of cluster is limited to scalability of one
server
• Load cannot be distributed across all nodes in the cluster
• Cold failover is slow, as many time consuming tasks
must be performed as part of failover
− moving and mounting logical volumes
− starting the oracle instance
− opening the data files
• After failover, the instance caches are cold introducing a
performance brownout
December 8, 2021 95
Oracle9i RAC
with SG Extension for RAC
HP ServiceGuard HP ServiceGuard
Extension for RAC Extension for RAC
Redo
Redo Redo
Redo
Redo Redo
Thread1 Thread2
December 8, 2021 96
Oracle9i RAC Architecture in Detail
Database Database
Buffer Redo Log 9i9iCache
CacheFusion
Fusion Buffer Redo Log
Cache Buffers Cache Buffers
USER
USER DBWR LGWR USER
USER DBWR LGWR
USER USER
Redo
Redo
Redo Data
Data Redo
Redo
Redo
Data
Data
Thread1 Thread2
Control
December 8, 2021 97
Monitoring your
Oracle environment
December 8, 2021 98
Monitoring with OpenView Operations
December 8, 2021 99
Monitoring with
Oracle Enterprise Manager
Reactive Proactive
Call either
HP or Oracle
for any interoperability
problem
HP and Oracle
provide coordinated
assessments and
optimization
http://www.hp.com/go/oracle
http://otn.oracle.com
http://metalink.oracle.com
December 8, 2021 105
Where to go for more information:
http://www.optimaldba.com/library.html
http://www.orapub.com/
http://searchoracle.techtarget.com/