INSERT INTO fw_demo_tbl_output (message, row1) VALUES (v_message, v_row1) Ĭreate a Program object with a Metadata argument (what will happen when the file watcher event is raised). Src_filename => p_fileinfo.actual_file_name,ĭest_filename => p_fileinfo.actual_file_name||'.'||to_char(SYSDATE, 'YYMMDDHH24MISS'), move the file to the old directory with a new name V_file := utl_file.fopen('DEMO_DIR', p_fileinfo.actual_file_name, 'R') V_message := p_fileinfo.directory_path||'/'|| PROCEDURE fw_demo_proc (p_fileinfo SYS.SCHEDULER_FILEWATCHER_RESULT) AS SELECT * FROM dba_scheduler_file_watchers Ĭreate a table and the procedure that will be used by the file watcher. The file watcher is not enabled yet (enabled => FALSE).įile_watcher_name => 'demo_file_watcher', The next step is to create the file watcher. Now, logged in as fw_test_usr we need to set up OS privilege for file access. The file watchers will by default check for files every 10 minutes, we will decrease that to every minute. GRANT read, write ON DIRECTORY demo_old_dir TO fw_test_usr GRANT read, write ON DIRECTORY demo_dir TO fw_test_usr ĬREATE OR REPLACE DIRECTORY demo_old_dir AS '/home/oracle/tmp/old' GRANT connect, resource, dba TO fw_test_usr ĬREATE OR REPLACE DIRECTORY demo_dir AS '/home/oracle/tmp' When new files arrives the specified job will start.Ĭreate a new user and directory CREATE USER fw_test_usr IDENTIFIED BY test You can create a file watcher that will let you monitor a folder for files.Execute host scripts on remote servers (requires an agent on the remote server). Possible to create chains of jobs that are dependent of each other.
0 Comments
Leave a Reply. |