Showing posts with label package. Show all posts
Showing posts with label package. Show all posts

Tuesday, March 20, 2012

Planning execution of package

How can i plan the execution of a package ?

For exemple, i want to execute it every 5 minutes from 8 AM to 20 PM

ThanksSQL Agent provides scheduled execution times etc. you can use to do such things.
Right click on the Agent node in Management Studio, select new job. Select the schedule tab and note that there are ways to schedule a job daily, and then sub obtions allow you to execute every x minutes or hours.|||

Great ! it works fine

|||Out of interest, what is it actually doing?

I'm just thinking that in some circumstances maybe it might be better to execute a package when some event occurs rather than continuously executing at defined intervals waiting for something to happen (if indeed this is what it is doing).

Another option might be the WMI EventWatcher task.

Just speculating of course...

-Jamie|||I use it to download stock quotes published on http server...|||Fair enough. SQL Agent is probably your best option then. I'll shutup now Smile

|||Smile I'm beginner then i listen everyone... your remarks are welcome....

ps : excuse my french accent...|||

Coroebus wrote:

Smile I'm beginner then i listen everyone... your remarks are welcome....

ps : excuse my french accent...

Your english is alot better than that of other people I have seen on many technical forums that speak it as their first language. Don't worry about that!

Friday, March 9, 2012

pl/sql package will not compile

hi,

trying to concat 1:m relationsships data to a string fails :

what did I do wrong?

PACKAGE denorm_PKG IS

FUNCTION GetNetz (ix_knoten IN knoten.id_knoten%TYPE,
ix_plan IN knoten.id_plan%TYPE) RETURN VARCHAR2 ;

END denorm_PKG;
/
PACKAGE BODY denorm_PKG AS

/*

*/
FUNCTION GetNetz (ix_knoten IN knoten.id_knoten%TYPE,
ix_plan IN knoten.id_plan%TYPE) RETURN VARCHAR2

IS
-- Cursor fr die Datenbankabfrage
CURSOR netzcrs (lv_netzwerkdienst n.netzwerkdienst%TYPE) IS

select n.netzwerkdienst

from netzwerkdienst n, knoten_netzwerkdienst kn

where n.id_netzwerkdienst = kn.id_netzwerkdienst

and kn.id_plan = ix_plan
and kn.id_knoten = ix_knoten;

tmpVar varchar2;
netz_rec netzcrs%ROWTYPE;
BEGIN
tmpVar := NULL;

IF NOT netzcrs%ISOPEN
THEN
OPEN netzcrs(lv_netzwerkdienst);
END IF;

FETCH netzcrs INTO netz_rec;
-- Schleife ber alle Resultdatenstze, konkateniert alle
netzwerkdienste
WHILE (netzcrs%FOUND)
LOOP
IF tmpVar is NULL
THEN
tmpVar := netz_rec.lv_netzwerkdienst;
ELSE
tmpVar := tmpVar ||','|| netz_rec.lv_netzwerkdienst;

END IF;
FETCH netzcrs INTO netz_rec;
END LOOP;

CLOSE netzcrs;

RETURN tmpVar;
END GetNetz;

END denorm_PKG;
/

Oracle Version 8.1.7.4

error msges are the following

SP2-0734: Unbekannter Befehl ab "PACKAGE de..." - restliche Zeile
ignoriert.
SP2-0734: Unbekannter Befehl ab "FUNCTION G..." - restliche Zeile
ignoriert.
SP2-0734: Unbekannter Befehl ab "ix_plan IN..." - restliche Zeile
ignoriert.
SP2-0734: Unbekannter Befehl ab "END denorm..." - restliche Zeile
ignoriert.
SP2-0044: Zum Auflisten bekannter Befehle HELP
und zum Verlassen EXIT eingeben.
END denorm_PKG;
*
FEHLER in Zeile 32:
ORA-06550: line 32, column 1:
PLS-00103: Encountered the symbol "END"

SP2-0734: Unbekannter Befehl ab "PACKAGE BO..." - restliche Zeile
ignoriert.
DOC>
DOC>*/
SP2-0734: Unbekannter Befehl ab "FUNCTION G..." - restliche Zeile
ignoriert.
SP2-0734: Unbekannter Befehl ab "ix_plan IN..." - restliche Zeile
ignoriert.
SP2-0042: Unbekannter Befehl "IS" - restliche Zeile wurde ignoriert.
SP2-0734: Unbekannter Befehl ab "CURSOR net..." - restliche Zeile
ignoriert.
SP2-0734: Unbekannter Befehl ab "from netzw..." - restliche Zeile
ignoriert.
SP2-0734: Unbekannter Befehl ab "where n.id..." - restliche Zeile
ignoriert.
SP2-0734: Unbekannter Befehl ab "and kn.id_..." - restliche Zeile
ignoriert.
SP2-0734: Unbekannter Befehl ab "and kn.id_..." - restliche Zeile
ignoriert.
SP2-0044: Zum Auflisten bekannter Befehle HELP
und zum Verlassen EXIT eingeben.
SP2-0734: Unbekannter Befehl ab "tmpVar var..." - restliche Zeile
ignoriert.
SP2-0734: Unbekannter Befehl ab "netz_rec n..." - restliche Zeile
ignoriert.
END denorm_PKG;
*
FEHLER in Zeile 32:
ORA-06550: line 32, column 1:
PLS-00103: Encountered the symbol "END"

