PLS-00201: identifier ‘DBMS_JAVA.GRANT_PERMISSION’ must be declared

I was doing the deployment of data in one database when I got the following error message:

Command output:
     dbms_java.grant_permission('TECH_DEP', 'SYS:java.io.FilePermission', '/u01/oracle/techrepo/scripts/*', 'read, write');
     *
  ERROR at line 4:
  ORA-06550: line 4, column 4:
  PLS-00201: identifier 'DBMS_JAVA.GRANT_PERMISSION' must be declared
  ORA-06550: line 4, column 4:

After some researches, I found that the Oracle Database Java Packages component was invalid in the database as below:


SQL> SET PAGES 2000
SQL> SET LINES 2000
SQL> select comp_name, version, status from dba_registry;

COMP_NAME                                                                                                                                                                                   VERSION                 STATUS
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------ ---------------------------------
Oracle Database Catalog Views                                                                                                                                                               19.0.0.0.0                      VALID
Oracle Database Packages and Types                                                                                                                                                          19.0.0.0.0                      VALID
Oracle Real Application Clusters                                                                                                                                                            19.0.0.0.0                      VALID
Oracle XDK                                                                                                                                                                                  19.0.0.0.0                      VALID
Oracle Database Java Packages                                                                                                                                                                      INVALID
Oracle XML Database                                                                                                                                                                         19.0.0.0.0                      VALID
Oracle Workspace Manager                                                                                                                                                                    19.0.0.0.0                      VALID

7 rows selected.

And the documentation that helped to find out it was (Doc ID 397770.1) and (Doc ID 2314363.1). This documentation helps you identify invalid components in the registry of your database and recreate this component in case one of them is with the INVALID status. After the procedure of creating any invalid features again, the output is as below:


 set pages 2000
 set lines 2000
 select comp_name, version, status from dba_registry;

COMP_NAME                                                                                                                                                                                   VERSION                 STATUS
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------ ---------------------------------
Oracle Database Catalog Views                                                                                                                                                               19.0.0.0.0                      VALID
Oracle Database Packages and Types                                                                                                                                                          19.0.0.0.0                      VALID
Oracle Real Application Clusters                                                                                                                                                            19.0.0.0.0                      VALID
Oracle XDK                                                                                                                                                                                  19.0.0.0.0                      VALID
Oracle Database Java Packages                                                                                                                                                               19.0.0.0.0                      VALID
JServer JAVA Virtual Machine                                                                                                                                                                19.0.0.0.0                      VALID
Oracle XML Database                                                                                                                                                                         19.0.0.0.0                      VALID
Oracle Workspace Manager                                                                                                                                                                    19.0.0.0.0                      VALID

8 rows selected.



SQL>  dbms_java.grant_permission('TECH_DEP', 'SYS:java.io.FilePermission', '/u01/oracle/techrepo/scripts/*', 'read, write');

PL/SQL procedure successfully completed.


Related posts

Leave a Comment