SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Constanly Running SQL Sproc


Constanly Running SQL Sproc

Author
Message
BSavoie
BSavoie
SSC-Addicted
SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)

Group: General Forum Members
Points: 497 Visits: 794
I have an Azure DB. As we all know, that means no SQL Agent. I need to have a background task that runs every few minutes to clean up some things. Since I can't setup an Agent job, I was thinking about a sproc with an infinite loop. That does some work every 5 min. (or whatever). The alternative is an Azure web role. That's probably a better solution, but it's also much more expensive.

Any thoughts on the infinite loop thing? Is there any way to "sleep" in a sproc?

.
Jeffrey Williams 3188
Jeffrey Williams 3188
SSCertifiable
SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)

Group: General Forum Members
Points: 7647 Visits: 9966
Not sure about Azure and what is available or not - but lookup WAITFOR in BOL. That will allow your process to sleep for a time and start up again.

Jeffrey Williams
Problems are opportunities brilliantly disguised as insurmountable obstacles.

How to post questions to get better answers faster
Managing Transaction Logs

BSavoie
BSavoie
SSC-Addicted
SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)

Group: General Forum Members
Points: 497 Visits: 794
Perfect, that looks like exactly what I need. The fact that it exists must mean that it's not THAT bad an idea. Smile

Thanks!

.
BSavoie
BSavoie
SSC-Addicted
SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)

Group: General Forum Members
Points: 497 Visits: 794
Although, I guess I'm still stuck with the same basic problem. How do I start the sproc? Without a SQL Agent, I don't have a way to kick it off.

Anybody know of a way to automatically start a sproc at SQL Server startup?

.
mister.magoo
mister.magoo
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4106 Visits: 7865
According to Books Online, SQL Azure does not support sp_procoption which is what you would use to have an auto-execute SP.

Perhaps you could have a scheduled task on a local server that runs the stored proc?

MM


select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);




  • Forum Etiquette: How to post Reporting Services problems
  • Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
  • How to Post Performance Problems - by Gail Shaw

  • BSavoie
    BSavoie
    SSC-Addicted
    SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)

    Group: General Forum Members
    Points: 497 Visits: 794
    Thanks MM.

    Bit by Azure again. Man, I really need to talk my company off SQL Azure. It is just too limited right now. Anyone out there looking to move to Azure, DON'T DO IT if your app depends on ANYTHING other than DML, DDL. It's just not there yet.

    The local server -> Azure server is a thought. Probably ought to just stick with a basic solution and create a web role I guess. Thanks for the help all!

    .
    Grant Fritchey
    Grant Fritchey
    SSC-Dedicated
    SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

    Group: General Forum Members
    Points: 39406 Visits: 32630
    BSavoie (1/2/2011)
    Perfect, that looks like exactly what I need. The fact that it exists must mean that it's not THAT bad an idea. Smile

    Thanks!


    Just be careful about transactions & locking. A proc running in an infinite loop is going to hold stuff open pretty much infinitely.

    ----------------------------------------------------
    The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
    Theodore Roosevelt

    The Scary DBA
    Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
    Product Evangelist for Red Gate Software
    danilo.marinsek
    danilo.marinsek
    Forum Newbie
    Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

    Group: General Forum Members
    Points: 2 Visits: 38
    In Microsoft documentation http://msdn.microsoft.com/en-us/library/ee336245.aspx#sqlagent say:

    SQL Server Agent/Jobs

    SQL Azure Database does not support SQL Server Agent or jobs. You can, however, run SQL Server Agent on your on-premise SQL Server and connect to SQL Azure Database.

    Danilo
    BSavoie
    BSavoie
    SSC-Addicted
    SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)

    Group: General Forum Members
    Points: 497 Visits: 794
    I suppose the on premis SQL Agent is as good as anything. I'm sure I'll find other uses for that scenario anyway. Thanks!

    .
    Jeremiah Peschka
    Jeremiah Peschka
    Valued Member
    Valued Member (60 reputation)Valued Member (60 reputation)Valued Member (60 reputation)Valued Member (60 reputation)Valued Member (60 reputation)Valued Member (60 reputation)Valued Member (60 reputation)Valued Member (60 reputation)

    Group: General Forum Members
    Points: 60 Visits: 178
    If you're looking for background functionality, you should be looking at using an Azure Compute instance to kick this off instead of running it in the storage layer. You have to think of the entire Azure platform as a bunch of separate pieces of functionality that fit together to give you a complete solution.

    Jeremiah Peschka
    Microsoft SQL Server MVP
    Managing Director - Brent Ozar PLF, LLC
    Go


    Permissions

    You can't post new topics.
    You can't post topic replies.
    You can't post new polls.
    You can't post replies to polls.
    You can't edit your own topics.
    You can't delete your own topics.
    You can't edit other topics.
    You can't delete other topics.
    You can't edit your own posts.
    You can't edit other posts.
    You can't delete your own posts.
    You can't delete other posts.
    You can't post events.
    You can't edit your own events.
    You can't edit other events.
    You can't delete your own events.
    You can't delete other events.
    You can't send private messages.
    You can't send emails.
    You can read topics.
    You can't vote in polls.
    You can't upload attachments.
    You can download attachments.
    You can't post HTML code.
    You can't edit HTML code.
    You can't post IFCode.
    You can't post JavaScript.
    You can post emoticons.
    You can't post or upload images.

    Select a forum

































































































































































    SQLServerCentral


    Search