In Oracle 19c, "performance tuning" is a critical aspect of database administration. Several operating system (OS) components can be tuned to optimize database performance. These components are primarily related to CPU, memory, disk I/O, and network tuning.
1. CPU Tuning
a. CPU Affinity and Scheduling
- CPU Affinity: Bind Oracle processes to specific CPUs using
taskset
(Linux) or Windows CPU affinity.
- Oracle Resource Manager (DBRM): Assign CPU percentages to database users and workloads.
- Linux Cgroups (Control Groups): Restrict Oracle database CPU usage.
Tuning Tip:
ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = 'DEFAULT_PLAN';
- This enables CPU-based workload management.
b. Process Priorities
- Set process priorities using
nice
(Linux) or Priority Boost
(Windows).
- Use the
_high_priority_processes
parameter to boost specific background processes like LGWR
and DBWR
.
Tuning Tip
(Higher Priority for Log Writer - LGWR):
ALTER SYSTEM SET "_high_priority_processes"='LGWR' SCOPE=SPFILE;
- Requires database restart.
2. Memory Tuning
a. SGA (System Global Area) and PGA (Program Global Area)
- Optimize SGA and PGA memory based on system resources.
- Use Automatic Memory Management (AMM) or Automatic Shared Memory Management (ASMM).
Tuning Tip:
ALTER SYSTEM SET MEMORY_TARGET = 8G SCOPE=SPFILE;
ALTER SYSTEM SET MEMORY_MAX_TARGET = 10G SCOPE=SPFILE;
- Controls total memory allocation dynamically.
b. HugePages (Linux)
- Enable HugePages to reduce memory overhead and increase performance.
- Enable HugePages:
-
Check HugePages Availability:
grep Huge /proc/meminfo
-
Set HugePages in
/etc/sysctl.conf
:
vm.nr_hugepages = 1024
3. Disk I/O and Filesystem Tuning
a. ASM (Automatic Storage Management) Optimization
- Use ASM for Oracle storage instead of traditional filesystems.
- Adjust ASM allocation unit size (
AU_SIZE
) for large workloads.
Tuning Tip:
ALTER DISKGROUP DATA SET ATTRIBUTE 'AU_SIZE' = '4M';
b. Filesystem Options
- Use XFS or EXT4 (Linux) or NTFS (Windows) for best performance.
- Enable Direct I/O and Asynchronous I/O.
- Linux Mount Options (`/etc/fstab`):
/dev/sdb1 /u01 ext4 defaults,noatime,nodiratime,async 0 0
- `noatime, nodiratime` improve disk I/O performance.
c. I/O Scheduler Optimization (Linux)
- Use `deadline` or `noop` scheduler for Oracle databases.
- Set Scheduler (`/etc/default/grub`):
GRUB_CMDLINE_LINUX="elevator=noop"
- Then run: `update-grub && reboot`
4. Network Tuning
a. TCP/IP Stack Optimization
- Increase default packet size for better performance.
- Linux Tuning (
/etc/sysctl.conf
):
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_window_scaling = 1
- Apply changes: `sysctl -p`
b. Oracle Net Services Optimization
- Tune SQL*Net parameters for high-performance connections.
- Optimize SQL*Net (`sqlnet.ora`):
SQLNET.SEND_TIMEOUT = 10
SQLNET.RECV_TIMEOUT = 10
5. Parallel Execution and Query Performance
a. Parallel Query Execution
- Use parallel query processing to speed up execution.
Tuning Tip:
ALTER SESSION ENABLE PARALLEL QUERY;
ALTER SESSION SET PARALLEL_DEGREE_POLICY = AUTO;
b. Adaptive Query Optimization
- Enable Adaptive Plans and Statistics in Oracle 19c.
Tuning Tip:
ALTER SYSTEM SET OPTIMIZER_ADAPTIVE_PLANS = TRUE;
ALTER SYSTEM SET OPTIMIZER_ADAPTIVE_STATISTICS = TRUE;
Conclusion
Tuning these OS components in Oracle 19c ensures better CPU utilization, memory management, disk I/O optimization, and network efficiency.
Note that the Oracle database background processes are ordinary processes to the OS environment. They have to wait for CPU services just like all other processes on the database server. The next lesson looks at the similarities between OS tuning and database tuning.