Posts

Showing posts from September, 2020

Data file and log file growth of Databases calculation

The below query will provide us the database data and log file growth options on the disk. select DB_NAME(mf.database_id) database_name , mf.name logical_name , CONVERT ( DECIMAL ( 20 , 2 ) , ( CONVERT ( DECIMAL , size ) /128 )) [file_size_MB] , CASE mf.is_percent_growth WHEN 1 THEN 'Yes' ELSE 'No' END AS [is_percent_growth] , CASE mf.is_percent_growth WHEN 1 THEN CONVERT ( VARCHAR , mf.growth) + '%' WHEN 0 THEN CONVERT ( VARCHAR , mf.growth /128 ) + ' MB' END AS [growth_in_increment_of] , CASE mf.is_percent_growth WHEN 1 THEN CONVERT ( DECIMAL ( 20 , 2 ), ((( CONVERT ( DECIMAL , size ) * growth) /100 ) *8 ) /1024 ) WHEN 0 THEN CONVERT ( DECIMAL ( 20 , 2 ), ( CONVERT ( DECIMAL , growth) /128 )) END AS [next_auto_growth_size_MB] , CASE mf.max_size WHEN 0 THEN 'No growth is allowed' WHEN -1 THEN 'File will grow until the disk is full' ELSE CONVERT ( VARCHAR , mf.max_size) END AS [max_size] , phy...

Windows Cluster Information through powershell

 The below script extract information about Cluster resource status in  Windows Cluster cls #ClusterResource $GetClusterInfo = Get-ClusterResource $GetClusterInfo | ForEach -Object{ $GetClustInfo = $_ if ( $GetClustInfo .State -ne 'Online' ) { $GetClustInfo | Format-Table -AutoSize| Out-String | Write-Host -ForegroundColor Red } else { $GetClustInfo | Format-Table -AutoSize| Out-String | Write-Host -ForegroundColor Green } } ; #Cluster Netwok $GetClusterNetwork = Get-ClusterNetwork $GetClusterNetwork | ForEach -Object{ $GetClustNet = $_ if ( $GetClustNet .State -ne 'UP' ) { $GetClustNet | Format-Table -AutoSize| Out-String | Write-Host -ForegroundColor Red } else { $GetClustNet | Format-Table -AutoSize| Out-String | Write-Host -ForegroundColor DarkYellow } } ; #Cluster NetworkInterface $GetClustNetInterface = Get-ClusterNetworkInterface $GetClustNetInterface | ForEach -Object{ $GetClustNetINter = $_ if ( $GetClustNetINter .State -ne 'U...

SQL Server Agent Job step info with Powershell

Image
We can use the below query to get the job step information of SQL Server Agent jobs.