- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- possible file lock error
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-06-2008 09:42 AM
тАО01-06-2008 09:42 AM
possible file lock error
I am trying to create a file dynamically on a unix server using plsql.
When i run the procedure,i am getting the below error.
"ORA-20103: Invalid Operation"
I also created a temporary file (with permissions 777) and yet nothing was written in the file.
Please find the plsql procedure below:
CREATE OR REPLACE procedure schema.WriteProcedure
is
f UTL_FILE.FILE_TYPE;
var_id number(22);
var_intid varchar2(20);
cursor file_cur is select col1,col2 from schema.table;
begin
f := UTL_FILE.FOPEN('/home/gyan/tst','Dynamic-file-'|| to_char(sysdate, 'mm-dd-yyyy'),'W');
open file_cur;
loop
fetch file_cur into var_id,var_intid;
exit when file_cur%notfound;
UTL_FILE.PUT_LINE(f,var_id || '|' || var_intid );
end loop;
close file_cur;
UTL_FILE.FCLOSE(f);
UTL_FILE.FCLOSE_ALL;
EXCEPTION
WHEN UTL_FILE.INVALID_PATH THEN
RAISE_APPLICATION_ERROR(-20100,'Invalid Path');
WHEN UTL_FILE.INVALID_MODE THEN
RAISE_APPLICATION_ERROR(-20101,'Invalid Mode');
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
RAISE_APPLICATION_ERROR(-20102,'Invalid Filehandle');
WHEN UTL_FILE.READ_ERROR THEN
RAISE_APPLICATION_ERROR(-20104,'Read Error');
WHEN UTL_FILE.WRITE_ERROR THEN
RAISE_APPLICATION_ERROR(-20105,'Write Error');
WHEN UTL_FILE.INTERNAL_ERROR THEN
RAISE_APPLICATION_ERROR(-20106,'Internal Error');
WHEN VALUE_ERROR THEN
RAISE_APPLICATION_ERROR(-20108,'Value Error');
WHEN UTL_FILE.INVALID_OPERATION THEN
RAISE_APPLICATION_ERROR(-20103,'Invalid Operation ');
when others then
dbms_output.put_line('done');
end;
/
Regards,
Gyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-06-2008 09:59 AM
тАО01-06-2008 09:59 AM
Re: possible file lock error
This is a user specified error message
I think you can contact with your application vendor.
This is mostly happen in application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2008 02:43 AM
тАО01-07-2008 02:43 AM
Re: possible file lock error
Some suggestions:
-- Before opening the files, check if they aren't already open:
if TEXT_IO.IS_OPEN(f) then
TEXT_IO.FCLOSE(f);
end if;
-- Check if you have write permissions all the way to /home/gyan/tst
-- Try the fopen command this way (added a slash after /home/gyan/tst and lowered the "W" case:
f := UTL_FILE.FOPEN('/home/gyan/tst/','Dynamic-file-'|| to_char(sysdate, 'mm-dd-yyyy'),'w');
Best Regards,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2008 08:44 AM
тАО01-07-2008 08:44 AM
Re: possible file lock error
Before opening the files, check if they aren't already open:
I am dynamically creating the file(with timestamp),so this would not apply for my case
-- Check if you have write permissions all the way to /home/gyan/tst
I am logging in as user gyan and have write permissions(umask 022)
Try the fopen command this way (added a slash after /home/gyan/tst and lowered the "W" case:
I did the same but still no success.
I tried to remove all the exception statements and got the below error
ORA-29283: invalid file operation
Does the above exception mean i am having privilege problems to execute the procedure?
Regards,
Gyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2008 09:54 AM
тАО01-07-2008 09:54 AM
Re: possible file lock error
Normally, the oracle user should have read privileges on that directory at the OS level ..
can you confirm this?
revert
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2008 10:21 AM
тАО01-07-2008 10:21 AM
Re: possible file lock error
the db username (eaxee) is the owner of the procedure.I am logging in as user "gyan" to the server(unix).My database resides on the same unix server(not somewhere remotely).
Regards,
Gyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2008 10:46 AM
тАО01-07-2008 10:46 AM
Re: possible file lock error
And the unix user (gyan) can create/delete/modify files under /home/gyan/tst
Regards,
Gyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2008 01:42 AM
тАО01-08-2008 01:42 AM
Re: possible file lock error
Try 3 more things:
1- Please recheck the write permissions as gyan (I'm insisting this because /home... is a root path and you should consider using a no root directory) with the touch command:
$touch /home/gyan/tst/x
2- Ok, utl_file.fopen has 4 possible parameters and the last one can be null (I was relying on Reports text_io.fopen). Retry the function without the slash in the end of location parameter, with an extension in the filename parameter and with a lowered "w" at the open_mode parameter. Also add some debugging to have an idea where is the exception (make sure SERVEROUTPUT is ON):
dbms_output.put_line('I am opening the following file: '||'/home/gyan/tst','Dynamic-file-'||to_char(sysdate, 'mm-dd-yyyy')||'.txt');
f := UTL_FILE.FOPEN('/home/gyan/tst','Dynamic-file-'||to_char(sysdate, 'mm-dd-yyyy')||'.txt','w');
dbms_output.put_line('I successfuly opened the following file: '||'/home/gyan/tst','Dynamic-file-'||to_char(sysdate, 'mm-dd-yyyy')||'.txt');
Best Regards,
Eric Antunes