How to see all the application errors related to SQL Server and export them to a .csv file.
2012-03-15 15:05
671 查看
How to see all the application errors related to SQL Server and export them to a .csv file? Just use below command:
Get-EventLog -LogName "Application" -computername RemoteServerName | Where-Object{$_.Source -like "*SQL*"} | Where-Object {$_.EntryType -eq "Error"} | Export-Csv D:\RemoteServerName.csv
xml file:
Get-EventLog -LogName "Application" -computername RemoteServerName | Where-Object{$_.Source -like "*SQL*"} | Where-Object {$_.EntryType -eq "Error"} | Export-Clixml D:\RemoteServerName.xml
txt file:
Get-EventLog -LogName "Application" -computername RemoteServerName | Where-Object{$_.Source -like "*SQL*"} | Where-Object {$_.EntryType -eq "Error"} | Out-File D:\DBS1_sqlevents.txt
To see all SQL Server–related errors on the local or remote server:
Get-EventLog -LogName "Application" -computername PowerServer3 | Where-Object{$_.Source -like "*SQL*"} | Where-Object {$_.EntryType -eq "Error"}
Get-EventLog -LogName "Application" | Where-Object {$_.EntryType -eq "Error"} | Where-Object {($_.TimeGenerated -gt "2012/03/11") -and ($_.TimeGenerated -lt "2012/03/15")} | Sort-Object TimeGenerated -descending | Format-Table -auto
Get-EventLog -ComputerName RemoteServerName -LogName "Application" | Where-Object {$_.EntryType -eq "Error"} | Where-Object {($_.TimeGenerated -gt "20012/03/01") -and ($_.TimeGenerated -lt "2012/03/31")} | Sort-Object TimeGenerated -descending | Format-Table
–auto
Get-EventLog -LogName "Application" -computername RemoteServerName | Where-Object{$_.Source -like "*SQL*"} | Where-Object {$_.EntryType -eq "Error"} | Export-Csv D:\RemoteServerName.csv
xml file:
Get-EventLog -LogName "Application" -computername RemoteServerName | Where-Object{$_.Source -like "*SQL*"} | Where-Object {$_.EntryType -eq "Error"} | Export-Clixml D:\RemoteServerName.xml
txt file:
Get-EventLog -LogName "Application" -computername RemoteServerName | Where-Object{$_.Source -like "*SQL*"} | Where-Object {$_.EntryType -eq "Error"} | Out-File D:\DBS1_sqlevents.txt
To see all SQL Server–related errors on the local or remote server:
Get-EventLog -LogName "Application" -computername PowerServer3 | Where-Object{$_.Source -like "*SQL*"} | Where-Object {$_.EntryType -eq "Error"}
Get-EventLog -LogName "Application" | Where-Object {$_.EntryType -eq "Error"} | Where-Object {($_.TimeGenerated -gt "2012/03/11") -and ($_.TimeGenerated -lt "2012/03/15")} | Sort-Object TimeGenerated -descending | Format-Table -auto
Get-EventLog -ComputerName RemoteServerName -LogName "Application" | Where-Object {$_.EntryType -eq "Error"} | Where-Object {($_.TimeGenerated -gt "20012/03/01") -and ($_.TimeGenerated -lt "2012/03/31")} | Sort-Object TimeGenerated -descending | Format-Table
–auto
相关文章推荐
- VBS Get Sql Server Table Data and Export to CSV File...
- VBS Get Sql Server Table Data and Export to CSV File...
- [SQL Server][FILESTREAM] -- How to Backup and Restore a SQL Server FILESTREAM Enabled Database
- asp and javascript: sql server export data to csv and to xls
- asp and javascript: sql server export data to csv and to xls
- CodeSnip: How to Get Id of the Record Using ASP.NET and SQL Server 2000
- [SQL Server][FILESTREAM] -- How to Detach and Attach a SQL Server FILESTREAM Enabled Database
- How to find out the Sql Server version and service pack
- How to Find the Self Service Related File Location and Versions
- How to Find the Self Service Related File Location and Versions
- How to Find the Self Service Related File Location and Versions
- How To Get Application Path,And How To Get The Path's Directory,File Name,And Type Info(如何得到运行程序的路径,以及如何得到路径的文件夹,文件名,以及类型等等信息)
- MS SQL错误:SQL Server failed with error code 0xc0000000 to spawn a thread to process a new login or connection. Check the SQL Server error log and the Windows event logs for information about possible related problems
- How to run the .net code within the Sql server
- How to Get First and Last Day of a Week in SQL Server
- How to Get First and Last Day of a Month in SQL Server
- Export data out to file from sql server
- How to Delete and Recreate the _msdcs DNS zone on a Windows DNS Server
- How to say all the keyboard symbols in English and Chinese
- How to Analyze Problems Related to Internal Errors (ORA-600) and Core Dumps (ORA-7445) using My Orac