dbTalk Databases Forums  

Issues with writing to server-side log file.

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Issues with writing to server-side log file. in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
seannakasone
 
Posts: n/a

Default Issues with writing to server-side log file. - 02-06-2009 , 02:55 PM






Hello, on the database server running Oracle 9.2, I want to write to a log
file. I unsuccessfully tried the following:

DECLARE
f UTL_FILE.FILE_TYPE;
BEGIN
f := UTL_FILE.FOPEN('d:\temp', 'log.txt', 'w');
END;
/

It says, 'ORA-29280: invalid directory path' even if that folder exists
and the permissions allow everyone to write to it.

Someone told me to create a directory object so I can grant permissions to
it, as follows:

CREATE OR REPLACE DIRECTORY dirobj as 'd:\temp';
GRANT READ,WRITE ON DIRECTORY dirobj to snakason;
CONN snakason/mypass@hedev2
DECLARE
f UTL_FILE.FILE_TYPE;
BEGIN
f := UTL_FILE.FOPEN(dirobj, 'log.txt', 'r', 5000);
END;
/

But now I'm getting this error "PLS-00201: identifier 'DIROBJ' must be
declared". I'm guessing dirobj is not in scope of the PL/SQL block, but
how to I remedy that? If I put those lines within the PL/SQL block, I get
errors. Sorry, I'm an Oracle newbie so I don't what works or does not
work in a PL/SQL block.


Reply With Quote
  #2  
Old   
Shakespeare
 
Posts: n/a

Default Re: Issues with writing to server-side log file. - 02-07-2009 , 04:40 AM






seannakasone schreef:
Quote:
Thanks it worked.

It needed to be in quotes and uppercase.

BTW, do you know how to show existing directory objects?


On Fri, 6 Feb 2009, seannakasone wrote:

Hello, on the database server running Oracle 9.2, I want to write to a log
file. I unsuccessfully tried the following:

DECLARE
f UTL_FILE.FILE_TYPE;
BEGIN
f := UTL_FILE.FOPEN('d:\temp', 'log.txt', 'w');
END;
/

It says, 'ORA-29280: invalid directory path' even if that folder exists
and the permissions allow everyone to write to it.

Someone told me to create a directory object so I can grant permissions to
it, as follows:

CREATE OR REPLACE DIRECTORY dirobj as 'd:\temp';
GRANT READ,WRITE ON DIRECTORY dirobj to snakason;
CONN snakason/mypass@hedev2
DECLARE
f UTL_FILE.FILE_TYPE;
BEGIN
f := UTL_FILE.FOPEN(dirobj, 'log.txt', 'r', 5000);
END;
/

But now I'm getting this error "PLS-00201: identifier 'DIROBJ' must be
declared". I'm guessing dirobj is not in scope of the PL/SQL block, but
how to I remedy that? If I put those lines within the PL/SQL block, I get
errors. Sorry, I'm an Oracle newbie so I don't what works or does not
work in a PL/SQL block.


Select * from all_directories

Shakespeare


Reply With Quote
  #3  
Old   
Shakespeare
 
Posts: n/a

Default Re: Issues with writing to server-side log file. - 02-07-2009 , 04:43 AM



seannakasone schreef:
Quote:
Thanks it worked.

It needed to be in quotes and uppercase.

BTW, do you know how to show existing directory objects?


On Fri, 6 Feb 2009, seannakasone wrote:

Hello, on the database server running Oracle 9.2, I want to write to a log
file. I unsuccessfully tried the following:

DECLARE
f UTL_FILE.FILE_TYPE;
BEGIN
f := UTL_FILE.FOPEN('d:\temp', 'log.txt', 'w');
END;
/

It says, 'ORA-29280: invalid directory path' even if that folder exists
and the permissions allow everyone to write to it.

Someone told me to create a directory object so I can grant permissions to
it, as follows:

CREATE OR REPLACE DIRECTORY dirobj as 'd:\temp';
GRANT READ,WRITE ON DIRECTORY dirobj to snakason;
CONN snakason/mypass@hedev2
DECLARE
f UTL_FILE.FILE_TYPE;
BEGIN
f := UTL_FILE.FOPEN(dirobj, 'log.txt', 'r', 5000);
END;
/

But now I'm getting this error "PLS-00201: identifier 'DIROBJ' must be
declared". I'm guessing dirobj is not in scope of the PL/SQL block, but
how to I remedy that? If I put those lines within the PL/SQL block, I get
errors. Sorry, I'm an Oracle newbie so I don't what works or does not
work in a PL/SQL block.


select obj.object_name,
dir.os_path
from sys.dir$ dir,
all_objects obj
where obj.object_id = dir."OBJ#"



Shakespeare


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.