472,984 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,984 software developers and data experts.

System event triggers

Hi, I have several independent, system components that write audit
events to a database locally via ODBC and remotely via TCP, and I have
a requirement to audit when the database is available for modification.
First, does SQL Server have a concept of starting/stopping specific
database instances? Or does my database instance "stop" only when the
NT service MSSQLSERVER stops?

Second, Oracle has system event triggers, e.g. AFTER STARTUP, but I
can't find an equivalent in SQL Server 2000. What alternatives are
there?

Note that I can't rely on the MSSQLSERVER start/stop events in the NT
Application Event log, as the events need to be inserted "in-band" into
my database's event table.

TIA,
Josh

Jul 24 '06 #1
1 1946
you can take a database offline or make it single user only

USE master
GO
ALTER DATABASE pubs
SET OFFLINE--use ONLINE to make it available again

>>Oracle has system event triggers, e.g. AFTER STARTUP, but I
can't find an equivalent in SQL Server 2000.
Well you can create a procedure and have it execute every time the SQL
Server is restarted
The procedure has to be created in the master database, after it is
created you have to use sp_procoption to have the procedure execute
when SQL Server starts up

--Let's create our procedure
USE master
GO
CREATE PROCEDURE prStartUp
AS
SELECT GETDATE()
--You would do something real here
--like deleting the data
GO
--Make the procedure execute when the server starts up
sp_procoption prStartUp,startup,'on'
Denis the SQL Menace
http://sqlservercode.blogspot.com/
josh wrote:
Hi, I have several independent, system components that write audit
events to a database locally via ODBC and remotely via TCP, and I have
a requirement to audit when the database is available for modification.
First, does SQL Server have a concept of starting/stopping specific
database instances? Or does my database instance "stop" only when the
NT service MSSQLSERVER stops?

Second, Oracle has system event triggers, e.g. AFTER STARTUP, but I
can't find an equivalent in SQL Server 2000. What alternatives are
there?

Note that I can't rely on the MSSQLSERVER start/stop events in the NT
Application Event log, as the events need to be inserted "in-band" into
my database's event table.

TIA,
Josh
Jul 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Tom Szabo | last post by:
Is there an event when that triggers when the window is closing.... I am talking about when the user clicks on the cross on the right top corner of the window!!!
4
by: MJW | last post by:
Is there a way for me to know if or which command button was just clicked that triggers the LostFocus event for the current control on a Form? I have a form that has many types of users who each...
0
by: Mats-Lennart Hansson | last post by:
Hi, I'm having a problem with event handlers. My code looks (a bit simplified) like this: public class Listener { CallerClass Call = new CallerClass(); string data= ""; public Listener()
27
by: Codemonkey | last post by:
Heya All, Sorry, but I think it's about time for a monkey-ramble. I've just had enough of trying to serialize even simple objects with VB. A simple task you may think - stick the...
8
by: Frank van Vugt | last post by:
Hi, If during a transaction a number of deferred triggers are fired, what will be their execution order upon the commit? Will they be executed in order of firing or alfabetically or...
10
by: B. Chernick | last post by:
I am using a System.Web.UI.WebControls.Table control on a screen. (Dot Net 1.1) My problem is this: The table is programmatically reconstructed on every postback. Each table row contains two...
1
by: bill | last post by:
I have an update panel that contains a gridview. There are 2 triggers: one for a search button that is outside the panel and one for the gridview EditCommand Event. The search works fine, the...
19
by: Daniela Roman | last post by:
Hello, I try to fire an event under a button click event and maybe anybody can give a clue please. I have let's say a WEB grid with PageIndexChanged event: private void...
3
by: SimonG via AccessMonster.com | last post by:
Hi, I would like to be able to compare a control's new value with its old value, whenever it is changed by a user. The control holds a numeric value, qty_Sold, when this value changes I need to...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.