Jan 3, 2024

Scan SQL Server Error Log

 Scan SQL Server Error Log 



create table #t_789(Log_date datetime,Process_Info Nvarchar(1000),Txt Nvarchar(3500) )

insert into #t_789 exec sp_readerrorlog

insert into #t_789 exec sp_readerrorlog 1; 

insert into #t_789 exec sp_readerrorlog 2;

insert into #t_789 exec sp_readerrorlog 3;

select * from #t_789 where Txt like '%error %';

Scan Current Error Log 

--create table #t_789(Log_date datetime,Process_Info Nvarchar(1000),Txt Nvarchar(3500) )

truncate table #t_789

insert into #t_789 exec sp_readerrorlog;

select Log_date,txt from #t_789 order by 1 desc ;


Read Windows Event Log Command Line Tool for system Reboot

# Fetch reboot events

Get-EventLog -LogName System | Where-Object {

    $_.EventID -in 6005, 6006, 6008, 1074, 41

} | Select-Object TimeGenerated, EventID, Message



No comments:

Post a Comment

If you have any doubt or question, please contact us.