Tags

11g (3) 12c (4) 18c (2) 19c (3) ASM (3) Critical Patch (12) Dataguard (10) GRID (3) GitLab (2) Linux (11) OEM (2) ORA Errors (16) Oracle (20) RMAN (5)

Tuesday, June 16, 2026

How to create swap file

 

How to Create, Verify, and Increase Swap Space on Linux

Swap space is disk space that Linux uses as virtual memory when physical RAM is exhausted. Proper swap configuration helps improve system stability and prevents out-of-memory situations.

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

What is Swap Space?

Swap is a reserved area on disk that acts as an extension of RAM. When memory usage becomes high, inactive pages can be moved from RAM to swap, freeing memory for active processes.

Benefits of Swap

  • Prevents application crashes due to memory shortages.
  • Provides additional virtual memory.
  • Supports system hibernation (when configured appropriately).
  • Improves system stability during memory spikes.

Check Existing Swap Space

Use any of the following commands to verify current swap configuration and usage.

free -h

Check Active Swap Devices

swapon -s

cat /proc/swaps

swapon --show

Create a New Swap File

This method creates a 2 GB swap file. Adjust the size according to your requirements.

Step 1: Disable Existing Swap (if required)

swapoff -a

Step 2: Create Swap File

sudo fallocate -l 2G /swapfile

Verify file creation:

ls -lh /swapfile

Step 3: Set Correct Permissions

sudo chmod 600 /swapfile

Verify permissions:

ls -l /swapfile

Step 4: Format the File as Swap

sudo mkswap /swapfile

Step 5: Enable Swap

sudo swapon /swapfile

Step 6: Verify Swap Activation

swapon --show

or

free -h

Step 7: Make Swap Persistent After Reboot

Add the following entry to /etc/fstab:

echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab

Verify:

cat /etc/fstab

Expected entry:

/swapfile none swap sw 0 0

Increase Existing Swap Partition

Current swap size: 8GB
Target swap size: 16GB

Step 1: Disable Swap

swapoff -a

Verify:

swapon --show

No output should be displayed.

Step 2: Increase Virtual Disk Size in vCenter

Increate hard disk 1 from 64 to 90 GB

Navigate to VMware vCenter:

VM Settings
→ Hard Disk 1
→ Increase disk size

Example:

64 GB → 90 GB

Step 3: Detect New Disk Size

Check available disk space:

fdisk -l

If the new size is not visible, rescan the disk:

echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan

Run again:

fdisk -l

Step 4: Modify Partitions

Launch partition manager:

cfdisk

Existing Layout

/dev/sda3  Linux filesystem
/dev/sda4 Linux swap

Delete Existing Swap Partition

Select:

/dev/sda4

Choose:

Delete

Resize Root/Data Partition

cfdisk

Select:

/ dev/sda3  # This was a root partition which we increased on vCenter.

Choose:

Resize ==> Write

Create New Swap Partition

Use remaining free space:

New
Type → Linux swap

mkswap /dev/sda4 Setting up swapspace version 1, size = 26 GiB (27917262848 bytes) no label, UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # edit the UUID vi /etc/fstab mount -a swapon /dev/sda4 swapon --show NAME TYPE SIZE USED PRIO /dev/sda4 partition 26G 0B -2

Tuesday, May 26, 2026

ORA-800_VKTM

 

ORA-800_VKTM

 

ORA-00800: soft external error, arguments: [Set Priority Failed], [VKTM]

ORA-800_VKTM_Fix


PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

After kernel update on linux system you get ORA-00800 error. In many cases you need to as follow

echo 950000 > /sys/fs/cgroup/cpu,cpuacct/user.slice/cpu.rt_runtime_us

The above command will fix the Issue, and you need to restart the DB. But when you reboot your Server the change will lost. Better to add following line in the rc.local file to persistent after reboot.

vi /etc/rc.local
echo 950000 > /sys/fs/cgroup/cpu,cpuacct/user.slice/cpu.rt_runtime_us
chmod +x /etc/rc.local

That's it 
I have script, if you have multiple server to fix the issue via jump host-.

#!/bin/bash

if [ -f $1 ]; then
 SERVERLIST=$(cat $1)
else
 SERVERLIST=$1
