Month: November 2018

SQL Server TSQL-Scripts

Here are som great scripts to manage SQL-server log See why you cannot shrink log files; select log_reuse_wait_desc,* from sys.databases as a1 –where name like ‘lois%’ order by a1.log_reuse_wait_desc See always on database status; Select last_commit_time, synchronization_state_desc,* from sys.dm_hadr_database_replica_states where database_id = 5 See how much data log files are using; DBCC SQLPERF(LOGSPACE); Shrink log …

Exchange Migration – Restart Apppool

Here is a gret script that restarts the Autodiscover Apppool every 5 minutes until there isn’t any mailboxes left on the oldserver. This one works for Exchange 2016 and 2013 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn; do{ $i = 1 $mail = (get-mailbox -server “kakster-oldexchange”).count Restart-WebAppPool MSExchangeAutodiscoverAppPool Write-host “Restarting AppPool” -ForegroundColor GREEN “Waiting for 3 minutes” Start-Sleep -Seconds 300 …