phil_thorn
phil_thorn

Reputation: 11

postgresql Orafce UTL_FILE_INVALID_PATH on RHEL9.4 Linux Server

Iam currently working on a proof of concept for transitioning from our standard oracle database to a postgres DB with the orafce extension. We are logging a lot, so after verifying the dbms_output command, i want to take a look at UTL_FILE scheme.

DO $$
DECLARE
    v_utlfile UTL_FILE.FILE_TYPE;
    v_directory ORACLE.VARCHAR2(255) := '/var/lib/pgsql/16/utl_file';  -- Dein Verzeichnis
    v_filename ORACLE.VARCHAR2(50) := 'test_file.txt';  -- Dateiname
BEGIN
    v_utlfile := UTL_FILE.FOPEN('/var/lib/pgsql/16/utl_file', v_filename, 'w');
    PERFORM UTL_FILE.PUT_LINE(v_utlfile, 'This is a test log entry.');
    PERFORM UTL_FILE.FCLOSE(v_utlfile);
END $$;

This example code responds the following:

ERROR:  you cannot access localityUTL_FILE_INVALID_PATH 
FEHLER:  UTL_FILE_INVALID_PATH
SQL state: P0001
Detail: you cannot access locality
Hint: locality is not found in utl_file_dir table

My utl_file_dir table looks like this: utl_file_dir table

I changed the permission for the target directory (/var/lib/pgsql/16/utl_file) to chmod 700, so the owner (postgres user) has alle rights to it and restarted the server with the postgres user.

It still responds with the error message...

Upvotes: 1

Views: 109

Answers (0)

Related Questions