SQL> PACKAGE denorm_PKG IS

SP2-0734: Unbekannter Befehl ab "PACKAGE de..." - restliche Zeile
ignoriert.
SQL>Hello,

which program do you use ... I never read such error statements !!!
As I was testing your posted package with AlligatorSQL, it compiles
with any error - except that I do not have your table "knoten".

Perhaps you have to place a "CREATE OR REPLACE" before your "PACKAGE BODY" and "PACKAGE" statement ?!!?

Hope that helps

Manfred Peter
(Alligator Company GmbH)
http://www.alligatorsql.com|||Originally posted by alligatorsql.com
Hello,

which program do you use ... I never read such error statements !!!
As I was testing your posted package with AlligatorSQL, it compiles
with any error - except that I do not have your table "knoten".

Perhaps you have to place a "CREATE OR REPLACE" before your "PACKAGE BODY" and "PACKAGE" statement ?!!?

Hope that helps

Manfred Peter
(Alligator Company GmbH)
http://www.alligatorsql.com

I 've used sqlplus and the stmts as a script.sql|||Hello,

do you have tested the "CREATE OR REPLACE PACKAGE"
command ?

Just insert "CREATE OR REPLACE" before your package and package specification.

Best regards
Manfred Peter
(Alligator Company GmbH)
http://www.alligatorsql.com

pl/sql job package

hi
does anyone know about job package. I want to know how can i use it to do following:
I want to write a procedure in oracle which will monitor a table which
contains a date field (containing a date>= system date). When the date
specified in the date field matches with the system date the row
containing the date should be deleted from the table.
As you must have noticed that the procedure should run 24x7 and
continuously monitor the table.
How to do that?
Please helpuse the DBMS_JOB package, which is documented here:

http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_job.htm#999107|||i am new to using these packages.
Could you please tell me how to use the DBMS_JOB package to do the aforementioned task.
thanks
Originally posted by andrewst
use the DBMS_JOB package, which is documented here:

http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_job.htm#999107|||This will set up a job to run the stored procedure called myproc immediately, and then every minute thereafter (1 minute = 1/1440 days). Change the frequency to whatever value you require.

Put whatever you need to do in the stored procedure called myproc (well, probably called something more sensible than that).

declare
job integer;
begin
dbms_job.submit( job, 'myproc;', sysdate, 'sysdate+1/1440' );
commit;
end;
/

You need to check that your database is configured to run job queues:

select name, value from v$parameter
where name like 'job_queue%';

You should see a value for job_queue_processes > 0 otherwise no jobs will run. job_queue_interval is the number of seconds Oracle waits between running jobs. If you schedule your job to run more frequently than that, it won't.|||it did not work. i did the following to check the package
SQL> create table temp
2 (
3 current_date date
4 );

Table created.

SQL> create or replace procedure temp_precedure
2 is
3 begin
4 INSERT INTO TEMP VALUES(SYSDATE);
5 END;
6 /

Procedure created.
SQL> declare
2 job integer;
3 begin
4 dbms_job.submit(job,'temp_precedure;',sysdate,'sys date+1/1440');
5 commit;
6 end;
7 /

PL/SQL procedure successfully completed.

I monitored the table for 5 min and no rows where added to the table.
When i manually executed the procedure it successfully added new row to the table.
also i got following error
SQL> select name, value from v$parameter where name like 'job_queue%';
select name, value from v$parameter where name like 'job_queue%'
*
ERROR at line 1:
ORA-00942: table or view does not exist

I was working on a remote database on the intranet. I have a student login ( I am a student). I am using Oracle 8i Enterprise Edition installed on Sun Solaris. I access it on win2kpro using oracle 8i enterprise ed. client(sqlplusw).

please help
thanks
Originally posted by andrewst
This will set up a job to run the stored procedure called myproc immediately, and then every minute thereafter (1 minute = 1/1440 days). Change the frequency to whatever value you require.

Put whatever you need to do in the stored procedure called myproc (well, probably called something more sensible than that).

declare
job integer;
begin
dbms_job.submit( job, 'myproc;', sysdate, 'sysdate+1/1440' );
commit;
end;
/

You need to check that your database is configured to run job queues:

select name, value from v$parameter
where name like 'job_queue%';

You should see a value for job_queue_processes > 0 otherwise no jobs will run. job_queue_interval is the number of seconds Oracle waits between running jobs. If you schedule your job to run more frequently than that, it won't.|||You'll need to contact your DBA about this.|||Thanks it worked. i did not have the priveledge of issuing a job.
But what about the following:

