The lifecycle of a SQL query
1. The command parser evaluates the query and generates a hash to see if the buffer pool has an execution plan already stored.…
Read More1. The command parser evaluates the query and generates a hash to see if the buffer pool has an execution plan already stored.…
Read More
1 2 3 4 |
EXEC sys.sp_check_log_shipping_monitor_alert SELECT secondary_database, last_restored_date FROM msdb.dbo.log_shipping_secondary_databases |
First check the last file copied and restored to the secondary. Run the following queries on the secondary node. The following query…
Read More
1 2 3 4 5 6 7 8 9 10 |
SELECT name, DATABASEPROPERTYEX(name, 'Recovery') AS [recovery], DATABASEPROPERTYEX(name, 'IsAutoShrink') AS [auto-shrink], CASE WHEN primary_database IS NULL THEN 'no' ELSE 'yes' END AS [log-shipped], DATABASEPROPERTYEX(name, 'IsInStandBy') AS [stand-by], DATABASEPROPERTYEX(name, 'Status') AS [status] FROM master.dbo.sysdatabases sdb LEFT JOIN msdb.dbo.log_shipping_primary_databases lspd ON lspd.primary_database = sdb.name ORDER BY 1 |
Views – 2168
Read MoreHere is a short script to quickly shrink your log file if you DO NOT NEED to ever recover the database before the…
Read MoreThe implementation & syntax feels like an afterthought, like the engineers of SQL Server made something self-consistent, and then the market research wing…
Read MoreIf the disk drive that receives the log-shipping transaction files (*.trn) fills up, it will cause the log shipping chain to break for…
Read MoreYou can run the following SQL script to ensure email alerts are configured for the LSCopy and LSRestore jobs:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
-- Get the job_id values and stick them into a cursor: DECLARE @jobID UNIQUEIDENTIFIER DECLARE cur CURSOR LOCAL FOR SELECT [job_id|job_id] FROM [msdb|msdb].[dbo|dbo].[sysjobs|sysjobs] WHERE [name|name] LIKE 'LSCopy_%' OR [name|name] LIKE 'LSRestore_%' -- Loop through the cursor: OPEN cur FETCH NEXT FROM cur INTO @jobID WHILE @ @FETCH_STATUS = 0 BEGIN -- Call sp_update_job for each ID. Set email level to 2 -- (alert on fail) and the operator name: EXEC [msdb|msdb].[dbo|dbo].sp_update_job @job_id=@jobID, @notify_level_email=2, @notify_email_operator_name=N'DBA-EmailGroup' FETCH NEXT FROM cur INTO @jobID END CLOSE cur DEALLOCATE cur |
Views – 2572
Read MoreHere is an awesome extentions of the sp_who and sp_who2 (undocumented) sprocs DBA’s use to see slow running queries etc. Download link for…
Read More
1 2 |
SELECT * FROM sys.dm_exec_connections |
Views – 1943
Read MoreThis will also display the SQL Statement that is the offending blocker. Online index operations: Online index operations were added as an availability…
Read More