Why Can't PDI find/run my package stored procedure? - oracle

community! This is my first question, please go easy on me! :)
I have an ETL process on PDI to orchestrate calls on procedures stored in a package in Oracle.
Some procedures are ready and run normally on PL/SQL Developer.
When I call them using pentaho, either using the job 'SQL' or the transformations 'Execute SQL Script' or 'Call DB procedure' I always get an error related to "can't find the procedure", like: "ORA-00904: "PKG_CARGA_DIARIA_SABARA"."FUN_HELLO_WORLD": invalid identifier" or "ORA-06550: line 1, column 13:
PLS-00201: identifier 'PKG_CARGA_DIARIA_SABARA.FUN_HELLO_WORLD' must be declared".
Please, what am I doing wrong?
enter image description here
enter image description here
enter image description here
EDIT 1: I'm using the user that created the package both to test it in PL/SQL Developer and to connect to the database in PDI.

If I run your code, I get - no surprise - the same message:
SQL> select "PKG_CARGA_DIARIA_SABARA"."FUN_HELLO_WORLD" from dual;
select "PKG_CARGA_DIARIA_SABARA"."FUN_HELLO_WORLD" from dual
*
ERROR at line 1:
ORA-00904: "PKG_CARGA_DIARIA_SABARA"."FUN_HELLO_WORLD": invalid identifier
SQL>
It means that function in that package (which means the package itself) isn't accessible to me. Of course it isn't, I don't have it in my schema. Looks like you don't have it either.
Saying that it works in PL/SQL Developer, I suppose you're connected as package's owner. If user - who tries to call that function - connected to the database in PDI (whatever it is, I don't know/use it) isn't the same as the one you used in PL/SQL Developer and it wasn't granted EXECUTE privilege on the package, then it can't "see" nor execute it.
Therefore:
try to connect as package's owner
if you must connect as someone else, let owner grant EXECUTE privilege, while you should (in PDI) precede package name with the owner name

Found it here! Will post so that anyone can use the answer.
PDI Doesn't automatically consider the schema from the database connection user, you have to specifically add it to your code inside the SQL job.
So: "BEGIN .<procedure name; END;" yelds the error, even though I was running with the procedure and package owner.
And: "BEGIN ..<procedure name; END;" will work it out just fine.
Hope it helps someone, tks!

Related

PL/SQL: ORA-04063: view "OPS$DTEPROD.DTE_BLMB_TRD_ACCT_VW"

I have a view, which created (ORACLE)
CREATE OR REPLACE FORCE VIEW "OPS$DTEPROD"."DTE_BLMB_TRD_ACCT_VW"
("BB_TRD_ACCT", "DESCRIPTION", "ICI_TRD_ACCT") AS
select rtrim(STRBK_BOOK_NAME) bb_trd_acct,
rtrim(STRBK_DESCRIPTION) description,
trading_acct ici_trd_acct
from spider.sp_struct_books#spdn b1
, dte_trading_acct
where substr(rtrim(STRBK_BOOK_NAME),1,2)=ltrim(rtrim(fits_trading_Acct))
and strbk_last_update_date =
(select max(strbk_last_update_date)
from spider.sp_struct_books#spdn b2
where b2.strbk_book_number = b1.strbk_book_number)
In the package, when I compile it shows me an error
328/117 PL/SQL: ORA-04063: view "OPS$DTEPROD.DTE_BLMB_TRD_ACCT_VW" has
errors
Could you please help me to find the reason?
Thanks
Errors for PACKAGE BODY RATES_2DTE:
LINE/COL ERROR
-------- -----------------------------------------------------------------
328/1 PL/SQL: SQL Statement ignored
328/117 PL/SQL: ORA-04063: view "OPS$DTEPROD.DTE_BLMB_TRD_ACCT_VW" has
errors
Please execute following query with same user which get the outlined error:
Select * from user_errors where name like 'OPS$DTEPROD.DTE_BLMB_TRD_ACCT_VW';
This will give you errors in the view. You can post output for further investigations.
Regards
Abhi
In order to solve such problem I have to work with our DBA. Only they can give access to this database from development server. On production we have everything done.
Thank you all for trying to help me
Their are two probabilities :
1) As another member (#xQbert) suggested - user who is used to created view do not have accesses to table over dB link.
2) Database, used in database link, is not accessible.
Solution:
1) Please execute following statement by same user which is trying to select from view:
Select count(*) from spider.sp_struct_books#spdn ;
This should give same error as original error.
We want to check is read access to destination table is in place.
2) From server/command prompt on database host, where view is created, execute following :
tnsping spdn (or tnsping <database name usec by db link>)
OR
sqlplus <Username>/<Password>#spdn (or <database name usec by db link>)
We want to check if destination database on dBlink is reachable.
Abhi

