Skip to main content

Posts

Showing posts from July, 2018

PowerShell script to manage Maximo

#run powershell script remotely Invoke-Command -ComputerName COMPUTER -ScriptBlock { COMMAND } Invoke-Command -ComputerName COMPUTER -ScriptBlock { COMMAND } -credential a.jsun #find computer last reboot time systeminfo -S servername   |findstr /I "boot time" PS > Invoke-Command -ComputerName servername  -ScriptBlock { Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime } #find computer last 10 reboot time invoke-command -computername $servername -scriptblock {get-eventlog system | where-object {$_.eventid -eq 6006 -or $_.eventid -eq 6005 }  | select -first 10} #query status of windows service sc \\servername  query "OracleWeblogic ship76domain_Vessel_ManSrv" PS > Invoke-Command -ComputerName servername  -ScriptBlock { Get-Service -Name "OracleWeblogic ship76domain_Vessel_ManSrv" } #query history of a service start/stop in eventlog PS > (Get-EventLog -LogName "System" -Source "Service Contro

Case study of SQL AlwaysOn transaction log file shrink

Case study of SQL AlwaysOn transaction log file shrink. Usually backup transaction log will move the LVF head lower, make it possible to shrink transaction log, but with sqlalwaysOn configuration, I found that it not work as always, I need to specifically fill up the highest LVF so that transaction log head can move to lower side. This is the case study of that. The following blog explained lazy truncation of sql AlwaysOn: https://blogs.msdn.microsoft.com/sql_pfe_blog/2013/06/27/lazy-log-truncation-clearing-of-sql-transaction-log-vlf-status-deferred/ To find out the file size: SELECT DB_NAME ( database_id ) AS DatabaseName , Name AS Logical_Name , Physical_Name , ( size * 8 )/ 1024 SizeMB FROM sys . master_files --WHERE DB_NAME(database_id) = 'AdventureWorks' order by 4 desc GO We use Sp_CentralAdmin database as example to shrink logfile: Use Sp_CentralAdmin go Dbcc loginfo go Noticed that all the LVF has status=2.