Showing posts with label scheduler. Show all posts
Showing posts with label scheduler. Show all posts

Friday, March 30, 2012

Scheduling stored proc.

How do you schedule stored procedures? I can see no way of linking them to the job scheduler.
Also, how do I time the stored proc. schedule to activate after a scheduled DTS package?
Thanks again guys!OK, I see how to schedule a stored proc...by just scheduling an execute command.

But I still cant see how to time this with the scheduling of a DTS package.|||You create a new DTS.
You drop your connection,
You drop "Execute SQL TASK". You write your SQL-query

(example: "exec myproc")

you choose "save as" and name your DTS.
Now you will have a DTS in the list, and you right click on it and choose "Scedule Package"

Good luck!|||Its possible to execute and schedule a stored procedure using job scheduler just mention SP name and select connected database, schedule it.

Friday, March 23, 2012

Scheduler UTC problem

Hi all,

I'm having trouble to implement an "scheduler" in a stored procedure with UTC date.

In one table (ScheduleCfg) I have one field that indicates which days of the week my banner must be exhibited, separated by commas (e.g. 0,5,6)
In my table "Schedule", I have a datetime field that indicates which is the next time that the banner must be shown.
(To explain: I have a process which runs every hour to republicate the banners and recalculate the next exhibition hour).

My SP gets the "Last Display" datetime and sums one hour... If the day still the same, then the new value of "Next Display" is this value.
But if it changes the day, then I'll have to verify if the new day's dayofweek number matches with the tables...

Until this everything works fine... But all my problem is: UTC TIME!

My application is globalizated, so many countries can use it. All the dates stored in my database must be UTC, so here's my problem:

When I sum one hour, I'm using the UTC date. So the "turn of the day" occurs in a different moment. For example, in Brazil the TimeZone is -3 hours, so when the day changes it will be 9 o'clock in Brazil. (because it's 0h UTC, so the Brazil's local time will be 9h PM of the day before...)

Anyone can help me?
I've been thinking about it for weeks and I couldn't find a good solution...

Thanks in advance.

This should work. I've used the difference between the GetUTCDate and GetDate functions to get the difference between the local timezone and UTC. Here is my suggested approach:

Code Snippet

--This variable contains the last saved date

Declare @.LastDisplay as Datetime

--Retrieve the value from the 'Schedule' table

--Retrieve the number of hours difference between the local timezone and UTC

Declare @.HourDiff as Int

Select @.HourDiff = DateDiff(hour, GetUTCDate(), GetDate())

--Calculate the next schedule date taking into consideration the timezone difference and adding an hour

Declare @.NextDisplay as Datetime

Set @.NextDisplay = DateAdd(hour, 1 + @.HourDiff, @.LastDisplay)

Select @.NextDisplay

--Check the difference between the last date (in UTC) and the new date (local time)

If DateDiff(day, @.LastDisplay, @.NextDisplay) = 1

Begin

--The day has changed

End

Else

Begin

-- The day has not changed

End

The DateDiff at the end, compares the last date the schedule ran which is saved in UTC with the new calculated date which is in local time. If the difference is not 0 then this is a new date and you can perform the logic that you want.

I hope this answers your question.

Best regards,

Sami Samir

|||Hmmm. Good idea..
I'll try to pass a parameter with the time difference, since my SQL Server does not know which country is calling..

Thank you!!!!

Scheduler not yielding?

All,

I'm getting the following error in my SQL logs:

Process 51:16 (2bc) UMS Context 0x1249F118 appears to be non-yielding on Scheduler 0.

I killed the process, but it's been rolling back for 3 hours. It's done zero IO and consumed a TON of CPU time.

Any suggestions as to what I can do?

Thanks,

Isaacpost details abt scheduler job.Are u executing DBCC DBREINDEX in that scheduler? what version of SQL server u are using? I hope it is SQL server 2000.If it is did u applied latest service pack?

Scheduler node deadlock message.

Hi:

We seem to be hitting a performance problem on SQL Server 2005. We encounter the following message frequently in the event log. We have update stats, reindexing and everything else in place. However this message keeps getting logged.

All schedulers on Node 0 appear deadlocked due to a large number
of worker threads waiting on LCK_M_IS. Process Utilization 25%%

MS Experts (Product Gurus)/MVPs can you please offer some explanation or insight into the error and also a possible resolution on how to fix it. I have the following questions:

1). Is this related to poor queries performing badly and needs to be tuned?.

2). Is this a more DIsk I/O Issue and whether we need faster disks or disk arrays?

