Showing posts with label disable. Show all posts
Showing posts with label disable. Show all posts

Tuesday, March 27, 2012

Auto close disabled

Hello :
I have a problem, in my database I found many messages " starting up
database 'xxx'", I have Auto_close Option Disable.
I don´t have any idea.
Can anyone help me?
thanks a lotI would double and triple check the auto close setting for all databases. Only time I've heard about
lots of these messages are when auto close is on...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Carlos A." <CarlosA@.discussions.microsoft.com> wrote in message
news:2DE5FBC3-33C4-4E29-960A-DA209EF4F7FB@.microsoft.com...
> Hello :
> I have a problem, in my database I found many messages " starting up
> database 'xxx'", I have Auto_close Option Disable.
> I don´t have any idea.
> Can anyone help me?
> thanks a lot
>|||Hi, Tibor.
I reviwed all databases and auto_close option is disable, but only one
database show "starting database 'XXX' ".
Any other idea?
thanks a lot for you help
"Tibor Karaszi" wrote:
> I would double and triple check the auto close setting for all databases. Only time I've heard about
> lots of these messages are when auto close is on...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Carlos A." <CarlosA@.discussions.microsoft.com> wrote in message
> news:2DE5FBC3-33C4-4E29-960A-DA209EF4F7FB@.microsoft.com...
> > Hello :
> > I have a problem, in my database I found many messages " starting up
> > database 'xxx'", I have Auto_close Option Disable.
> >
> > I don´t have any idea.
> >
> > Can anyone help me?
> > thanks a lot
> >
> >
>
>

Saturday, February 25, 2012

Audit Design Question


I need to audit Insert, Update and Delete on tables in the database.
But the symin of the app can selectively enable and disable auditing
on tables. So I need to be able to switch the auditing on and off.
Is there any built-in function in SqlServer 2005 that I can use to
track changes?
In the absence of built-in auditing I have come up with two possible
solutions:
1) Pass a patameter called @.bAudit to the stored procedures performing
CRUD tasks and if the parameter is true then insert a row into the
audit table (audit table has the same schema as the main table but with
a few more columns for tracking).
2) Use triggers on Insert, Update and Delete but I can't find out how
to disable triggers at run time.
Can you please point me in the right direction? Thanks.S Chapman,

> 2) Use triggers on Insert, Update and Delete but I can't find out how
> to disable triggers at run time.
Use the statement "alter table".
alter table dbo.t1
disable trigger trigger_name
See BOL for more info.

> 1) Pass a patameter called @.bAudit to the stored procedures performing
> CRUD tasks and if the parameter is true then insert a row into the
> audit table (audit table has the same schema as the main table but with
> a few more columns for tracking).
A possible solution could be having an options table and check the option
inside the trigger.
update conf_options
set audit = 1
where table_name = 'my_table'
go
create trigger tr_mytable on my_table
for insert, update, delete
as
if exists (select * from dbo.conf_options where table_name = 'my_table' and
audit = 1)
begin
-- put here the audit code
end
go
AMB
"S Chapman" wrote:

>
> I need to audit Insert, Update and Delete on tables in the database.
> But the symin of the app can selectively enable and disable auditing
> on tables. So I need to be able to switch the auditing on and off.
> Is there any built-in function in SqlServer 2005 that I can use to
> track changes?
> In the absence of built-in auditing I have come up with two possible
> solutions:
> 1) Pass a patameter called @.bAudit to the stored procedures performing
> CRUD tasks and if the parameter is true then insert a row into the
> audit table (audit table has the same schema as the main table but with
> a few more columns for tracking).
> 2) Use triggers on Insert, Update and Delete but I can't find out how
> to disable triggers at run time.
> Can you please point me in the right direction? Thanks.
>