DVSYS object(package body) invalid

I am using oracle 12c oracle database vault with opt=false but still having invalid object for dvsys user.
I have run
catalog.sql
catproc.sql
utlrp.sql
but still not get validate this object.
It looks like you have no errors, but object invalidated because one of its reference changed. It sometimes happens.
2 things you may try:
just call its description.
SQL> desc DVSYS.DV$CODE
use dbms_utility to compile the schema where some objects are invalid (you may need to connect as sysdba):
SQL> begin dbms_utility.compile_schema('DVSYS', FAlSE); end;
/

How to call a package which is belongs to a another user

I have a package'PKG_PARTITION_MAINTENANCE in Schema : 'SAB_OWN'
and i gave EXECUTE PERMISSION TO A USER LIKE BELOW :
GRANT EXECUTE ON PKG_PARTITION_MAINTENANCE TO SAB_READ_USER;
but when the user is trying to call the package it getting error as below :
EXECUTE PKG_PARTITION_MAINTENANCE.ADD_TABLE_PARTITIONS('tbl_name');
ERROR :
[Error] Execution (3: 7): ORA-06550: line 1, column 7:
PLS-00201: identifier 'PKG_PARTITION_MAINTENANCE.ADD_TABLE_PARTITIONS' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
is anything i am missing, why user SAB_READ_USER not able to execute it ? This package is running well in SAB_OWN Schema.
You have to tell Oracle which schema the object belongs to, if it isn't in the schema you're logged into like so:
EXECUTE SAB_OWN.PKG_PARTITION_MAINTENANCE.ADD_TABLE_PARTITIONS('tbl_name');
You could also create a synonym instead:
create synonym PKG_PARTITION_MAINTENANCE for SAB_OWN.PKG_PARTITION_MAINTENANCE;
which acts like a pointer to tell Oracle where to look for the object being called.
Or, you could alter your session so that the schema you're "looking" at is a different one to the one you logged in as:
alter session set current_schema = SAB_OWN;
These last two options should allow you to run the package without explicitly stating the schema name, although personally, I wouldn't recommend them - I would go with explicitly stating the schema name, unless there was a jolly good reason why that wouldn't work!

Oracle catldr.sql multiple errors