3). Is something configured wrongly on the SQL Server?

4). Are we handling our transactions badly and thus resulting in blocking or deadlocks?.

Please provide your valuable suggestions.

Thanks

Ankith

I forgot to mention the system configuration.

The Server is Windows Server 2003 (x64 Edition) with AMD Quad (4) Processors (2.2 GHZ) and has apprx 16 GB of RAM.

Awe is enabled.

|||

This message indicates that there are some pretty long blocking chains on your server.

Have a look at the blocking section in http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx for methods of troubleshooting blocking issues.

|||

Hi Jerome:

Thanks for the info. Is this error anyway related to Hard disk contention (because I see worker threads waiting on LCK_M_IS). Just want to get your opinion and see if we can also take a look at our hard disks.

Thanks.

|||

Based on the wait type it's highly unlikely that disk issues have anything to do with the problem. Start by looking at the connection that's holding incompatible lock and determine what it's doing.

sql

Scheduler Mystery

I have a scheduled job that executes sql to dump tran with no log. I have i
t
running at night so no users are affected. The next morning the job says it
succeded with no errors accounted for. However I have checked the size of
the ldf and it is huge. Our server space is getting smaller and smaller
every day, so I am suspect that the log file is not being truncated. When I
checked the SQL server event viewer, it shows an Error application event whe
n
the truncate process is started. Can anyone tell me why the scheduled job
shows a successfull run, while the event viewer tells another story?What version of SQL Server?

>I have a scheduled job that executes sql to dump tran with no log.
As of 7.0, we use BACKUP instead of DUMP, but DUMP is still allowed. Anyhow,
this doesn't shrink
physical file size. Are you doing regular transaction log backups? If nor, u
se simple recovery
model. If you are, don't just cut the log as it will break the log backup se
quence.
As for shrinking the file size, I've listed a number of articles in this art
icle:
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Toco" <Toco@.discussions.microsoft.com> wrote in message
news:723A119C-5D64-4C36-9865-9BD8FBAF2775@.microsoft.com...
>I have a scheduled job that executes sql to dump tran with no log. I have
it
> running at night so no users are affected. The next morning the job says
it
> succeded with no errors accounted for. However I have checked the size of
> the ldf and it is huge. Our server space is getting smaller and smaller
> every day, so I am suspect that the log file is not being truncated. When
I
> checked the SQL server event viewer, it shows an Error application event w
hen
> the truncate process is started. Can anyone tell me why the scheduled job
> shows a successfull run, while the event viewer tells another story?

Scheduler is hung

I have a SQL 2000 with sp3 recently connected to the NetApps filer. For
the last two days the SQL Server keeps hanging. I can't even log on to
the machine, can't open enterprise manager. We have to bounce the
server. The errorlog indicates:
2004-03-01 17:07:20.38 server Error: 17883, Severity: 1, State: 0
2004-03-01 17:07:20.38 server The Scheduler 0 appears to be hung.
SPID 0, ECID 0, UMS Context 0x03469860.
2004-03-01 17:07:20.38 server Error: 17883, Severity: 1, State: 0
2004-03-01 17:07:20.38 server The Scheduler 1 appears to be hung.
SPID 59, ECID 0, UMS Context 0x0346BC48.
2004-03-01 17:08:20.39 server Error: 17883, Severity: 1, State: 0
2004
What does it mean by the scheduler? Is this where the Enterprise
manager runs all the scheduled jobs?
Have any ideas as to what's going on?
Thanks,
Raziq.
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!It could be:
FIX: The Checkpoint Process Can Delay SQL Server Database Activity and Does
Not Yield Scheduler Correctly Causing Error: 17883 to Occur
http://support.microsoft.com/defaul...6&Product=sql2k
Known bug. Call PSS to confirm and get the hotfix.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Raziq Shekha" <raziq_shekha@.anadarko.com> wrote in message
news:uluFM4GAEHA.2432@.TK2MSFTNGP11.phx.gbl...
> I have a SQL 2000 with sp3 recently connected to the NetApps filer. For
> the last two days the SQL Server keeps hanging. I can't even log on to
> the machine, can't open enterprise manager. We have to bounce the
> server. The errorlog indicates:
>
> 2004-03-01 17:07:20.38 server Error: 17883, Severity: 1, State: 0
> 2004-03-01 17:07:20.38 server The Scheduler 0 appears to be hung.
> SPID 0, ECID 0, UMS Context 0x03469860.
> 2004-03-01 17:07:20.38 server Error: 17883, Severity: 1, State: 0
> 2004-03-01 17:07:20.38 server The Scheduler 1 appears to be hung.
> SPID 59, ECID 0, UMS Context 0x0346BC48.
> 2004-03-01 17:08:20.39 server Error: 17883, Severity: 1, State: 0
> 2004
> What does it mean by the scheduler? Is this where the Enterprise
> manager runs all the scheduled jobs?
> Have any ideas as to what's going on?
> Thanks,
> Raziq.
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!

