Saturday, November 1, 2025

Database 26ai Installation Guide

 Database 26ai Installation Guide


In this topic, I explain two new and important steps when installing Oracle new versions as 26ai:


Setting Clock Source for VMs on Linux x86-64

Oracle recommends that you set the clock source to tsc for better performance in virtual

environments (VM) on Linux x86-64.


As the root user, check if the tsc clock source is available on your system.

# cat /sys/devices/system/clocksource/clocksource0/available_clocksource

kvm-clock tsc acpi_pm

If the tsc clock source is available, then set tsc as the current clock source.

# echo "tsc">/sys/devices/system/clocksource/clocksource0/

current_clocksource

Verify that the current clock source is set to tsc.

# cat /sys/devices/system/clocksource/clocksource0/current_clocksource

tsc

Using any text editor, append the clocksource directive to the GRUB_CMDLINE_LINUX line in

the /etc/default/grub file to retain this clock source setting even after a reboot.

GRUB_CMDLINE_LINUX="rd.lvm.lv=ol/root rd.lvm.lv=ol/swap rhgb quiet

numa=off transparent_hugepage=never clocksource=tsc"

Run the following command to update GRUB and ensure that these settings are retained

even after a reboot:

# grub2-mkconfig -o /boot/grub2/grub.cfg


Setting Transparent HugePages to madvise

Transparent HugePages memory is enabled by default with Oracle Linux. 


📕However, for optimal

performance, Oracle recommends that you set Transparent HugePages to madvise on all

Oracle Database servers UEK7 and later kernels and not disable Transparent HugePages as

was recommended in prior releases.👈


If you install Oracle Database Preinstallation RPM, then it sets Transparent HugePages to

madvise on all Oracle Database servers UEK7 and later kernels.


To set madvise on Transparent HugePages:


For Oracle Linux and Red Hat Enterprise Linux, add or modify the

transparent_hugepage=madvise parameter in the /etc/default/grub file:

GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet

transparent_hugepage=madvise"

GRUB_DISABLE_RECOVERY="true"

Note:

The file name may vary depending on your operating system and hardware. For

example, on Oracle Cloud Infrastructure (OCI) the grub.cfg file is located at /boot/efi/EFI/redhat/. 

Check your operating system documentation for the exact file name.


Run the grub2–mkconfig command to regenerate the grub.cfg file.

On Oracle Linux 8

# grub2-mkconfig -o /boot/grub2/grub.cfg

On Oracle Linux 9

grub2-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdline

Restart the system to make the changes permanent. If you do not want to restart your

system, then enter the following command:

# echo madvise >

/sys/kernel/mm/transparent_hugepage/enabled

To check if Transparent HugePages is enabled and configured with madvise, run one of

the following commands as the root user:

Oracle Linux kernels:

# cat /sys/kernel/mm/transparent_hugepage/enabled

Red Hat Enterprise Linux kernels:

# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled

The following is a sample output that shows Transparent HugePages is being used and set

to madvise.

always [madvise] never


What is THP:

Transparent HugePages (THP) is a Linux kernel feature that automates the use of large memory pages (typically 2MB instead of the standard 4KB) to improve memory management efficiency and application performance. Here’s a breakdown of what it is and why Oracle 26ai recommends setting it to `madvise`:


What Are Transparent HugePages?

Purpose: THP reduces overhead in memory management by using larger memory pages, which means fewer pages to track and manage.

Benefit: This can lead to better performance for applications with large memory footprints, like Oracle databases.

Modes:• `always`: Kernel tries to use hugepages for all memory allocations.

• `madvise`: Kernel uses hugepages only when applications explicitly request them via the `madvise()` system call.

• `never`: THP is disabled entirely.


Why Oracle 26ai Recommends `madvise` on UEK7+

Oracle previously advised disabling THP due to performance unpredictability and latency spikes. However, with improvements in UEK7 (Unbreakable Enterprise Kernel version 7) and later:


Improved THP behavior: Kernel enhancements have made THP more stable and predictable.