fi

for i in $SERVERLIST; do
    echo "Processing $i ..."

    ssh -q -T \
        -o ConnectTimeout=1 \
        -o PreferredAuthentications=publickey \
        "$i" /bin/bash --noprofile --norc <<'EOF'

echo 950000 > /sys/fs/cgroup/cpu,cpuacct/user.slice/cpu.rt_runtime_us

cat /sys/fs/cgroup/cpu,cpuacct/user.slice/cpu.rt_runtime_us

touch /etc/rc.local

grep -q "cpu.rt_runtime_us" /etc/rc.local || cat >> /etc/rc.local <<'EORC'
# Set CPU real-time runtime for Oracle VKTM
echo 950000 > /sys/fs/cgroup/cpu,cpuacct/user.slice/cpu.rt_runtime_us
EORC

chmod +x /etc/rc.local
EOF

done

Wednesday, January 21, 2026

SGA resize

How to resize SGA

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 


SELECT name,value/1024/1024/1024 "SGA (GB)" FROM v$sga;
SELECT sum(value)/1024/1024/1024 "TOTAL SGA (GB)" FROM v$sga;

NOTE: create pfile from spfile before do the chanege.

alter system set sga_target=72G scope=spfile sid='*';

---
SQL> alter system set sga_max_size=32G scope=spfile;

System altered.

!!! PGA_AGGREGATE_TARGET should be lower than PGA_AGGREGATE_LIMIT.

NOTE: Soll den wert kleiner sein als SGA und grosser als pga_aggregate_target

System altered.

NOTE: Soll den wert kleiner sein als pga_aggregate_limit

System altered.

----


#usefull link with nice example.



Friday, December 5, 2025

Oracle JDBC Connection Test



How to test Oracle connection via JDBC Thin driver.



PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 


STEP 1.
Create a file OracleCon.java with the following code.
vi OracleCon.java

import java.sql.*;
public class OracleCon
{
public static void main(String args[])
  {
   Class.forName("oracle.jdbc.driver.OracleDriver");
     String url = "jdbc:oracle:thin:@ ORADBPRD.th.com:1521:KARDBPRD";
       Connection conn =
         DriverManager.getConnection(url,"user_tst01","pw_xyz");
         conn.setAutoCommit(false);
     Statement stmt = conn.createStatement();
     ResultSet rs=stmt.executeQuery("select user from dual;");
     while(rs.next())
     {
      System.out.println (rs.getString(1));
     }
   stmt.close();
   System.out.println ("Connection succeeded");
  }
}

STEP 2.
Compile the code.


Execute the program as follow.

Connection succeeded




Tuesday, June 10, 2025

April Patch 19c 2025

  

Oracle Critical Patch Update on 19c - January 2025

Oracle Critical Patch Update (CPU)

19.27.0.0.250415 GI RU Combo:

Patch 37591516 - Combo of OJVM Component Release Update 19.27.0.0.250415 + Grid Infrastructure Apr 2025 Release Update 19.27.0.0.25041


PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

Execute the following commands:

STEP 1

Oracle® Database Patch 37641958 - GI Release Update 19.27.0.0.250415

1)
NOTE: IMPORTANT
GI Home:
You need to update first opatch to the higher or latest version.
You can download latest version from the following link.

For April CPU is required OPatch latest version. It can be downloaded by the following link

Download lest OPatch from "https://updates.oracle.com/download/6880880.html"

Latest OPatch copy files.
mv OPatch OPatch_old
cd $DOWNLOAD_PATCH/OPatch
cp -r OPatch $GRID_HOME

You Need to do the same on ORACLE_HOME
Oracle ORACLE_HOME
Latest OPatch copy files
cd $ORACLE_HOME
mv OPatch OPatch_old
cd $DOWNLOAD_HOME/OPatch
cp -r OPatch $ORACLE_HOME


Unzip January patch file downloaded.

unzip p37641958_190000_<platform>.zip

Check the conflict:
From Grid_Home

$DOWNLOAD_PATCH is a directory where the patch is located.

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir  $DOWNLOAD_PATCH/37641958/37642901

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $DOWNLOAD_PATCH/37641958/37654975

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $DOWNLOAD_PATCH/37641958/37643161

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $DOWNLOAD_PATCH/37641958/37762426

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -
phBaseDir $DOWNLOAD_PATCH/37641958/36758186