Scheduler is hung

I have a SQL 2000 with sp3 recently connected to the NetApps filer. For
the last two days the SQL Server keeps hanging. I can't even log on to
the machine, can't open enterprise manager. We have to bounce the
server. The errorlog indicates:
2004-03-01 17:07:20.38 server Error: 17883, Severity: 1, State: 0
2004-03-01 17:07:20.38 server The Scheduler 0 appears to be hung.
SPID 0, ECID 0, UMS Context 0x03469860.
2004-03-01 17:07:20.38 server Error: 17883, Severity: 1, State: 0
2004-03-01 17:07:20.38 server The Scheduler 1 appears to be hung.
SPID 59, ECID 0, UMS Context 0x0346BC48.
2004-03-01 17:08:20.39 server Error: 17883, Severity: 1, State: 0
2004
What does it mean by the scheduler? Is this where the Enterprise
manager runs all the scheduled jobs?
Have any ideas as to what's going on?
Thanks,
Raziq.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!It could be:
FIX: The Checkpoint Process Can Delay SQL Server Database Activity and Does
Not Yield Scheduler Correctly Causing Error: 17883 to Occur
http://support.microsoft.com/default.aspx?scid=kb;en-us;815056&Product=sql2k
Known bug. Call PSS to confirm and get the hotfix.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Raziq Shekha" <raziq_shekha@.anadarko.com> wrote in message
news:uluFM4GAEHA.2432@.TK2MSFTNGP11.phx.gbl...
> I have a SQL 2000 with sp3 recently connected to the NetApps filer. For
> the last two days the SQL Server keeps hanging. I can't even log on to
> the machine, can't open enterprise manager. We have to bounce the
> server. The errorlog indicates:
>
> 2004-03-01 17:07:20.38 server Error: 17883, Severity: 1, State: 0
> 2004-03-01 17:07:20.38 server The Scheduler 0 appears to be hung.
> SPID 0, ECID 0, UMS Context 0x03469860.
> 2004-03-01 17:07:20.38 server Error: 17883, Severity: 1, State: 0
> 2004-03-01 17:07:20.38 server The Scheduler 1 appears to be hung.
> SPID 59, ECID 0, UMS Context 0x0346BC48.
> 2004-03-01 17:08:20.39 server Error: 17883, Severity: 1, State: 0
> 2004
> What does it mean by the scheduler? Is this where the Enterprise
> manager runs all the scheduled jobs?
> Have any ideas as to what's going on?
> Thanks,
> Raziq.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

scheduler brings down the system?

I am hoping this is something simple, a security piece I've messed up.

When I run my dts package manually I get no errors and sucessful completion of each step. So I set my SQL Agent to run thepackage 15 minutes after every hour between 5am and 5pm, these being 15 minutes after the times the new data files are dropped to me.

But instead of running the package it disconnects all the remote desktop users and fails. When remote users can get back on we are faced with a system has recovered from a serious error message. The error message posted to the event logs is empty though.

Any one have any ideas?

We are running MS Server 2003 and SQL Server 2000

Thanks,

Carrie

It is not clear what is happening. When you say remote desktop users are you referring to RDP connections or Terminal Server sessions to your Windows Server. If so then it is not clear how this is a SQL Server issue.

If you are referring to SQL Server users then does the SQL Server service crash when you run the package?

Did you check the SQL Server error logs, windows eventlogs and SQL Server log directory for dump files?

Can you also repro the problem on another SQL Server with your database and package? If it is specific to this server, did you check for database corruptions or other hardware related issues?

Do you have the latest service pack installed on the SQL Server? If not, you should install it on a repro system and test your package again. If the problem doesn't happen then the bug you encountered has been fixed in a later service pack or hotfix.

If you are running the latest service pack and you can repro this problem on other SQL Servers with same package/database then it is a bug in SQL Server. You can file one with the repro details at http://connect.microsoft.com.

Scheduler appears to be hung ...

