Re: Issues with writing to server-side log file.
From: Shakespeare <whatsin_at_xs4all.nl>
Date: Sat, 07 Feb 2009 11:40:14 +0100
Message-ID: <498d650f$0$189$e4fe514c_at_news.xs4all.nl>
seannakasone schreef:
>> 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_at_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.
>>
>>
Date: Sat, 07 Feb 2009 11:40:14 +0100
Message-ID: <498d650f$0$189$e4fe514c_at_news.xs4all.nl>
seannakasone schreef:
> 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_at_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 Received on Sat Feb 07 2009 - 04:40:14 CST