Selective usage: Setting THP to `madvise` allows Oracle to use hugepages only where beneficial, avoiding the downsides of `always` mode.


Oracle-aware optimization: Oracle Database components can now better manage memory and selectively request hugepages, leading to more consistent performance gains.


🧠 HugePages vs Transparent HugePages

Feature

HugePages (Static)

Transparent HugePages (THP)

Configuration

Manually configured by the system admin

Automatically managed by the kernel

Usage

Reserved explicitly for applications

Kernel tries to use them for anonymous memory

Control

Applications must be configured to use them

Kernel decides when to use them

Swapping

Not swappable (memory stays resident)

Can be swapped unless pinned

Performance

Predictable, stable for large memory apps

May cause latency spikes due to defragmentation

Best for

Oracle SGA, databases, performance-critical apps

General workloads, less admin overhead

Page Allocation

Static allocation at boot time

Dynamic allocation during runtime


What is `clocksource=tsc`?

The `clocksource=tsc` kernel parameter forces Linux to use the Time Stamp Counter (TSC) as the system clock source. Here’s what that means:


• TSC (Time Stamp Counter) is a CPU register that counts cycles since reset. It’s fast and low-overhead.


By default, Linux chooses the most stable and precise clock source available. TSC is often preferred for performance, but only if it’s invariant (i.e., unaffected by CPU frequency scaling or power-saving modes).


Using `clocksource=tsc` can improve performance in latency-sensitive environments like databases or real-time systems, especially when:

•The hardware supports invariant TSC.

• You want consistent timing across CPUs in multi-core systems.

• You’re running Oracle or other performance-critical workloads.


💡 Why use it? It minimizes overhead and improves timestamp precision, which is crucial for Oracle diagnostics and wait event analysis.


 Why install Oracle 26ai?

Oracle Database 26ai is Oracle’s AI-first long-term support release, packed with over 300 new features. Here’s why it’s worth installing:


Key Benefits:


• AI Integration at the Core: Native support for AI vector search, bringing AI directly to your data without external systems.

• Annotations & Metadata Enhancements: Easier documentation and tracking of database objects.

• Interval Aggregation: New support for `SUM` and `AVG` on `INTERVAL` datatypes.

• Autonomous Options: Can be deployed via Autonomous DB containers or free-tier cloud options.

• Future-Proofing: It’s the next long-term release after 19c, meaning extended support and stability for years.


Ideal Use Cases:

• AI-powered analytics

• High-performance transactional systems

• Cloud-native or hybrid deployments

• Modernizing legacy Oracle environments



Alireza Kamrani 

Thursday, October 30, 2025

Oracle Data Pump enhancement

🚀 Take Control of Oracle Data Pump Imports with New Enhancements! ORACLE AI Database

Oracle Data Pump just got even more powerful, making migrations to Oracle Autonomous Database (ADB) or on-premises smoother, faster, and more flexible.
Here are some key highlights

Smarter Control and Compression
• Specify index compression on import using
TRANSFORM=INDEX_COMPRESSION_CLAUSE:COMPRESS ADVANCED LOW
• Fine-tune space usage and performance during migrations.

Flexible Object Inclusion
• Include/exclude objects in the same export or import job: expdp hr DIRECTORY=dpump_dir1 DUMPFILE=exp%u.dmp SCHEMAS=hr,oe INCLUDE=table EXCLUDE=statistics
• The INCLUDE parameter runs first, then EXCLUDE removes specific objects.

Simplified Cloud Imports
Import from Oracle Object Storage directly to ADW / ATP (Shared or Dedicated) with parallelism, transforms, and object-level control.

Performance & Parallelism
• Use PARALLEL=n for inter-table and intra-table parallelism
• Parallelize TTS metadata operations, resume jobs, and import JSON natively
• Optimize with accurate DBMS_STATS gathering before and after operations

Compression, Security, and Efficiency
• Use COMPRESSION=ALL and COMPRESSION_ALGORITHM=MEDIUM for balanced performance
• Verify data integrity with Data Pump checksum (21c and above)
• Import over database links — no dumpfiles required!