SQL 7.0 SP4 logging this message :
The Scheduler 0 appears to be hung. PSS 0x652E50D0, EC 0x652E5280, UMS Context 0x2FB7E0A0

While SQL is logging these messages SQL is blocked
This is hapening 5-10 times in week.
In traced file I found that there is no same query from application that causes this blocking.
What this qould be ?!
Is it SQL engine or is it hardware on underlaying-server ?
What with combination beetwen SQL 7.0 and Windows Server 2000.
Or even is it problems with queries from application ?HTH

http://www.eweek.com/article2/0,3959,920568,00.asp|||Thanks for linksql

Scheduler appears to be hung

Hi,
I have a SQL Server 2000 SP3 running on Windows Server 2000. I have moved
two databases that are used continously about two months back to this server
and since then I have noticed this error coming up every 10 to 15 days.
The Scheduler 1 appears to be hung. SPID 0, ECID 0, UMS Context 0x023339C0.
Error: 17883, Severity: 1, State: 0
The Scheduler 0 appears to be hung. SPID 0, ECID 0, UMS Context 0x0233C8D8.
Error: 17883, Severity: 1, State: 0
The SQL Server just freezes and becomes non-responsive. The above error was
present for almost 8 minutes before it started responding. At one time, I
wasn't even able to do a Remote Desktop to the server to check why the server
is not responding and later on I found that it had the same error. Any
information regarding this will be highly appreciated.How many processors do you have running? This implies two, or at least one
with hyperthreading. You might try turning one off completely.
"sharman" wrote:
> Hi,
> I have a SQL Server 2000 SP3 running on Windows Server 2000. I have moved
> two databases that are used continously about two months back to this server
> and since then I have noticed this error coming up every 10 to 15 days.
> The Scheduler 1 appears to be hung. SPID 0, ECID 0, UMS Context 0x023339C0.
> Error: 17883, Severity: 1, State: 0
> The Scheduler 0 appears to be hung. SPID 0, ECID 0, UMS Context 0x0233C8D8.
> Error: 17883, Severity: 1, State: 0
> The SQL Server just freezes and becomes non-responsive. The above error was
> present for almost 8 minutes before it started responding. At one time, I
> wasn't even able to do a Remote Desktop to the server to check why the server
> is not responding and later on I found that it had the same error. Any
> information regarding this will be highly appreciated.|||For starters, just set SQL Server to use a single processor under the
instance properties. Also, you might want to apply SP4...
"sharman" wrote:
> Thanks for the information. It has 2 processors. How do I turn off
> hyperthreading and what are the implications of turning it off? Thanks.
> "James Luetkehoelter" wrote:
> > How many processors do you have running? This implies two, or at least one
> > with hyperthreading. You might try turning one off completely.
> >
> > "sharman" wrote:
> >
> > > Hi,
> > >
> > > I have a SQL Server 2000 SP3 running on Windows Server 2000. I have moved
> > > two databases that are used continously about two months back to this server
> > > and since then I have noticed this error coming up every 10 to 15 days.
> > >
> > > The Scheduler 1 appears to be hung. SPID 0, ECID 0, UMS Context 0x023339C0.
> > > Error: 17883, Severity: 1, State: 0
> > > The Scheduler 0 appears to be hung. SPID 0, ECID 0, UMS Context 0x0233C8D8.
> > > Error: 17883, Severity: 1, State: 0
> > >
> > > The SQL Server just freezes and becomes non-responsive. The above error was
> > > present for almost 8 minutes before it started responding. At one time, I
> > > wasn't even able to do a Remote Desktop to the server to check why the server
> > > is not responding and later on I found that it had the same error. Any
> > > information regarding this will be highly appreciated.|||Thanks for the information. It has 2 processors. How do I turn off
hyperthreading and what are the implications of turning it off? Thanks.
"James Luetkehoelter" wrote:
> How many processors do you have running? This implies two, or at least one
> with hyperthreading. You might try turning one off completely.
> "sharman" wrote:
> > Hi,
> >
> > I have a SQL Server 2000 SP3 running on Windows Server 2000. I have moved
> > two databases that are used continously about two months back to this server
> > and since then I have noticed this error coming up every 10 to 15 days.
> >
> > The Scheduler 1 appears to be hung. SPID 0, ECID 0, UMS Context 0x023339C0.
> > Error: 17883, Severity: 1, State: 0
> > The Scheduler 0 appears to be hung. SPID 0, ECID 0, UMS Context 0x0233C8D8.
> > Error: 17883, Severity: 1, State: 0
> >
> > The SQL Server just freezes and becomes non-responsive. The above error was
> > present for almost 8 minutes before it started responding. At one time, I
> > wasn't even able to do a Remote Desktop to the server to check why the server
> > is not responding and later on I found that it had the same error. Any
> > information regarding this will be highly appreciated.|||Hyperthreading can be diabled at the BIOS level. Most database applications
will experience an increase in performance with HT disabled. Test in your
environment.
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:0AEF20A0-A529-42BE-888B-C86BD6957F88@.microsoft.com...
> Thanks for the information. It has 2 processors. How do I turn off
> hyperthreading and what are the implications of turning it off? Thanks.
> "James Luetkehoelter" wrote:
>> How many processors do you have running? This implies two, or at least
>> one
>> with hyperthreading. You might try turning one off completely.
>> "sharman" wrote:
>> > Hi,
>> >
>> > I have a SQL Server 2000 SP3 running on Windows Server 2000. I have
>> > moved
>> > two databases that are used continously about two months back to this
>> > server
>> > and since then I have noticed this error coming up every 10 to 15 days.
>> >
>> > The Scheduler 1 appears to be hung. SPID 0, ECID 0, UMS Context
>> > 0x023339C0.
>> > Error: 17883, Severity: 1, State: 0
>> > The Scheduler 0 appears to be hung. SPID 0, ECID 0, UMS Context
>> > 0x0233C8D8.
>> > Error: 17883, Severity: 1, State: 0
>> >
>> > The SQL Server just freezes and becomes non-responsive. The above error
>> > was
>> > present for almost 8 minutes before it started responding. At one time,
>> > I
>> > wasn't even able to do a Remote Desktop to the server to check why the
>> > server
>> > is not responding and later on I found that it had the same error. Any
>> > information regarding this will be highly appreciated.|||Take a look at this excellent MS whitepaper:
http://www.microsoft.com/technet/prodtechnol/sql/2005/diagandcorrecterrs.mspx
Linchi
"sharman" wrote:
> Hi,
> I have a SQL Server 2000 SP3 running on Windows Server 2000. I have moved
> two databases that are used continously about two months back to this server
> and since then I have noticed this error coming up every 10 to 15 days.
> The Scheduler 1 appears to be hung. SPID 0, ECID 0, UMS Context 0x023339C0.
> Error: 17883, Severity: 1, State: 0
> The Scheduler 0 appears to be hung. SPID 0, ECID 0, UMS Context 0x0233C8D8.
> Error: 17883, Severity: 1, State: 0
> The SQL Server just freezes and becomes non-responsive. The above error was
> present for almost 8 minutes before it started responding. At one time, I
> wasn't even able to do a Remote Desktop to the server to check why the server
> is not responding and later on I found that it had the same error. Any
> information regarding this will be highly appreciated.

