INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Run script on DB Startup

Run script on DB Startup

(OP)
I must not be putting in the right key words to Google. I have a simple DBCC command I want to run every time the server/service is restarted. The Maintenance Plans do not support an "On Start Up" option for execution times.

Does anyone know how to accomplish this? Is it possible? I appreciate any and all suggestions you may have.

Thank you.

--------------------------------------------------
“Crash programs fail because they are based on the theory that, with nine women pregnant, you can get a baby a month.” --Wernher von Braun
--------------------------------------------------

RE: Run script on DB Startup

There is a system stored procedure called sp_procoption that will allow this. However, I think this is for 'database startup' more so than system/service startup. You must run this command in the master database which starts up when the SQL Server service starts, so the net effect should be the same.

http://msdn.microsoft.com/en-us/library/ms181720(v...

I'm curious though... what DBCC command are you trying to run?

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom

RE: Run script on DB Startup

SQL Agent jobs can also be run at the time SQL Agent starts, which is usually when SQL Server starts.

RE: Run script on DB Startup

(OP)
George, Thank you. That's close enough for what I need.

CODE

DBCC TRACEON (3605,1204,1222,-1) 

It's a simple little setting that enables the DeadLock information to be reported. I then have a job that dumps that info to an email and sends it to us. In fact, I got it from SqlServerCentral.com here. It's been an immense help in getting this old Unisys conversion project cleaned up. But it seems that the TRACEON switch resets to default if the server/service is restarted.

--------------------------------------------------
“Crash programs fail because they are based on the theory that, with nine women pregnant, you can get a baby a month.” --Wernher von Braun
--------------------------------------------------

RE: Run script on DB Startup

Ah... I see.

I usually do this with the -T start up parameter.

On the server, click Start -> run
Type services.msc
Click OK
Scroll down to SQL Server.
Right click -> Properties

At the bottom of the general tab, there is a text box for "Start Parameters"

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom

RE: Run script on DB Startup

(OP)
Well, they (NetAdmins) have that locked out. So I used the sp_procoption you mentioned previously until they decide to get around to doing it.

George, thank you greatly for the assist.

--------------------------------------------------
“Crash programs fail because they are based on the theory that, with nine women pregnant, you can get a baby a month.” --Wernher von Braun
--------------------------------------------------

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close