Best Practices for Autonomous Database
• Use SCHEMA or TABLE mode exports for ADB
• Set proper STREAMS_POOL_SIZE and MAX_DATAPUMP_JOBS_PER_PDB
• Prefer SecureFile LOBs for parallel I/O and compression
• Use AL32UTF8 character set for maximum compatibility

Bottom line:
Oracle Data Pump continues to evolve with every release, offering more control, scalability, and efficiency for your migrations. Whether you’re moving to Oracle Cloud or optimizing on-premises, following these best practices will make your Data Pump jobs smoother and faster.

Wednesday, October 29, 2025

Oratop utility, A power tool for DBA

 oratop Command in Oracle


    • Alireza Kamrani


Overview

The oratop command is a real-time Oracle database performance monitoring tool — similar to the Linux top command, but designed specifically for Oracle Database environments. It provides a dynamic, continuously refreshing view of key performance metrics at the instance, session, and SQL levels, making it an essential utility for DBAs who need quick situational awareness without the overhead of complex diagnostics tools like Enterprise Manager.


Details:

Tool name: oratop

Purpose: Real-time performance monitoring for Oracle Database

Source: Developed by Oracle Support (MOS script)

Availability: Downloadable from My Oracle Support (MOS Note 1500864.1)

Supported Versions: Oracle Database 11g and higher (including 19c and 23ai)


Installation & Setup:

oratop is a Perl-based script that connects to the database through SQL*Plus.

You can download it from My Oracle Support (MOS Note 1500864.1).


Steps:

         1. Download the latest version (oratop_latest.zip) from MOS.

         2. Unzip the file:

unzip oratop_latest.zip

3. Make it executable:

chmod +x oratop

4. Ensure sqlplus is in your PATH and environment variables (ORACLE_HOME, ORACLE_SID) are set.


Usage Examples


Local connection:

oratop / as sysdba

Remote connection:

oratop user/password@tns_alias

For RAC:

oratop /@service_name inst#

Example: oratop /@orcl1 2


Interface Overview

Once launched, oratop displays a refreshing console interface divided into several sections:

1. Header Section — Instance summary (database name, version, uptime, load, sessions, wait classes)

2. Activity Section — Real-time CPU, session count, I/O, TPS

3. Top Sessions / SQL Section — SID, username, SQL ID, event, CPU, I/O usage


Interactive commands:

s – Session view

i – Instance summary

q – Quit


Common Options

oratop / as sysdba 5 10 → Refresh every 5 seconds, 10 iterations

-f → Flat file mode (output to text)

-n → Non-interactive batch mode

-i → Instance number for RAC

-a → Display all RAC instances

-h → Help and usage options


Example Output:

oratop:  Release 15.0 Oracle 19.18.0.0.0

DBNAME  INST_ID  HOST  UP: 3 days  Load: 2.3

CPU: 85% Busy  IO: 15% Wait  Sess: 120  Active: 12


Event: "log file sync"               Waits: 123/s

Event: "db file sequential read"     Waits: 98/s


Top Active Sessions:

SID  USERNAME SQL_ID EVENT                      CPU%  WAIT%

123  APPUSER 2gq1b78xj..  db file sequential read     30    20

345  SYS     5j3fkw2h9..  log file sync     25    15


Licensing and Benefits

oratop does not require the Oracle Diagnostic Pack license since it uses only standard dynamic performance views (v$, gv$). It is safe for production environments.


Benefits:

• Lightweight and agentless

• Real-time performance visibility

• RAC-aware monitoring

• Ideal for quick triage

• Customizable refresh and filters


Summary Table

Feature

Description

Type

Command-line real-time monitor

Language

Perl

Connection

SQL*Plus

Supports RAC

Yes

License

Free (no Diagnostic Pack needed)

Best for

Quick real-time instance and session performance analysis


Conclusion

oratop is an essential command-line tool for Oracle DBAs who need immediate insights into system performance without heavy GUI overhead. It bridges the gap between command-line simplicity and Enterprise Manager’s diagnostic depth — empowering database administrators to act fast, diagnose bottlenecks, and maintain high system performance.

