Question : MS SQL 2005 Profiler

Hello, Experts

MS SQL 2005 Ent SP3 is running on Windows 2003 Ent SP2.
A SQL Agent job is scheudled to run every day at 12:05 AM and it restores one database from a SQL backup file.
The job completes successfully everyday except Sunday.
SQL Job log says that exclusive database access was denied as the reason for db restoration failure.
A script is run before db restoration and disconnects all connected users.
Obviously, the script fails on Sunday only.
I decided to run SQL profiler to find out which process/user/application etc. are causing this issue.

Now, here is my question.
Which events and columns should be traced in this case?

Thank you for your help.

Answer : MS SQL 2005 Profiler

Yep, can either do a select into, or, create a table and populate accordingly. Advantage of the second method is you can run the insert as many times as you need.

e.g.

insert my_sysprocesses
select getdate() as rundate,* from sys.sysprocesses


and the table will be :

CREATE TABLE my_sysprocesses(
      [ID] int IDENTITY(1,1) ,
      [rundate] datetime ,
      [spid] smallint ,
      [kpid] smallint ,
      [blocked] smallint ,
      [waittype] binary(2) ,
      [waittime] bigint ,
      [lastwaittype] nchar(32) ,
      [waitresource] nchar(256) ,
      [dbid] smallint ,
      [uid] smallint ,
      [cpu] int ,
      [physical_io] bigint ,
      [memusage] int ,
      [login_time] datetime ,
      [last_batch] datetime ,
      [ecid] smallint ,
      [open_tran] smallint ,
      [status] nchar(30) ,
      [sid] binary(86) ,
      [hostname] nchar(128) ,
      [program_name] nchar(128) ,
      [hostprocess] nchar(10) ,
      [cmd] nchar(16) ,
      [nt_domain] nchar(128) ,
      [nt_username] nchar(128) ,
      [net_address] nchar(12) ,
      [net_library] nchar(12) ,
      [loginame] nchar(128) ,
      [context_info] binary(128) ,
      [sql_handle] binary(20) ,
      [stmt_start] int ,
      [stmt_end] int ,
      [request_id] int
)

Random Solutions  
 
programming4us programming4us