As many of know not all stack dumps raise an error in SQL
Server and may go unnoticed for days, SQL stack dumps can sometimes cause
database corruption and its always better to analyse the server immediately
after a stack dump. Since there are no errors raised we cannot configure normal
SQL Alert to report the SQL Stack dumps, I created a PowerShell script which
can also be scheduled as a SQL Agent job to monitor the SQL Stack dumps, I have used Chad Millers invoke-sqlcmd2 just for flexibility in the future, you can use native invoke-sqlcmd without any issue.
If you want to schedule this script as SQL Agent job remember to comment the clear-host and the invoke-sqlcmd2 function in the below script and try to use invoke-sqlcmd instead.Also I have scripted this to check the stack dumps for last one hour as I am running the SQL agent every hour in my environment, please change accordingly.
If you want to schedule this script as SQL Agent job remember to comment the clear-host and the invoke-sqlcmd2 function in the below script and try to use invoke-sqlcmd instead.Also I have scripted this to check the stack dumps for last one hour as I am running the SQL agent every hour in my environment, please change accordingly.
Hi - I am new Powershell language. can you tell excellently how to implement this change ?
ReplyDelete
ReplyDeletehere is the error i am facing
PS C:\Windows\system32> Param
The term 'Param' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spell
ing of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:6
+ Param <<<<
+ CategoryInfo : ObjectNotFound: (Param:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Windows\system32> (
>> [Parameter(Mandatory=$false,Position=0)]
>> [String]$sqlinstance_name = 'DMSQADB'
>> )
>>
Missing closing ')' in expression.
At line:3 char:5
+ <<<< [String]$sqlinstance_name = 'DMSQADB'
+ CategoryInfo : ParserError: (CloseParenToken:TokenId) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndParenthesisInExpression
ReplyDeletehere is the error i am facing
PS C:\Windows\system32> Param
The term 'Param' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spell
ing of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:6
+ Param <<<<
+ CategoryInfo : ObjectNotFound: (Param:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Windows\system32> (
>> [Parameter(Mandatory=$false,Position=0)]
>> [String]$sqlinstance_name = 'DMSQADB'
>> )
>>
Missing closing ')' in expression.
At line:3 char:5
+ <<<< [String]$sqlinstance_name = 'DMSQADB'
+ CategoryInfo : ParserError: (CloseParenToken:TokenId) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndParenthesisInExpression
which may require the installation of a suitable video card or board to help the computer run the Portable Monitors For Travelling.
ReplyDeleteYou have done a great job. I will definitely dig it and personally recommend to my friends. I am confident they will be benefited from this site.
ReplyDeleteAlthough not shown in the image, typical future OLED PC monitors will most likely be represented by a significantly larger triangle - representing an exceptionally broad colour gamut.Buy 240hz monitor
ReplyDeleteDo not use any solutions that contain Acetone, ethyl alcohol, toluene, ethyl acid, ammonia, or methyl chloride. Another important advice is to never touch the LCD screen with your fingers.4k vs 144hz: What's the best
ReplyDeleteHello! I just wish to give an enormous thumbs up for the nice info you've got right here on this post. I will probably be coming back to your weblog for more soon! Best 4k 144hz monitor 2019
ReplyDeleteI'm glad to see the great detail here!. Read reviews
ReplyDelete