Monday, October 27, 2025

About Consistent and Inconsistent RMAN Backups

Use the RMAN BACKUP command to create both consistent and inconsistent backups.

The RMAN BACKUP command supports backing up the following types of files:

  • Data files and control files
  • Server parameter file
  • Archived redo logs
  • RMAN backups

Although the database depends on other types of files, such as network configuration files, password files, and the contents of the Oracle home, you cannot back up these files with RMAN. Likewise, some features of Oracle Database, such as external tables, may depend upon files other than the data files, control files, and redo log. RMAN cannot back up these files. Use general-purpose backup software such as Oracle Secure Backup to protect files that RMAN does not support.

When you execute the BACKUP command in RMAN, the output is always either one or more backup sets or one or more image copies. A backup set is an RMAN-specific proprietary format, whereas an image copy is a bit-for-bit copy of a file. By default, RMAN creates backup sets.

 

About Consistent RMAN Backups

A consistent backup occurs when the database is in a consistent state. You can use the BACKUP command to make consistent backups of the database.

A database is in a consistent state after being shut down with the SHUTDOWN NORMAL, SHUTDOWN IMMEDIATE, or SHUTDOWN TRANSACTIONAL commands. A consistent shutdown guarantees that all redo has been applied to the data files. If you mount the database and make a backup at this point, then you can restore the database backup later and open it without performing media recovery. 

.But you will, of course, lose all transactions that occurred after the backup was created.

 

About Inconsistent RMAN Backups

Any database backup that is not consistent is an inconsistent backup. A backup made when the database is open is inconsistent, as is a backup made after an instance failure or SHUTDOWN ABORT command.

When a database is restored from an inconsistent backup, Oracle Database must perform media recovery before the database can be opened, applying changes from the redo logs that took place after the backup was created.

Note:

RMAN does not permit you to make inconsistent backups when the database is in NOARCHIVELOG mode. If you employ user-managed backup techniques for a NOARCHIVELOG database, then you must not make inconsistent backups of this database.

If the database runs in ARCHIVELOG mode, and you back up the archived redo logs and data files, inconsistent backups can be the foundation for a sound backup and recovery strategy. Inconsistent backups offer superior availability because you do not have to shut down the database to make backups that fully protect the database.

 

About Online Backups and Backup Mode

You can create RMAN backups or user-managed backups.

When performing a user-managed backup of an online tablespace or database, an operating system utility can back up a data file at the same time that the database writer (DBWR) is updating the file. It is possible for the utility to read a block in a half-updated state, so that the block that is copied to the backup media is updated in its first half,

 

while the second half contains older data. This type of logical corruption is known as a fractured block, that is, a block that is not consistent with an SCN. If this backup must be

restored and the block requires recovery, then recovery fails because the block is not usable.

 

For third-party snapshot technologies, you must use one of the following techniques to eliminate the risk of creating fractured blocks:

  • Ensure that the snapshot technology complies with Oracle requirements for online backups
  • Take the database or data files offline
  • Place the database in backup mode before using a third-party snapshot backup

The RECOVER…SNAPSHOT TIME method of recovering a database to a point in time using a particular snapshot is desupported in Oracle AI Database 26ai.

Instead of RECOVER…SNAPSHOT TIME, Oracle recommends that you use ALTER DATABASE BEGIN/END BACKUP before and after creating the storage snapshot of the data files and then use RECOVER …. UNTIL TIME to a specific timestamp or system change number (SCN) after the END BACKUP completion time. Oracle recommends that ALTER DATABASE BEGIN/END BACKUP always be used when performing snapshots on a running database to ensure data recovery integrity. Archived log redo logs must be separately backed up and restored for recovery operations.

Unlike user-managed tools, RMAN does not require extra logging or backup mode because it knows the format of data blocks. RMAN is guaranteed not to back up fractured blocks. During an RMAN backup, a database server session reads each data block and checks whether it is fractured by comparing the block header and footer. If a block is fractured, then the session rereads the block. If the same fracture is found, then the block is considered permanently corrupt. Also, RMAN does not need to freeze the data file header checkpoint because it knows the order in which the blocks are read, which enables it to capture a known good checkpoint for the file.

