Monday, March 26, 2012
Running a job at database startup
would like to automatically move the existing 'blackbox' trace(s) out of the
default folder at startup time so that they can be analyzed more
conveniently.
Hi
Look at sp_procoption with the startup parameter in BOL.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"JHowell" wrote:
> Is it possible to run a job (O/S cmd) each time a database is restarted? I
> would like to automatically move the existing 'blackbox' trace(s) out of the
> default folder at startup time so that they can be analyzed more
> conveniently.
|||It is possible to have a stored procedure execute at startup. Must be in the
Master DB.
"JHowell" <JHowell@.discussions.microsoft.com> wrote in message
news:4139206F-7C3C-4F8F-8DA9-AF9280A2CC87@.microsoft.com...
> Is it possible to run a job (O/S cmd) each time a database is restarted?
I
> would like to automatically move the existing 'blackbox' trace(s) out of
the
> default folder at startup time so that they can be analyzed more
> conveniently.
Running a job at database startup
would like to automatically move the existing 'blackbox' trace(s) out of the
default folder at startup time so that they can be analyzed more
conveniently.Hi
Look at sp_procoption with the startup parameter in BOL.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"JHowell" wrote:
> Is it possible to run a job (O/S cmd) each time a database is restarted?
I
> would like to automatically move the existing 'blackbox' trace(s) out of t
he
> default folder at startup time so that they can be analyzed more
> conveniently.|||It is possible to have a stored procedure execute at startup. Must be in the
Master DB.
"JHowell" <JHowell@.discussions.microsoft.com> wrote in message
news:4139206F-7C3C-4F8F-8DA9-AF9280A2CC87@.microsoft.com...
> Is it possible to run a job (O/S cmd) each time a database is restarted?
I
> would like to automatically move the existing 'blackbox' trace(s) out of
the
> default folder at startup time so that they can be analyzed more
> conveniently.
Running a job at database startup
would like to automatically move the existing 'blackbox' trace(s) out of the
default folder at startup time so that they can be analyzed more
conveniently.Hi
Look at sp_procoption with the startup parameter in BOL.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"JHowell" wrote:
> Is it possible to run a job (O/S cmd) each time a database is restarted? I
> would like to automatically move the existing 'blackbox' trace(s) out of the
> default folder at startup time so that they can be analyzed more
> conveniently.|||It is possible to have a stored procedure execute at startup. Must be in the
Master DB.
"JHowell" <JHowell@.discussions.microsoft.com> wrote in message
news:4139206F-7C3C-4F8F-8DA9-AF9280A2CC87@.microsoft.com...
> Is it possible to run a job (O/S cmd) each time a database is restarted?
I
> would like to automatically move the existing 'blackbox' trace(s) out of
the
> default folder at startup time so that they can be analyzed more
> conveniently.
Tuesday, March 20, 2012
Run SQL script on Instance Startup
starts up?
SQL Server 2005 SP2
thanks!On Oct 18, 11:50 am, traceable1 <thham...@.gmail.comwrote:
Quote:
Originally Posted by
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
>
thanks!
This link describes the use of 'Automatic Execution Stored Procedures'
than may fit the bill for what you are looking for.
http://msdn2.microsoft.com/en-us/library/ms191129.aspx|||Thank you!!
On Oct 18, 3:56 pm, Steve215 <stephen.mer...@.comcast.netwrote:
Quote:
Originally Posted by
On Oct 18, 11:50 am, traceable1 <thham...@.gmail.comwrote:
>
Quote:
Originally Posted by
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
>
Quote:
Originally Posted by
thanks!
>
This link describes the use of 'Automatic Execution Stored Procedures'
than may fit the bill for what you are looking for.
>
http://msdn2.microsoft.com/en-us/library/ms191129.aspx|||
Tibor Karaszi View profile
More options Oct 18, 10:58 am
Newsgroups: microsoft.public.sqlserver.server
From: "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com>
Date: Thu, 18 Oct 2007 17:58:37 +0200
Local: Thurs, Oct 18 2007 10:58 am
Subject: Re: Run script on Instance Startup
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
Put it in a stored procedure and mark the proc as an autostart proc
(sp_procoption).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"traceable1" <thham...@.gmail.comwrote in message
news:1192722595.538697.92480@.y27g2000pre.googlegro ups.com...
- Hide quoted text -
- Show quoted text -
Quote:
Originally Posted by
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
Quote:
Originally Posted by
thanks!
Reply Reply to author Forward Rate this post: Text
for clearing space
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.
Tibor Karaszi View profile
More options Oct 18, 1:27 pm
Newsgroups: microsoft.public.sqlserver.server
From: "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com>
Date: Thu, 18 Oct 2007 20:27:45 +0200
Local: Thurs, Oct 18 2007 1:27 pm
Subject: Re: Run script on Instance Startup
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
Actually, one can claim that your alternative, Ekrem, is a cleaner
solution than mine. I.e., it
might feel better to have a client app (Agent) execute whatever TSQL
commands you want to run
instead of the database engine. (Of course, if one only start the
engine and not Agent, then the
script will not be executed.)
Good thinking. :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Ekrem nsoy" <ek...@.btegitim.comwrote in message
news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
- Hide quoted text -
- Show quoted text -
Quote:
Originally Posted by
Alternatively you can create a job to run your stuff which starts when SQL Server Agent starts...
(may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
Quote:
Originally Posted by
--
Ekrem nsoy
Quote:
Originally Posted by
"traceable1" <thham...@.gmail.comwrote in message
news:1192722595.538697.92480@.y27g2000pre.googlegro ups.com...
Quote:
Originally Posted by
Quote:
Originally Posted by
>Is there a way I can set up a SQL script to run when the instance
>starts up?
>SQL Server 2005 SP2
Quote:
Originally Posted by
Quote:
Originally Posted by
>thanks!
Reply Reply to author Forward Rate this post: Text
for clearing space
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.
traceable1 View profile
More options Oct 18, 3:34 pm
Newsgroups: microsoft.public.sqlserver.server
From: traceable1 <thham...@.gmail.com>
Date: Thu, 18 Oct 2007 20:34:43 -0000
Local: Thurs, Oct 18 2007 3:34 pm
Subject: Re: Run script on Instance Startup
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this
author
Thank you so much for your feedback!
So how exactly would I set up the script to run when the Agent
starts?
On Oct 18, 1:27 pm, "Tibor Karaszi"
- Hide quoted text -
- Show quoted text -
<tibor_please.no.email_kara...@.hotmail.nomail.comwr ote:
Quote:
Originally Posted by
Actually, one can claim that your alternative, Ekrem, is a cleaner solution than mine. I.e., it
might feel better to have a client app (Agent) execute whatever TSQL commands you want to run
instead of the database engine. (Of course, if one only start the engine and not Agent, then the
script will not be executed.)
Quote:
Originally Posted by
Good thinking. :-)
Quote:
Originally Posted by
--
Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/...
Quote:
Originally Posted by
"Ekrem nsoy" <ek...@.btegitim.comwrote in message
Quote:
Originally Posted by
news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
Quote:
Originally Posted by
Quote:
Originally Posted by
Alternatively you can create a job to run your stuff which starts when SQL Server Agent starts...
(may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
Quote:
Originally Posted by
Quote:
Originally Posted by
--
Ekrem nsoy
Quote:
Originally Posted by
Quote:
Originally Posted by
"traceable1" <thham...@.gmail.comwrote in message
news:1192722595.538697.92480@.y27g2000pre.googlegro ups.com...
Quote:
Originally Posted by
Quote:
Originally Posted by
Quote:
Originally Posted by
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
Quote:
Originally Posted by
Quote:
Originally Posted by
Quote:
Originally Posted by
thanks!- Hide quoted text -
Quote:
Originally Posted by
- Show quoted text -
Reply Reply to author Forward
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.
Tibor Karaszi View profile
More options Oct 18, 3:59 pm
Newsgroups: microsoft.public.sqlserver.server
From: "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com>
Date: Thu, 18 Oct 2007 22:59:38 +0200
Local: Thurs, Oct 18 2007 3:59 pm
Subject: Re: Run script on Instance Startup
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
Create an Agent job with one or several job steps containing your TSQL
(or whatever) code. Schedule
this job to be executed when Agent starts.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"traceable1" <thham...@.gmail.comwrote in message
news:1192739683.702442.18160@.k35g2000prh.googlegro ups.com...
Thank you so much for your feedback!
So how exactly would I set up the script to run when the Agent
starts?
On Oct 18, 1:27 pm, "Tibor Karaszi"
- Hide quoted text -
- Show quoted text -
<tibor_please.no.email_kara...@.hotmail.nomail.comwr ote:
Quote:
Originally Posted by
Actually, one can claim that your alternative, Ekrem, is a cleaner solution than mine. I.e., it
might feel better to have a client app (Agent) execute whatever TSQL commands you want to run
instead of the database engine. (Of course, if one only start the engine and not Agent, then the
script will not be executed.)
Quote:
Originally Posted by
Good thinking. :-)
Quote:
Originally Posted by
--
Tibor Karaszi, SQL Server
MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/...
Quote:
Originally Posted by
"Ekrem nsoy" <ek...@.btegitim.comwrote in message
Quote:
Originally Posted by
news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
Quote:
Originally Posted by
Quote:
Originally Posted by
Alternatively you can create a job to run your stuff which starts when SQL Server Agent
starts...
(may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
Quote:
Originally Posted by
Quote:
Originally Posted by
--
Ekrem nsoy
Quote:
Originally Posted by
Quote:
Originally Posted by
"traceable1" <thham...@.gmail.comwrote in message
news:1192722595.538697.92480@.y27g2000pre.googlegro ups.com...
Quote:
Originally Posted by
Quote:
Originally Posted by
Quote:
Originally Posted by
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
Quote:
Originally Posted by
Quote:
Originally Posted by
Quote:
Originally Posted by
thanks!- Hide quoted text -
Quote:
Originally Posted by
- Show quoted text -
On Oct 18, 3:56 pm, Steve215 <stephen.mer...@.comcast.netwrote:
Quote:
Originally Posted by
On Oct 18, 11:50 am, traceable1 <thham...@.gmail.comwrote:
>
Quote:
Originally Posted by
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
>
Quote:
Originally Posted by
thanks!
>
This link describes the use of 'Automatic Execution Stored Procedures'
than may fit the bill for what you are looking for.
>
http://msdn2.microsoft.com/en-us/library/ms191129.aspx
Run script on Instance Startup
starts up?
SQL Server 2005 SP2
thanks!Put it in a stored procedure and mark the proc as an autostart proc (sp_procoption).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"traceable1" <thhamlin@.gmail.com> wrote in message
news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> Is there a way I can set up a SQL script to run when the instance
> starts up?
> SQL Server 2005 SP2
> thanks!
>|||Actually, one can claim that your alternative, Ekrem, is a cleaner solution than mine. I.e., it
might feel better to have a client app (Agent) execute whatever TSQL commands you want to run
instead of the database engine. (Of course, if one only start the engine and not Agent, then the
script will not be executed.)
Good thinking. :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Ekrem Önsoy" <ekrem@.btegitim.com> wrote in message
news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
> Alternatively you can create a job to run your stuff which starts when SQL Server Agent starts...
> (may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
> --
> Ekrem Önsoy
>
> "traceable1" <thhamlin@.gmail.com> wrote in message
> news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
>> Is there a way I can set up a SQL script to run when the instance
>> starts up?
>> SQL Server 2005 SP2
>> thanks!
>|||Thank you so much for your feedback!
So how exactly would I set up the script to run when the Agent starts?
On Oct 18, 1:27 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Actually, one can claim that your alternative, Ekrem, is a cleaner soluti=on than mine. I.e., it
> might feel better to have a client app (Agent) execute whatever TSQL comm=ands you want to run
> instead of the database engine. (Of course, if one only start the engine =and not Agent, then the
> script will not be executed.)
> Good thinking. :-)
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asp=
http://sqlblog.com/blogs/tibor_karaszi
> "Ekrem =D6nsoy" <ek...@.btegitim.com> wrote in message
> news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
>
> > Alternatively you can create a job to run your stuff which starts when =SQL Server Agent starts...
> > (may not be as good as Tibor's suggestion :) but I already said, it's j=ust an alternative)
> > --
> > Ekrem =D6nsoy
> > "traceable1" <thham...@.gmail.com> wrote in message
> >news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> >> Is there a way I can set up a SQL script to run when the instance
> >> starts up?
> >> SQL Server 2005 SP2
> >> thanks!- Hide quoted text -
> - Show quoted text -|||Create an Agent job with one or several job steps containing your TSQL (or whatever) code. Schedule
this job to be executed when Agent starts.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"traceable1" <thhamlin@.gmail.com> wrote in message
news:1192739683.702442.18160@.k35g2000prh.googlegroups.com...
Thank you so much for your feedback!
So how exactly would I set up the script to run when the Agent starts?
On Oct 18, 1:27 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Actually, one can claim that your alternative, Ekrem, is a cleaner solution than mine. I.e., it
> might feel better to have a client app (Agent) execute whatever TSQL commands you want to run
> instead of the database engine. (Of course, if one only start the engine and not Agent, then the
> script will not be executed.)
> Good thinking. :-)
> --
> Tibor Karaszi, SQL Server
> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> "Ekrem Önsoy" <ek...@.btegitim.com> wrote in message
> news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
>
> > Alternatively you can create a job to run your stuff which starts when SQL Server Agent
> > starts...
> > (may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
> > --
> > Ekrem Önsoy
> > "traceable1" <thham...@.gmail.com> wrote in message
> >news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> >> Is there a way I can set up a SQL script to run when the instance
> >> starts up?
> >> SQL Server 2005 SP2
> >> thanks!- Hide quoted text -
> - Show quoted text -|||Excellent! Thank ya'll so much!!
On Oct 18, 3:59 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Create an Agent job with one or several job steps containing your TSQL (o=r whatever) code. Schedule
> this job to be executed when Agent starts.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asp=
http://sqlblog.com/blogs/tibor_karaszi
> "traceable1" <thham...@.gmail.com> wrote in message
> news:1192739683.702442.18160@.k35g2000prh.googlegroups.com...
> Thank you so much for your feedback!
> So how exactly would I set up the script to run when the Agent starts?
> On Oct 18, 1:27 pm, "Tibor Karaszi"
>
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> > Actually, one can claim that your alternative, Ekrem, is a cleaner solu=tion than mine. I.e., it
> > might feel better to have a client app (Agent) execute whatever TSQL co=mmands you want to run
> > instead of the database engine. (Of course, if one only start the engin=e and not Agent, then the
> > script will not be executed.)
> > Good thinking. :-)
> > --
> > Tibor Karaszi, SQL Server
> > MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs=
/=2E..
> > "Ekrem =D6nsoy" <ek...@.btegitim.com> wrote in message
> >news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
> > > Alternatively you can create a job to run your stuff which starts whe=n SQL Server Agent
> > > starts...
> > > (may not be as good as Tibor's suggestion :) but I already said, it's= just an alternative)
> > > --
> > > Ekrem =D6nsoy
> > > "traceable1" <thham...@.gmail.com> wrote in message
> > >news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> > >> Is there a way I can set up a SQL script to run when the instance
> > >> starts up?
> > >> SQL Server 2005 SP2
> > >> thanks!- Hide quoted text -
> > - Show quoted text -- Hide quoted text -
> - Show quoted text -|||*** Sent via Developersdex http://www.developersdex.com ***|||Alternatively you can create a job to run your stuff which starts when SQL
Server Agent starts... (may not be as good as Tibor's suggestion :) but I
already said, it's just an alternative)
--
Ekrem Önsoy
"traceable1" <thhamlin@.gmail.com> wrote in message
news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> Is there a way I can set up a SQL script to run when the instance
> starts up?
> SQL Server 2005 SP2
> thanks!
>|||:-)
--
Ekrem Önsoy
http://www.ekremonsoy.net , http://ekremonsoy.blogspot.com
MCBDA, MCTS: SQL Server 2005, MCITP:DBA, MCSD.Net, MCSE, MCT
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:B15F3A8E-AAFF-44D1-9BEB-CFA9845E2DEE@.microsoft.com...
> Actually, one can claim that your alternative, Ekrem, is a cleaner
> solution than mine. I.e., it might feel better to have a client app
> (Agent) execute whatever TSQL commands you want to run instead of the
> database engine. (Of course, if one only start the engine and not Agent,
> then the script will not be executed.)
> Good thinking. :-)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Ekrem Önsoy" <ekrem@.btegitim.com> wrote in message
> news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
>> Alternatively you can create a job to run your stuff which starts when
>> SQL Server Agent starts... (may not be as good as Tibor's suggestion :)
>> but I already said, it's just an alternative)
>> --
>> Ekrem Önsoy
>>
>> "traceable1" <thhamlin@.gmail.com> wrote in message
>> news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
>> Is there a way I can set up a SQL script to run when the instance
>> starts up?
>> SQL Server 2005 SP2
>> thanks!
>>
>