Oracle Schema cannot access Directory - oracle

I've been trying for a while now to access an oracle DB directory I have created.
I've granted all permissions to the schema I want to access the directory from, but still Im getting the same error: "ORA-29280:invalid directory path".
I've checked the directory multiple time on my server, and it's everything as it should be, carefully checked, and still getting the same error.
I try to execute this example code from the schema I need to create the file from, to create a file in my directory:
DECLARE
l_file utl_file.file_type;
BEGIN
l_file := utl_file.fopen( 'DIRECTORIO_DATO_EXT', 'example_file.txt', 'W' );
utl_file.put_line( l_file, 'Example file.' );
utl_file.fclose( l_file );
END;
And the same error appears.
But when I execute the very same code from the SYS user as SYSDBA, the procedure completes without error, and the file is created in the server.
Please note that I've added ALL privileges to the user I want to access the directory from:
GRANT ALL ON DIRECTORY DIRECTORY_DATO_EXT TO MY_SCHEMA;
GRANT READ ON DIRECTORY DIRECTORY_DATO_EXT TO MY_SCHEMA;
GRANT WRITE ON DIRECTORY DIRECTORY_DATO_EXT TO MY_SCHEMA;
GRANT CONNECT ON DIRECTORY DIRECTORY_DATO_EXT TO MY_SCHEMA;
Also, from the server OS I've granted all permissions to the folder where the directory is pointing, and even tried to add the oracle user to the root user group to see if that worked, but still nothing.
I'll appreciate any help.
Regards.

Ok, so I just found out what was my problem:
I created a DBLink a few days ago, and updated ALL the synonyms from the main database so I could access my DBLink. When I did that , I did it for ALL synonyms, included UTL_FILE synonym, resulting in something like this:
CREATE OR REPLACE SYNONYM MY_SCHEMA.UTL_FILE FOR SYS.UTL_FILE#DBLink;
And as it turned out, the "#DBlink" was the problem, cause it was pointing at a specific schema (not sys), making my procedure unable to find the UTL_FILE utility.
Hope this helps someone in the future!

Related

GRANTS - ORACLE - PLS-00302

I have a package that doesn´t compile, showing this error PLS-00302, pointing to a specific table I created.
Well, I have granted this table to public with grant option, to test.
I recompile the package, but yet its not working, with the same issue.
Does anybody have any suggestion?
Thanks!

Oracle apex issue - ORA 20987: APEX - User nobody requires ADMIN privilege to perform this operation. - Contact your application administrator

I recently migrate my application from APEX 4.2 to 5.0. And now when i try to log in, error message shows up like this.
ORA-20987: APEX - User nobody requires ADMIN privilege to perform this
operation. - Contact your application administrator.
it happens when preforming the login. even login with the blank credentials. after login pressed it checks for the following,
DECLARE l_err_mesg VARCHAR2(500);
BEGIN
IF APEX_UTIL.GET_ACCOUNT_LOCKED_STATUS(p_user_name => :P101_USERNAME ) then
l_err_mesg := '<span style="color: red"> Account currently locked. </span>';
END IF;
RETURN l_err_mesg;
EXCEPTION WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END;
Please tell me what am I missing with this.
With Oracle Application Express 5.0, employing APEX_UTIL to manage workspace users and groups requires specific configuration. The default settings in APEX5 will provide give you an error when you employ APEX_UTIL for workspace users and groups
If you write and test code in SQL-Developer or SQLPlus, you will not likely encounter this error until you paste your code into APEX. The change is simple:
Go to: Edit Application Properties > Security > Runtime API Usage
You’ll find this as the very last item below database session. Add a check mark to permit “Modify Workspace Repository” as shown in the image below.
Saving this change to your Application Properties will clear the error.
Documentation
Source 1
Source 2

Stored procedure error PLS-00201: identifier 'UTL_HTTP' must be declared

I am trying to create a stored procedure that request some XML data from a service. I have found several examples on-line and all of them point to using this UTL_HTTP package. However, every time I tried to compile my store procedure with that I get the error:
PLS-00201: identifier 'UTL_HTTP' must be declared
Here is the basic skeleton of the code I want to use.
PROCEDURE GET_XML_DATA2 AS
BEGIN
DECLARE
v_soap_request VARCHAR2(32767);
v_soap_response VARCHAR2(32767);
v_http_request UTL_HTTP.req; --Fails here
v_http_response UTL_HTTP.resp; -- Fails here too
v_action VARCHAR2(4000) := '';
BEGIN
null;
END;
END GET_XML_DATA2;
It fails in the indicated lines and does not compile. I am using Oracle Express Edition and I have already tried to grant my user execute rights to that package. It did not work.
What else can I look at? What else could be causing this?
Thanks!
As you already figured out yourself, this seems to be a permission problem. Your user does somehow not have access to the UTL_HTTP package. Make sure your user has the EXECUTE permission on the package:
GRANT EXECUTE ON SYS.UTL_HTTP TO my_user;
Note that you might have to do this as SYS.
Using SQL Developer (which I can recommend if you're doing PL/SQL development), see if you can then look at the package somehow. If that does not help, please post the permissions that your user currently has.

403 AccessDenied on Amazon S3 delete proctected folder

I have one folder in amazon s3 on which i restricted the permission of deleting any folder. But, now what happened is i am not able create any folder using hive script. This hive query create one temporary folder under the name of _tmp.customerlevel. Which it tries to delete once it finishes the map reduce job. But, due to restriction of delete hive query gets failed. Can anyone tell me the workaround for this so that i can maintain the delete protected permission as well as i can write the data using hive script?
Insert overwrite directory 's3://logs/customerlevel' select * from customer;
REST.DELETE.OBJECT logs/_tmp.customer "DELETE /logs%2F_tmp.customerlevel HTTP/1.1" 403 AccessDenied
you could try to create the temp folder into another bucket to which your user have access to remove.

Synonym returning ORA-00904 error

I'm at my wits' end with this error.
I have a view which uses a function contained in a package in another schema. I've created a synonym to said package, and on my local dev DB, the view compiles correctly. On the build server, the view gives compilation errors.
When I run the select of the view manually, Oracle throws an ORA-00904 error on the synonym in the query. I just can't understand why it works in one place and not the other. The code on both servers is identical, as it's coming from our source control repository.
As phlogratos suggested, it was a privileges issue. As the user didn't have execute permissions on the package in the separate schema, it was causing this error.
The underlying problem was an issue with our script that applies grants, but it's good to know that references like this without permissions fail in this manner.

Resources