For Database home, as home user
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $DOWNLOAD_PATCH/37641958/37642901

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $DOWNLOAD_PATCH/37641958/37654975


2)
Shut down all instances and listeners associated with the Oracle home that you are updating.
Stop a PDB from Oracle home:
alter pluggable database KARDBPDB close immediate;
srvctl status database -d KARDBTST
Database is not running.

Stop Listener from GI Home

srvctl stop  listener -l LISTENER
srvctl status listener -l LISTENER
Listener LISTENER is enabled
Listener LISTENER is not running

Stop ASM
srvctl status asm
ASM is not running.

3)
As root user execute the following command.
You have following options
 i) To patch only the GI Home
 <GI_HOME>/OPatch/opatchauto apply <UNZIPPED_PATCH_LOCATION>/37641958 -  oh <GI_HOME>

ii) To patch oracle_home
  opatchauto apply <UNZIPPED_PATCH_LOCATION>/37641958 -oh <oracle_home1_path>

 iii) Patching Oracle Home and Grid Home togather:
 As root user, execute the following command on each node of the cluster:
 # <GI_HOME>/OPatch/opatchauto apply <UNZIPPED_PATCH_LOCATION>/37641958

I am going to apply the path for both grid home and oracle home together.

NOTE: make sure that the Clusterware is running:
If it is not running, you need to start it as follow.

crsctl start has

export PATH=$PATH:$GRID_HOME/OPatch
$GRID_HOME/OPatch/opatchauto apply $DOWNLOAD_PATCH/37641958

Post-Installation Instructions
Single/Multitenant (CDB/PDB) DB
sqlplus / as sysdba
startup
alter pluggable database all open;
quit
cd $ORACLE_HOME/OPatch
./datapatch -verbose

Any databases that have invalid objects need to execute utlrp.sql run

For example:
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

-- You can check valid or invalid objects with the following command.
set pagesize 250;
col STATUS format a20;
col COMP_NAME format a35;
select COMP_NAME, version, status from dba_registry;


STEP 2

For a Non Oracle RAC environment, shut down all databases and listeners associated with the Oracle home that you are updating.

From Oracle_home.
Normally no need to stop ASM. You need to just stop the DB and Listener

alter pluggable database KARDBPDB close immediate;
srvctl stop database -d KARDBTST
srvctl stop  listener -l LISTENER

export PATH=$PATH:/usr/ccs/bin

#$ORACLE_HOME/OPatch/opatch apply $DOWNLOAD_PATCH/37499406

Post installation Steps.

startup upgrade
alter pluggable database all open upgrade;
exit
cd $ORACLE_HOME/OPatch
./datapatch -verbose
sqlplus / as sysdba
shutdown
startup
alter pluggable database all open;

cd $ORACLE_HOME/rdbms/admin
SQL> @utlrp.sql

==== DONE ====

Verify the patch Version and Status of the patch:
col ID format a5
col COMMENTS format a20
col VERSION format a12
col BUNDLE format a5
col ACTION_TIME format a30
col ACTION format a10
set linesize 150
select substr(action_time,1,30) action_time, substr(id,1,8) id, substr(action,1,10) action, substr(version,1,8) version, substr(comments,1,20) comments from sys.registry$history ;



set pagesize 20;
set linesize 200;
col ACTION_TIME format a30;
col DESCRIPTION format a50;
select PATCH_ID,ACTION,ACTION_TIME,DESCRIPTION,STATUS from registry$sqlpatch order by ACTION_TIME ;


select PATCH_ID,DESCRIPTION,STATUS from registry$sqlpatch order by ACTION_TIME ;

OR
cd $ORACLE_HOME/OPatch
./opatch lspatches -oh ${ORACLE_HOME}

cd $GRID_HOME/OPatch
./opatch lspatches -oh ${GRID_HOME}



Enjoy !

Your comments are most valuable and it would help me to come up with better posts. 

How to create swap file

  How to Create, Verify, and Increase Swap Space on Linux Swap space is disk space that Linux uses as virtual memory when physical RAM is e...