Monday, September 13, 2021

Grant java privileges to run under Oracle Database

Symptoms:
You have a java code running under Oracle Database and needs to adjust the privileges to run the code.


Cause:
Some exemple of errors when trying to execute your java code:

"the Permission ("java.io.FilePermission" "/u01/data/yourfile.dat" "write") has not been granted to <YOUR-USER>. The PL/SQL to grant this is dbms_java.grant_permission( '<YOUR-USER>', 'SYS:java.io.FilePermission', '/u01/data/yourfile.dat', 'write' )"

or 

"the Permission ("java.net.SocketPermission" "localhost:0" "listen,resolve") has not been granted to <YOUR-USER>. The PL/SQL to grant this is dbms_java.grant_permission( '<YOUR-USER>', 'SYS:java.net.SocketPermission', 'localhost:0', 'listen,resolve' )"


Solution:
Set the variables according to your needs and give the privileges:

begin
  dbms_java.grant_permission( '<YOUR-USER>', 'SYS:java.io.FilePermission', '/u01/data/-', 'read,write,delete' );

  dbms_java.grant_permission( '<YOUR-USER>', 'SYS:java.net.SocketPermission', '*', 'accept,listen,connect,resolve' );
end;
/


Note:

A pathname that ends in "/*" (where "/" is the file separator character,File.separatorChar) indicates a directory and all the files contained in that directory.

A pathname that ends with "/-" indicates a directory and (recursively) all files and subdirectories contained in that directory.


Hope this helps.

Friday, June 18, 2021

When starting Oracle Listener gets an error TNS-00525: Insufficient privilege for operation

Symptoms:
When trying to start the Oracle Listener, it returns an error regarding permission but not clear on the logs what it is:

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/ora19c/product/19.3.0/network/admin/listener.ora
Log messages written to /u01/ora19c/diag/tnslsnr/sandbox19js/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sandbox19js)(PORT=1521)))
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12555: TNS:permission denied
 TNS-12560: TNS:protocol adapter error
  TNS-00525: Insufficient privilege for operation
   Linux Error: 1: Operation not permitted


Cause:
In the directory /var/tmp/.oracle there exist some socket files which do not belong to UNIX user oracle and group dba, but to another user.
When the Listener process starts, it tries to create the following socket files:
  /var/tmp/.oracle/s#<pid>.1
  /var/tmp/.oracle/s#<pid>.2
  /var/tmp/.oracle/sREGISTER

where <pid> is the ID of the operating system process for the Listener.

Solution:
As UNIX user root, delete all socket files from directory /var/tmp/.oracle
Then as oracle owner UNIX user, starts the Listener by executing the command "lsnrctl start".

Wednesday, June 2, 2021

libnsl.so.1: cannot open shared object file: No such file or directory

Symptoms:

Installed the Oracle InstantClient on Linux Linux 8 (packages instantclient-basic-linux.x64-19.11.0.0.0dbru.zip and instantclient-sqlplus-linux.x64-19.11.0.0.0dbru.zip) and later configured the environment variables:
export ORACLE_HOME=/u01/instantclient_19_11/
export LD_LIBRARY_PATH=$ORACLE_HOME
export TNS_ADMIN=/u01/instantclient_19_11/network/admin
export PATH=$ORACLE_HOME:$PATH

When calling the sqlplus utilitary, it presents an error regarding Linux packages missing with message:
sqlplus: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory.


Cause: 

SqlPlus uses a few linux libraries and one of that is exactly the libnsl.
However there are a few packages with similar names (or endings) that does not solve the issue.


Solution:

Simply install the package libnsl with command:
yum install libnsl -y

Thursday, February 18, 2021

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

Symptoms: 

When starting up the Oracle 19c, it raises an error on the trace file and also creates an incident file with the message:

ORA-00800: soft external error, arguments:  [Set Priority Failed], [VKTM], [Check traces and OS configuration], [Check Oracle document and MOS notes], []


Cause: 

As given by the MOS article (Doc ID 2718971.1)

"19c moved to OL7/UEK4. UEK4 requires rt_period and rt_runtime set for the cgroup from where the d/b is started.

Typically the root one unless the customer is setting up their own cgroups or using system user slices.

It requires the proper values such as the 95%. For this problem, ORA-800 will have the following message in the incident. "


Solution:

Check the priority of VKTM @RDBMS level:

SQL> select a.ksppinm "Parameter", b.ksppstvl "Session Value", c.ksppstvl "Instance Value", a.KSPPDESC "Describtion"

from x$ksppi a, x$ksppcv b, x$ksppsv c

where a.indx = b.indx and a.indx = c.indx and a.ksppinm like '_%' and a.ksppinm like '_highest_priority_process%';


If not "VKTM" is not prioritiesed, please elevate the priority :

SQL> alter system set "_high_priority_processes"='VKTM' scope=spfile;


Restart DB and verify the same

SQL> show parameter "_high_priority_processes";


As root user, change file permission and owner

$ chmod root.oinstall $ORACLE_HOME/bin/oradism

$ chmod u+s oradism


Restart the database and check if it solved the error.

Otherwise, check the MOM Doc ID given above.


Hope that helps you.

Friday, January 22, 2021

RIB error ORA-21700 object does not exist or is marked for delete

Symptoms: 

At random times the Oracle Retail Integration Bus (aka RIB) gets certain errors such as:

GETNXT(?,?,?,?,?,?,?) and/or ORA-21700 object does not exist or is marked for delete.

This error is kind of confusion because if you look at the database, the object exists and it's valid.


Cause: 

Several causes can lead to this behavior, but most commonly some database objects in RMS has changed and RIB detects such modification in the signature.

Invalid or missing objects in RMS database also can be the reason.


Solution:

These steps described will recreate the RIB objects under RMS database.

An important point there is to run the commands from the latest RIB patch applied.

For this, create a staging area, copy from the patch and unzip the file: retail-public-payload-database-object-types-14.1.3.jar


1. Bring down all the RIB managed-servers.

2. Run:

$ cd /u01/stage/rib/hotfixes/<your_patch/staging/

$ unzip retail-public-payload-database-object-types-14.1.3.jar

$ sqlplus rms_user/passwd

   @InstallAndCompileAllRibOracleObjects.sql

3. Compile all objects to make sure objects are valid.

   sqlplus / as sysdba

   @?/rdbms/admin/utlrp;


4. Bring up the RIB.


Hope this help


Configure the Oracle DB Access Control List to avoid error like ORA-24247: network access denied

Symptoms:  You try to make external connections from the Oracle Database and receive erros like ORA-24247: network access denied by access c...