SQL> select name, value from v$parameter where name like 'job_queue%';
select name, value from v$parameter where name like 'job_queue%'
*
ERROR at line 1:
ORA-00942: table or view does not exist

I searched oracle 8i complete reference and could not find the aforementioned table.
Thanks
Originally posted by andrewst
You'll need to contact your DBA about this.|||Hi andrewst,

Is there any processing time taken by oracle which increases the interval by a second?

I kept the interval as sysdate+1/1440

And the time stamp of the records inserted by procedure in job queue is

TO_CHAR(START_DATE,'
-------
15-dec-2003 19:15:56
15-dec-2003 19:16:57
15-dec-2003 19:17:59
15-dec-2003 19:19:00
15-dec-2003 19:20:02
15-dec-2003 19:21:03
15-dec-2003 19:22:05

As we can see at every step, its either 61 seconds of 62 seconds. What could be the reason?

Thanks,

Originally posted by andrewst
This will set up a job to run the stored procedure called myproc immediately, and then every minute thereafter (1 minute = 1/1440 days). Change the frequency to whatever value you require.

Put whatever you need to do in the stored procedure called myproc (well, probably called something more sensible than that).

declare
job integer;
begin
dbms_job.submit( job, 'myproc;', sysdate, 'sysdate+1/1440' );
commit;
end;
/

You need to check that your database is configured to run job queues:

select name, value from v$parameter
where name like 'job_queue%';

You should see a value for job_queue_processes > 0 otherwise no jobs will run. job_queue_interval is the number of seconds Oracle waits between running jobs. If you schedule your job to run more frequently than that, it won't.|||The reason would be that your job takes 1-2 seconds to run, so that by the time it evaluates sysdate+1/1440, sysdate is 1-2 seconds later than the start of this run.

You can compensate for that like this:

trunc(sysdate,'mi')+1/1440

Now it will always run exactly on the minute. Of course, if the job ever takes more than 1 minute to run then it will skip a run.

Pkg Execution Works in VS but not in SQL

I'm able to execute a package in VS Pro on my machine. However when I upload it to the sql server and try to execute the package directly it fails with:

Error: The product level is insuficient for component "...." (3129)
Error: The product level is insuficient for component "...." (5411)

The first component is a DataReader Source which is consuming an ODBC (Noble Systems ATOMIX Driver) connection and the second component is a DataConversion object. Anyone know why this would work running it on my pc in VS but not when I execute it from SQL on the same machine?

This is a silly question but are SSIS components installed on your sql server?

The error message looks similar to an error message I had once. I was trying to execute maintenance plans (which uses SSIS) and I had not installed the components.

|||

Jason's suggeston is a good one. You only need to install client components off the CD in order to build packages. You need to install SSIS to execute them outside of BIDS/VS.

-Jamie

|||

Yes, SSIS is installed. I can log into the service and can successfully run and schedule 'hello world' packages. As a developer I'm locked out of this system but I am trying to get access to the app logs to see if they reveal something.

I'm really at a loss. Since I'm executing the package it should be using the odbc driver from my pc as well as the dsn config right? Based on my description of the objects that threw the error(s) am I trying to use a feature that is only available in the enterprise edition?

|||

How are you executing the package?

Donald

|||

from within SMS-->Stored Packages-->MSDB--><Subfolder>--><MyPackage>

I right click on package and select Run Package.

thanks,
Scott

|||All components work in VS reguardless of the version required to run those components. The version checks come in only when you run the package outside the VS environment. What version of SSIS is installed on the server?|||

v.9.0.1399 (pre SP1)

|||Sorry, what product level. Also, list all the types of components in the entire package.|||

Ah, sorry about that.

All of the following components are installed on a single Win3k server (flavor and sp level n/a but I can find out if necessary) Sql standard edition:

Database Engine
SSIS
SSRS

|||

One - I got this message when running the package on my local machine with Enterprise Manager connected to the server.To fix this, you need to install the SSIS Service on your local machine. When you installed SQL 2005, you only installed the workstation components and the workstation product level is missing some components. Installing the SSIS Service will include the components needed to run SSIS on your local machine.

Two - If you are remote in to your server and you are getting this message, then you might have a Fuzzy lookup task that only works with the Enterprise Edition.

Hope that help.

|||Does anyone know if this will be a licensing issue?|||

Installing the SSIS component locally on my machine resolved this issue. However, I'm concerned about this behavior (i.e. not being able to execute a package that is on a server from a remote machine via Mgt Studio).

Maybe someone at Microsoft can answer this:

If I have a full install of the client tools and even a full install of VS05 Pro, why do I need to explicity installl the SSIS server component on my local machine to run packages located on a remote server (sql 2005 standard w/out sp1)? I spent a lot of time troubleshooting this error (as did a number of members of this forum) and I can't help but think that this should have worked out of the box.