About Backup Sets

When you execute the BACKUP command in RMAN, you create one or more backup sets or image copies. By default, RMAN creates backup sets regardless of whether the destination is disk or a media manager.

Note:

Data file backup sets are typically smaller than data file image copies and take less time to write.

 

Ø  how RMAN can take a consistent backup of a running (open) database even when heavy DML is happening??

 

1. Key idea — “Consistent image through SCN”

Every Oracle block (in datafiles, undo, etc.) carries a System Change Number (SCN) — a monotonically increasing version stamp of the database at that moment.
RMAN uses these SCNs to guarantee that every block in the backup reflects a consistent point in time (a checkpoint-consistent image).

When you run:

BACKUP DATABASE;

on an open database, RMAN is really performing an online (hot) backup, meaning users can continue DMLs (INSERT, UPDATE, DELETE, COMMIT).

 2. RMAN works with read-consistent block images

When RMAN reads a block from a datafile:

  • If that block has already been modified after the backup started (its SCN > backup checkpoint SCN),
  • RMAN does not use that dirty block directly,
  • Instead, it asks Oracle’s block recovery mechanism (via the DBWR and redo apply engine) to reconstruct the block image as of the backup SCN using the redo + undo information.

This is done by Oracle’s “read-consistent block” mechanism.

So, each block RMAN writes to the backup set is the version that was valid at the backup’s checkpoint SCN — even if users were modifying it at that very moment.

3. How redo logs ensure recoverability

During online backup:

  • Oracle continuously writes redo entries for all DMLs.
  • RMAN keeps track of the lowest SCN of all datafile backups (the checkpoint SCN) and also ensures all redo up to that SCN is included in the backup.

So, when you later restore and recover:

1.      RMAN restores the datafiles from the backup sets (consistent as of checkpoint SCN).

2.      Then applies archived + online redo logs to bring the database forward to the desired point in time (for example, until last committed transaction).

4. Backup checkpoint concept

Each datafile backup has a checkpoint SCN (start/end):

  • Checkpoint SCN = point in time that file content is consistent with.
  • RMAN records these in the controlfile and catalog.

During restore:

  • Oracle uses these SCNs to know which redo must be applied to make all files consistent with each other.

5. Internal protection (CKPT, LGWR, DBWR, SMON)

Internally:

  • CKPT updates headers with checkpoint SCNs.
  • DBWR writes dirty buffers to disk regularly.
  • LGWR ensures redo is flushed before commit.
  • SMON coordinates instance recovery if needed.

RMAN leverages all of this to maintain backup consistency — it does not “freeze” datafiles, but logically guarantees consistency via SCN management and redo.

6. Summary – The consistency triangle

Component

Role

Purpose

SCN

Global timestamp

Defines backup consistency point

Redo

Transaction log

Replays changes to make blocks consistent

Undo

Old versions

Used to reconstruct consistent read image

RMAN

Orchestrator

Reads blocks, manages checkpoint SCNs, invokes kernel consistency logic

7. Example of timeline

T1: RMAN begins backup, notes checkpoint SCN = 1000

T2: User commits a transaction (SCN 1005)

T3: RMAN reads block that was updated at SCN 1005

     -> Oracle reconstructs block as it was at SCN 1000

T4: RMAN writes the consistent block to backup set

So final backup is a point-in-time image as of SCN 1000, even though DML continued during the backup.

8. Notes:

  • This mechanism is much safer than user-managed hot backups (which require BEGIN/END BACKUP mode).
  • Works only in ARCHIVELOG mode.
  • RMAN uses block-level media recovery and backup optimization to minimize overhead.

Oracle Database Performance: Avoiding Unnecessary Table Scans

Oracle Database Performance: Avoiding Unnecessary Table Scans One of the common recommendations in database performance tuning is to avoid...