here is the detail for this package UTL_FILE
http://download-west.oracl
I guess in the above code, the file open mode should be w to be able to write, just check the page above for more information
Main Topics
Browse All TopicsWhat would be the fastest way of writing the contents of V$session to a file system every 10 minutes. Did anyone write similar code for thist?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
here is the detail for this package UTL_FILE
http://download-west.oracl
I guess in the above code, the file open mode should be w to be able to write, just check the page above for more information
i had t ofix a few things. do you know why it still does no twork.
1 create or replace PROCEDURE WRITESESSIONLOGS
2 AS
3 f UTL_FILE.file_type;
4 s VARCHAR2 (200);
5 BEGIN
6 -- LOG_DIR is a directory object in db that shows a physical path
7 f :=
8 UTL_FILE.fopen (' /tips/prd',
9 'Sessions_'
10 || TO_CHAR (SYSDATE, 'YYYYMMDD_HHMI')
11 || '.txt',
12 'W'
13 );
14 dbms_output.put_line ('SID osuser ');
15 dbms_output.put_line ('---- ---------- ');
16 FOR r IN (SELECT *
17 FROM v$session)
18 LOOP
19 dbms_output.put_line (r.SID || ', ' || r.osuser);
20 END LOOP;
21 utl_file.fCLOSE(f);
22* END;
23 /
Procedure created.
SQL> exec writesessionlogs
BEGIN writesessionlogs; END;
*
ERROR at line 1:
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 18
ORA-06512: at "SYS.UTL_FILE", line 424
ORA-06512: at "AVVADMIN.WRITESESSIONLOGS
ORA-06512: at line 1
when i do show parameter dir
it lists the parameter i included in the procedure.
Business Accounts
Answer for Membership
by: HainKurtPosted on 2009-11-06 at 15:46:35ID: 25764093
here is a sample code on how to write something into a text file
','sample1 .txt','R') ;
HHMI') || '.txt' from dual
declare
f utl_file.file_type;
s varchar2(200);
begin
f := utl_file.fopen('SAMPLEDATA
loop
utl_file.get_line(f,s);
dbms_output.put_line(s);
end loop;
exception
when NO_DATA_FOUND then
utl_file.fclose(f);
end;
write a stored proc (implement something above), create a job, schedule it to run every 10 minutes,
in the sp, dynamically create the filename using sysdate, to_char functions
similar to this one
select 'Sessions_' || to_char(sysdate,'YYYYMMDD_