Posts

Showing posts from 2012

Query for Finding Blocking

( SELECT   *   FROM   master . dbo . sysprocesses WHERE  spid  IN   ( SELECT  blocked  FROM   master . dbo . sysprocesses )) SELECT   spid ,   status ,  loginame = substring ( loginame ,  1 ,  12 ), hostname = substring ( hostname ,  1 ,  12 ), blk = CONVERT ( char ( 3 ),  blocked ), open_tran , dbname = substring ( db_name ( dbid ), 1 , 10 ), cmd ,   waittype ,  waittime ,  last_batch FROM   master . dbo . sysprocesses WHERE  spid  IN   ( SELECT  blocked  FROM   master . dbo . sysprocesses ) AND  blocked = 0  

Replication Commands

/* Run all the below commands in Distribution database. When the distribution Agent job is stopped */ USE distribution go SELECT * from MSrepl_transactions order by entry_time desc /*It gives the transaction and command details Don't give xact_seqno in single quotes */ select * From MSrepl_commands where xact_seqno = 0x0000003000000010001A GO /* Column value here coming from the column of command in MSRepl_commands table,give here xact_seqno_start in single quotes */ exec sp_browsereplcmds @command_id = 1 , @xact_seqno_start = '0x0000003000000010001A' , @xact_seqno_end = '0x0000003000000010001A' , @publisher_database_id = 2 go EXEC sp_replmonitorsubscriptionpendingcmds @publisher = 'RAMESH' , @publisher_db = 'ADHOC' , @Publication = 'Adhoc' , @Subscriber = 'RAMESH\TEST' , @Subscriber_db = 'Adhoc' ,