Showing posts with label oracle database. Show all posts
Showing posts with label oracle database. Show all posts

Wednesday, August 19, 2026

How to Fix ORA-14694: Database Must Be in UPGRADE Mode for MAX_STRING_SIZE Migration

How to Fix ORA-14694: Database Must Be in UPGRADE Mode for MAX_STRING_SIZE Migration


Have you ever tried to scale up your Oracle database strings from the classic 4,000-byte limit to the glorious 32,767 bytes (EXTENDED), only to be slapped with a frustrating error during startup?

If you are seeing this,

ALTER PLUGGABLE DATABASE freepdb1 open;
* ERROR at line 1:
ORA-14694: database must in UPGRADE mode to begin MAX_STRING_SIZE migration

Don't panic. This happens because your Container Database (CDB) already transitioned its MAX_STRING_SIZE parameter to EXTENDED, but your Pluggable Database (freepdb1) hasn't finished the migration script yet. 

It is stuck in limbo. Fixing this is a quick 5-step process. Let's walk through it.

Step 1: Force the PDB into Upgrade Mode Because the database requires data type dictionary conversions, it refuses to open normally. We need to explicitly tell Oracle to open the PDB in UPGRADE mode. Log into your CDB as SYSDBA and run:

SQL> ALTER PLUGGABLE DATABASE freepdb1 OPEN UPGRADE;

Step 2: Switch Over to Your PDBNext, jump into the context of the pluggable database where the error occurred:

SQL> ALTER SESSION SET CONTAINER = freepdb1;
 
Step 3: Run the utl32k.sql Migration Script. This is where the magic happens. Oracle provides a built-in script that automatically converts your metadata and tables to support the extended string sizes. Run it directly from your SQL prompt:

SQL> @?/rdbms/admin/utl32k.sql
 
(The ? is just a built-in shortcut for your $ORACLE_HOME path).

Step 4: Restart the PDB Normally. Once the script successfully completes, your data structures are upgraded. Now, bounce the PDB to take it out of upgrade mode and open it for standard business use

SQL> ALTER PLUGGABLE DATABASE freepdb1 CLOSE;
SQL> ALTER PLUGGABLE DATABASE freepdb1 OPEN READ WRITE;

 
Step 5: Double-Check Your Work. Always verify! Run this quick check inside the PDB to confirm that your maximum string size is now officially extended

SQL> SHOW PARAMETER max_string_size;

NAME              TYPE        VALUE
----------------- ----------- ---------
max_string_size   string      EXTENDED


The ORA-14694 error looks intimidating, but it is just Oracle’s safety mechanism preventing data corruption before a major structural change. Follow these steps, and you will be handling 32K strings in no time.

Did you run into any invalid objects or compilation glitches while running utl32k.sql? Drop a comment below and let's troubleshoot!


Thanks & Regards,
Chandan Tanwani

Thursday, January 12, 2017

init.ora Parameter vs Kernel Parameter

init.ora Parameter vs Kernel Parameter


Recently I came across performance degradation after changing of DB parameter. Many times we change database init.ora parameter, at the same time we should also monitor kernel parameter as well. This is because few of memory and process parameter are directly effecting to our OS.

DB Memory and process parameters are directly linked with following kernel parameters, let's have look on below table,

**Below comparison is taken from oracle Docs



Init.ora Parameter
Kernel Parameter
db_block_buffers
shmmax, shmall
db_files (maxdatafiles)
nfile, maxfiles
large_pool_size
shmmax, shmall
log_buffer
shmmax, shmall
Processes
nproc, semmsl, semmns
shared_pool_size
shmmax, shmall



Common Kernel Parameter Definitions

Following Kernel Parameters tend to be generic across most Unix/Linux platforms. However, their names may be different in flavors of Unix/Linux. Check OS document for exact name.

maxfiles - Soft file limit per process.
maxuprc - Maximum number of simultaneous user processes per userid.
nfile - Maximum number of simultaneously open files systemwide at any given time.
nproc - Maximum number of processes that can exist simultaneously in the system.
shmall - This parameter sets the total amount of shared memory pages that can be used system wide. Hence, shmall should always be at least ceil(shmmax/page_size).
shmmax - The maximum size(in bytes) of a single shared memory segment.
shmmin - The minimum size(in bytes) of a single shared memory segment.
shmmni - The number of shared memory identifiers.
shmseg - The maximum number of shared memory segments that can be attached by a process.
semmns - The number of semaphores in the system.
semmni - The number of semaphore set identifiers in the system; determines the number of semaphore sets that can be created at any one time.
semmsl - The maximum number of sempahores that can be in one semaphore set. It should be same size as maximum number of Oracle processes.




Thanks & Regards,
Chandan Tanwani
Oracle Performance Tuning Certified Expert