Help: I want to auto schedule a load using file watcher but it runs only once for the first time and after that it is not running at all
Hi All,
I am trying to execute the below code as provided from one of the blogs. i am able to run the job only once based on a file watcher object(i.e. for very first time) and after that the job is not running at all and if i schedule the job to run automatically based on interval of 10 or more minutes it is executing properly). Please let me know or guide me if i have missed any step or configuration.that is needed.
Version of Oracle 11.2.0.1.0
OS : Windows 7 Prof
Given all the necessary privileges
BEGIN
DBMS_SCHEDULER.CREATE_CREDENTIAL(
credential_name => 'cred',
username => 'XXXX',
password => 'XXXX');
END;
CREATE TABLE ZZZZ (WHEN timestamp, file_name varchar2(100),
file_size number, processed char(1));
CREATE OR REPLACE PROCEDURE YYYY
(payload IN sys.scheduler_filewatcher_result) AS
BEGIN
INSERT INTO ZZZZ VALUES
(payload.file_timestamp,
payload.directory_path || '/' || payload.actual_file_name,
payload.file_size,
'N');
END;
BEGIN
DBMS_SCHEDULER.CREATE_PROGRAM(
program_name => 'prog1',
program_type => 'stored_procedure',
program_action => 'YYYY',
number_of_arguments => 1,
enabled => FALSE);
DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT(
program_name => 'prog1',
metadata_attribute => 'event_message',
argument_position => 1);
DBMS_SCHEDULER.ENABLE('prog1');
END;
BEGIN
DBMS_SCHEDULER.CREATE_FILE_WATCHER(
file_watcher_name => 'file_watcher1',
directory_path => 'D:\AAAA',
file_name => '*.txt',
credential_name => 'cred',
destination => NULL,
enabled => FALSE);
END;
BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'job1',
program_name => 'prog1',
queue_spec => 'file_watcher1',
auto_drop => FALSE,
enabled => FALSE);
DBMS_SCHEDULER.SET_ATTRIBUTE('job1','PARALLEL_INSTANCES',TRUE);
END;
EXEC DBMS_SCHEDULER.ENABLE('file_watcher1,job1');
Regards,
kumar.
Please post a copy and paste of a complete run of a test case, similar to what I have shown below.
SCOTT@orcl12c> SELECT banner FROM v$version
2 /
BANNER
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
PL/SQL Release 12.1.0.1.0 - Production
CORE 12.1.0.1.0 Production
TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
NLSRTL Version 12.1.0.1.0 - Production
5 rows selected.
SCOTT@orcl12c> CONN / AS SYSDBA
Connected.
SYS@orcl12c> -- set file watcher interval to one minute:
SYS@orcl12c> BEGIN
2 DBMS_SCHEDULER.SET_ATTRIBUTE
3 ('file_watcher_schedule',
4 'repeat_interval',
5 'freq=minutely; interval=1');
6 END;
7 /
PL/SQL procedure successfully completed.
SYS@orcl12c> CONNECT scott/tiger
Connected.
SCOTT@orcl12c> BEGIN
2 -- create credential using operating system user and password (fill in your own):
3 DBMS_SCHEDULER.CREATE_CREDENTIAL
4 (credential_name => 'cred',
5 username => '...',
6 password => '...');
7 END;
8 /
PL/SQL procedure successfully completed.
SCOTT@orcl12c> -- create table to insert results into:
SCOTT@orcl12c> CREATE TABLE ZZZZ
2 (WHEN timestamp,
3 file_name varchar2(100),
4 file_size number,
5 processed char(1))
6 /
Table created.
SCOTT@orcl12c> -- create procedure to insert results:
SCOTT@orcl12c> CREATE OR REPLACE PROCEDURE YYYY
2 (payload IN sys.scheduler_filewatcher_result)
3 AS
4 BEGIN
5 INSERT INTO ZZZZ VALUES
6 (payload.file_timestamp,
7 payload.directory_path || '/' || payload.actual_file_name,
8 payload.file_size,
9 'N');
10 END;
11 /
Procedure created.
SCOTT@orcl12c> -- create program, define metadata, and enable:
SCOTT@orcl12c> BEGIN
2 DBMS_SCHEDULER.CREATE_PROGRAM
3 (program_name => 'prog1',
4 program_type => 'stored_procedure',
5 program_action => 'YYYY',
6 number_of_arguments => 1,
7 enabled => FALSE);
8 DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT(
9 program_name => 'prog1',
10 metadata_attribute => 'event_message',
11 argument_position => 1);
12 DBMS_SCHEDULER.ENABLE ('prog1');
13 END;
14 /
PL/SQL procedure successfully completed.
SCOTT@orcl12c> BEGIN
2 -- create file watcher:
3 DBMS_SCHEDULER.CREATE_FILE_WATCHER
4 (file_watcher_name => 'file_watcher1',
5 directory_path => 'c:\my_oracle_files',
6 file_name => 'f*.txt',
7 credential_name => 'cred',
8 destination => NULL,
9 enabled => FALSE);
10 END;
11 /
PL/SQL procedure successfully completed.
SCOTT@orcl12c> BEGIN
2 -- create job:
3 DBMS_SCHEDULER.CREATE_JOB
4 (job_name => 'job1',
5 program_name => 'prog1',
6 queue_spec => 'file_watcher1',
7 auto_drop => FALSE,
8 enabled => FALSE);
9 -- set attributes:
10 DBMS_SCHEDULER.SET_ATTRIBUTE ('job1', 'PARALLEL_INSTANCES', TRUE);
11 END;
12 /
PL/SQL procedure successfully completed.
SCOTT@orcl12c> -- enable:
SCOTT@orcl12c> EXEC DBMS_SCHEDULER.enable ('file_watcher1, job1');
PL/SQL procedure successfully completed.
SCOTT@orcl12c> -- write file (file must not exist previously):
SCOTT@orcl12c> CREATE OR REPLACE DIRECTORY upncommon_dir AS 'c:\my_oracle_files'
2 /
Directory created.
SCOTT@orcl12c> declare
2 filtyp utl_file.file_type;
3 begin
4 filtyp := utl_file.fopen ('UPNCOMMON_DIR', 'file1.txt', 'W', NULL);
5 utl_file.put_line (filtyp, 'File has arrived ' || SYSTIMESTAMP, TRUE);
6 utl_file.fclose (filtyp);
7 end;
8 /
PL/SQL procedure successfully completed.
SCOTT@orcl12c> -- wait long enough (may take more than one minute) for job to run:
SCOTT@orcl12c> EXEC DBMS_LOCK.SLEEP (100)
PL/SQL procedure successfully completed.
SCOTT@orcl12c> -- check for results:
SCOTT@orcl12c> SELECT * FROM zzzz
2 /
WHEN
FILE_NAME
FILE_SIZE P
22-OCT-13 10.12.28.309000 PM
c:\my_oracle_files/file1.txt
57 N
1 row selected.
SCOTT@orcl12c> declare
2 filtyp utl_file.file_type;
3 begin
4 filtyp := utl_file.fopen ('UPNCOMMON_DIR', 'file2.txt', 'W', NULL);
5 utl_file.put_line (filtyp, 'File has arrived ' || SYSTIMESTAMP, TRUE);
6 utl_file.fclose (filtyp);
7 end;
8 /
PL/SQL procedure successfully completed.
SCOTT@orcl12c> -- wait long enough (may take more than one minute) for job to run:
SCOTT@orcl12c> EXEC DBMS_LOCK.SLEEP (100)
PL/SQL procedure successfully completed.
SCOTT@orcl12c> -- check for results:
SCOTT@orcl12c> SELECT * FROM zzzz
2 /
WHEN
FILE_NAME
FILE_SIZE P
22-OCT-13 10.12.28.309000 PM
c:\my_oracle_files/file1.txt
57 N
22-OCT-13 10.14.08.580000 PM
c:\my_oracle_files/file2.txt
57 N
2 rows selected.
Similar Messages
-
Anyone out there that can maybe help. I was using my 5s to record my meeting minutes for the first time and clicked cancel cos I wanted to continue recording and instead deleted it all! :( anyway to get it back?
The other Allan is being facetious--you somehow found the forum for pre-2006 eMac desktop computers that gets little traffic.
Getting you moved to the iPhone forums. -
Please help me. I've just lost my iphone so I related to my backup contacts on icloud to get my contacts back. But my contacts only show at the first time and then they dissappeared, my contacts was empty. How can I see my contacts?
If they aren't on icloud.com they are no longer in iCloud. If you don't have another backup, I'm afraid they're gone.
-
i have accesed my icloud for the first time today excpecting there to be photos on there wich i backed up on my old phone but they are not on there atall please help as there is alot of photos of my child
Hello chelsey69,
I read your post, and it sounds as though you'd like to learn more about Photostream. I have linked to an article that will instruct you on how it works:
Turn on Photo Stream - iCloud - iPhone Basics - Apple Support
http://support.apple.com/kb/TI70
Thank you for contributing to Apple Support Communities.
Cheers,
BobbyD -
I've been trying to download songs but I can't...help me please.
From a Kappy post
The Three Best Alternatives for Security Questions and Rescue Mail
1. Use Apple's Express Lane.
Go to https://expresslane.apple.com ; click 'See all products and services' at the
bottom of the page. In the next page click 'More Products and Services, then
'Apple ID'. In the next page select 'Other Apple ID Topics' then 'Forgotten Apple
ID security questions' and click 'Continue'. Please be patient waiting for the return
phone call. It will come in time depending on how heavily the servers are being hit.
2. Call Apple Support in your country: Customer Service: Contact Apple support.
3. Rescue email address and how to reset Apple ID security questions.
A substitute for using the security questions is to use 2-step verification:
Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID. -
Facetime worked on my I phone but not my MBP. im not sure what it means by saying check network connection.
Its just cause they at getting smashed and there servers are not running as smooth having same probs with I message just give it a day
-
Why won't my camera work? I used the screen shot for the first time and since i did that every time i take a picture the shutter closes as though it's taking it but no picture gets taken...help! Any suggestions?
Hey briannagrace96,
Welcome to Apple Support Communities! I'd check out the following article, it looks like it applies to your situation:
iPod: Appears in Windows but not in iTunes
http://support.apple.com/kb/ts1363
You'll want to go through the following troubleshooting steps, and for more detail on each step follow the link to the article above:
Try the iPod troubleshooting assistant:
If you have not already done so, try the steps in the iPod Troubleshooting Assistant (choose your iPod model from the list).
If the issue remains after following your iPod's troubleshooting assistant, follow the steps below to continue troubleshooting your issue.
Restart the iPod Service
Restart the Apple Mobile Device Service
Empty your Temp directory and restart
Verify that the Apple Mobile Device USB Driver is installed
Change your iPod's drive letter
Remove and reinstall iTunes
Disable conflicting System Services and Startup Items
Update, Reconfigure, Disable, or Remove Security Software
Deleting damaged or incorrect registry keys
Take care,
David -
Help I just hooked up my iPhone to my laptop for the first time and i accidentally chose to have it read it as my ipod so all my pictures were deleted off of it. I had not backed it up before. Is there anything I can do? Please tell me my photos aren't gone :[
Did you by chance have photo stream turned on? If so then they might be there. When you restored your phone it deleted everything and they will be unretreivable from your computer.
-
I installed Apple TV yesterday and then purchased and watched a film for the first time. Today Apple TV does not accept my pass word. I' m confused can any one help me?
there are up to 3 different password
there is the appleID password
there is the wifi encryption password
there is te shared itunes lib password -
I just synched for the first time, and lost all my apps. Help?
I just sync'd my Iphone for the first time, and lost all my apps. Help?
Ya that sucked, same thing happened to me, however i was looking for an excuse to clean up my phone, so i was not to angry when it happened. As for a remedy to the situation, i have no idea
-
I need help, i just synced my iphone3gs for the first time and now most of my apps wont work
I just used itunes for the first time to sync my iphone 3GS!!! Now, half of my apps will not work! Any suggestions? I touch on the app and it flashes real fast then back to my home screen... HELP PLEASE!!!!
Try to reset the phone by holding the sleep and home button for at least 10 sec, until the Apple logo comes back.
If this does not work, restore the phone. Restoring is covered here: http://support.apple.com/kb/HT1414 -
Hi all.
I decided to purchase Lee Evans Audiobook last night! I'm new to this kind of thing this was my first!
The problem being is that I cannot find it anywhere, let alone listen to it!!!
When I go in to ITunes and select the audiobook it states that it has been downloaded... Please help one confused incompetent person hahaIf you downloaded it on your iPad then have you checked to see whether it's in the Music app (iTunes on the iPad it just the store, it doesn't contain your downloaded nor synced content) ? When you have audiobooks on an iPad you will get an Audiobooks option under the More button at the bottom of the Music app.
Note that audiobooks are currently a one-time only download from the store (so they won't appear in the Purchased tab in the iTunes store app for re-downloading), so you may want to copy it to your computer's iTunes via File > Devices > Transfer Purchases so that you can take a backup copy of it - it should copy over to the Books part of your computer's iTunes library. -
I cannot remember the answeres to my security questions, please help.
You need to ask Apple to reset your security questions; this can be done by phoning AppleCare and asking for the Account Security team, or clicking here and picking a method, or if your country isn't listed in either article, filling out and submitting this form.
They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
(105959) -
Synced phone for the first time, and all my contacts are gone. Please help
I had to upgrade the iOS to 5. And all of the contacts are gone. Is there a way to recover them?
How did you get the contacts loaded onto the iPhone in the first place?
If you used iTunes that would imply the "source" of contacts was either on your computer (e.g. Outlook) or perhaps through a one-time upload from an e-mail service like GMail. In either case, your contacts should (might) still be where they were when you originally put them onto your iPhone.
If all your contacts were manually entered into the iPhone, then you're out of luck since they are not backed up, unless you set iCloud up to sync your contacts (in which case they'd still be in iCloud).
Maybe you are looking for
-
Why can't I use the Emoji keyboard on my IPad Air?
-
Problem deploying message driven bean using Log4j
Hello all. Using JDeveloper 11.1.1.0.2, I'm having a problem with a message driven bean I've created and associated with a JMS queue. I've created an EJB Module project in my application (in which some other projects exist), and created the bean. A s
-
This might sound ridiculous but here it goes: I accidentally hit a couple keys on my netbook keyboard. This made a toolbar pop up on the left side of the window. It's vertical and has a search field at the top, then listed underneath are my bookmark
-
How to save a variant when running a transaction (PU19)
Hello everyone: PU19 is the tax reporter transaction but when you run it there is no provision to save a variant. User has to select lot of data onb selection screen and they don't want to do this everytime they run the program and instead s
-
Hi, Can anyone briefly explain me abt Business process of SD Module or Give a diagramatic link explaining Business process of SD Module(IIIly for FI/CO and MM also) with explaination.