This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a way to check the execution history of DBA command like DBCC CHECKDB in SQL Server.
Why is this important?
DBCC CHECKDB is important for SQL Database which is fixing and showing critical errors. But if your database size is huge and some other DBA already executed DBCC CHECKDB then?
Do you need to run again? – The answer is NO.
If you have a big size of the database, DBCC CHECKDB requires more time to complete the execution.
The solution:
Before executing DBCC CHECKDB, you should check the execution history of it.
You can do using sp_readerrorlog, which is an undocumented system stored procedure.Using this, you can read the contents of SQL Server error log files, and you can also perform a search using your keywords.
Syntax of sp_readerrorlog:
1 |
EXEC sp_readerrorlog |
Log number 0= current log
Log type 1= read SQL Server error logs
1 |
EXEC sp_readerrorlog 0, 1, 'DBCC CHECKDB' |
Sample result:
Leave a Reply