Skip to content

How can LC_* localisation environment variables can break Oracle datapatch

by Alexandre Nestor

Recently I had to apply the Oracle 19.21 patch for a client.

In my daily work I use a MacBook with iTerm as terminal.

Quite often when connecting by ssh to remote servers perl raises warnings like:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").

The only thing to do is to ignore these warnings or to set the LC_CTYPE and LC_ALL variables in iTerm before executing the ssh command to connect to the remote server:

MacBook $> export LC_CTYPE=en_US.UTF-8       
                                                                       
MacBook $> export LC_ALL=en_US.UTF-8

I never thought that it could crash the oracle datapatch application.

Questions about your own setup? A dbi services consultant can look at your case.

Talk to an expert (opens in a new tab)

Here the traces:

oracleservr $>  $ORACLE_HOME/OPatch/datapatch -verbose
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
SQL Patching tool version 19.21.0.0.0 Production on Fri Oct 20 09:59:36 2023
Copyright (c) 2012, 2023, Oracle.  All rights reserved.

Log file for this invocation: /u00/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_22200_2023_10_20_09_59_36/sqlpatch_invocation.log

Connecting to database...OK
Gathering database info...done
Bootstrapping registry and package to current versions...done
Error: prereq checks failed!
verify_queryable_inventory returned ORA-20001: Latest xml inventory is not loaded into table
Prereq check failed, exiting without installing any patches.

The fix is pretty straightforward:

oracleservr > exit; 

MacBook>  export LC_CTYPE=en_US.UTF-8     
                                                                               
MacBook>  export LC_ALL=en_US.UTF-8

MacBook> ssh oracle@oracleservr

oracleservr>  $ORACLE_HOME/OPatch/datapatch -verbose
SQL Patching tool version 19.21.0.0.0 Production on Fri Oct 20 10:02:01 2023
Copyright (c) 2012, 2023, Oracle.  All rights reserved.

Log file for this invocation: /u00/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_23107_2023_10_20_10_02_01/sqlpatch_invocation.log

Connecting to database...OK
Gathering database info...done
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of interim SQL patches:
Interim patch 32067171 (OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)):
  Binary registry: Installed
  SQL registry: Applied successfully on 26-APR-21 06.13.04.866116 PM

Current state of release update SQL patches:
  Binary registry:
    19.21.0.0.0 Release_Update 230930151951: Installed
  SQL registry:
    Applied 19.10.0.0.0 Release_Update 210108185017 successfully on 26-APR-21 06.13.04.862299 PM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  No interim patches need to be rolled back
  Patch 35643107 (Database Release Update : 19.21.0.0.231017 (35643107)):
    Apply from 19.10.0.0.0 Release_Update 210108185017 to 19.21.0.0.0 Release_Update 230930151951
  No interim patches need to be applied

Installing patches...
Patch installation complete.  Total patches installed: 1

Validating logfiles...done
Patch 35643107 apply: SUCCESS
 
SQL Patching tool complete on Fri Oct 20 10:05:07 2023

Conclusion

The error message ORA-20001: Latest xml inventory is not loaded into table is pretty confusing. As Oracle use perl for datapatch is better to check that the LC_* localisations settings variables environnement are set correctly.

Let’s work together

Ready to operate at
the next level?

Tell us about your challenge. We’ll bring the depth, the expertise, and the Swiss precision.

Oracle Team

Oracle Team

Posts published under the Oracle Team account are collective contributions by the dbi services Oracle consultants. The practice covers the full Oracle Database lifecycle: architecture, migration and upgrade, high availability with RAC and Data Guard, backup and recovery, performance tuning, and engineered systems such as Oracle Database Appliance and Exadata. The team holds Oracle certifications up to Certified Master level and operates customer platforms under service level agreements.View Author posts

1,009 posts since December 2010

Most read in Oracle

The Oracle posts our readers open most: the all-time favourites, and what is trending right now.

Leave a Comment

Your email address will not be published. Required fields are marked *