I'm preparing my new Oracle 11g install for "Direct" SQL*Loader operation. As per the documentation here:
http://docs.oracle.com/cd/B28359_01/server.111/b28319/ldr_modes.htm#i1007669
To prepare the database for direct path loads, you must run the setup script, catldr.sql, to create the necessary views. You need only run this script once for each database you plan to do direct loads to.
So I execute the following sql script:
$ORACLE_HOME/rdbms/admin/catldr.sql
Problem is, when I run this script I get multiple errors. E.g. (and there are a lot more than this, stuff about circular synonyms too):
grant select on gv_$loadistat to public
*
ERROR at line 1:
ORA-04063: view "SUKLTI.GV_$LOADISTAT" has errors
create or replace view v_$loadpstat as select * from v$loadpstat
*
ERROR at line 1:
ORA-01731: circular view definition encountered
Synonym created.
grant select on v_$loadpstat to public
*
ERROR at line 1:
ORA-04063: view "SUKLTI.V_$LOADPSTAT" has errors
create or replace view v_$loadistat as select * from v$loadistat
*
ERROR at line 1:
ORA-01731: circular view definition encountered
Synonym created.
grant select on v_$loadistat to public
*
ERROR at line 1:
ORA-04063: view "SUKLTI.V_$LOADISTAT" has errors
from x$kzsro
*
ERROR at line 15:
ORA-00942: table or view does not exist
And then when I try to run SQL*Loader with "direct=true" I receive the following errors:
ORA-26014: unexpected error on column SYS_NTEOzTt73hE9LgU+XYHax0tQ==.DUMMYCOL NAME
while retrieving virtual column status
ORA-01775: looping chain of synonyms
Note this was a clean Oracle install with some XML schema registered(8) and tables generated off the back of the schema.
Any ideas?
The catldr.sql script says:
Rem NAME
Rem catldr.sql
Rem FUNCTION
Rem Views for the direct path of the loader
Rem NOTES
Rem This script must be run while connected as SYS or INTERNAL.
From the error messages you seem to have run it as your normal user, SUKLTI, rather than as SYS. The documentation you linked to also stated it should be run once per database - not once per end-user.
It should have been run during database creation anyway, via the catalog.sql script, so I'm surprised you need to run it manually at all; and some of the errors suggest the objects it creates did already exist. Through re-running it as SYS doesn't really look like it should hurt.
You can see which objects have been created by querying:
select object_type, object_name
from all_objects
where created > time_just_before_you_ran_the_script
You may need to cross-reference public synonyms with the all_synonyms view to check the table owner, and drop any objects it created from the SUKLTI schema as well as those new public synonyms. (But don't drop anything from the SYS schema...)
You may then need to re-run catldr.sql as SYS to recreate those synonyms pointing to the correct SYS objects.
#AlexPoole
You are completely correct. The script had to be run as SYS.
As this was a "test db" we tore it down and ran the script as SYS at DB re-creation time.
Everything now working!
thanks for reply

ORA-06508: PL/SQL: could not find program unit being called : "PUBLIC.PLITBLM"

I have a java web app that calls the oracle plsql procedure from ibatis xml file. this procedure captures the audit information of the table. so when multiple users modifies a table this stored procedure .after certain time i receive the following error.
--- The error occurred in example.xml.
--- The error occurred while applying a parameter map.
--- Check the example.params.
Check the statement (update procedure failed).
Cause: java.sql.SQLException: ORA-04068: existing state of packages has been discarded
ORA-04065: not executed, altered or dropped stored procedure "PUBLIC.PLITBLM"
ORA-06508: PL/SQL: could not find program unit being called:
"PUBLIC.PLITBLM" ORA-06512: at "AUDIT", line 279
ORA-06512: at line 1
call from ibatis
{call AUDIT(?,?,?,?,?,?,'val')}
call from java web app
Map _temp = new HashMap(params);
_temp.put("OPERATION_TYPE",operation);
sqlMapper.insert("call_proc_audit",_temp);
return false;
The plsql procedure has only execute immediate for insert,update and delete.
I have removed the code due to security.
The PLITBLM package is part of the standard Oracle build; apparently it handles index organized tables. It's not documented in any detail because it's not something we need to call directly. Find out more. It's likely that some standard Oracle functionality has dependencies on it.
As to why your program hurls that exception, that's a bit of a facer. The package is created by a script in the Oracle home $ORACLE_HOME/rdbms/admin/plitblm.sql. However, it cannot be run on its own but only as part of catproc,sql. This builds the data dictionary and other things, and is run as part of the Oracle installation process.
Perhaps you have a botched install?
Interestingly, the actual PLITBLM package is owned by SYS but the error message references PUBLIC, which suggests it might just be a missing public synonym. However, if catproc,sql has not run successfully there may be other lurking nasties. You really need a DBA to check the database, and if necessary re-run catproc,sql.

Resources