Friday, March 9, 2012

Schedule task DB connection

I need to know how to pass parameters that could tell an executable through the task scheduler, to initiate the ODBC connection first and execute the executable. I do not want to leave a PC, server, terminal server session or similar mechanism running and logged into DB prior to the scheduled task running. This keeps the ODBC connection initialized and available for the Import executable to use when it runs (as a scheduled task). However, that will not be a reliable, long term solution for automating the import as the session would be killed if the server is rebooted, somebody may accidentally close it or a number of other scenarios could cause it to get closed.

Question How do you make the ODBC connection to the database when running the schedule task function, prior to the software executable running. I am using the scheduled function to automactically excute a xml import every 10 minutes. My software keeps stating no db connection. I have looked everywhere and can not find how to tell in this schedule task function command line how to connect to the DB prior to running the process. Does any one know how to fully automating the connection to a ODBC prior to running the executable.

thanks techbk

Are you using any SQL Server tools here?

Wednesday, March 7, 2012

Schedule question

Hello all!

I have a small .vbs script that I would like to run as a step in the SQL scheduler. The script is "MsgBox("Database Transfer Succesfull!")"

The client wants to something to let the end user know it was succesful with a pop up message. But it doesn't work, and just hangs up my process. The other steps are SP's and a DTS run.

Any idea's?

TIA!!

Rudy

The SQL Agent is architectured to run on servers, even without any user being logged on when the scheduled task is executed. So it runs the program in separate session, and this message box is "displayed" on the invisible desktop, so nobody can close it, and the process hangs.

Use some other way to get user notified, e.g. send him/her an e-mail, or (if you keep [deprecated] messenger service enabled) run 'net send computer message' command, etc.