Posts

Showing posts from September, 2018

Recovery Models In MSSQL Server

We have 3 recovery models in MSSQL server 1.Simple 2.Full 3.Bulk Log recovery 1.Simple- Point in time recovery is not possible in this recovery model as logs will be truncated automatically and there are no log backups available due to automatic log truncation we can use checkpoint command to truncate the log file manually 2.Full- Point in time recovery of database is possible and most of the production databases will be running in this model to recover in case disasters and we can take log backups Log file can be truncated using log backup 3.Bulk Log Recovery- we will use this model when we are doing any bulk load operations like bulk insert or delete as it will avoid log issues and  bulk operation is logged as single entry in log file to avoid the log file issues during this activity 

AlwaysOn Maintenance Jobs

Rebuild Index- Rebuild index is resource intensive task and if we are rebuilding index in always on databases we need  to be extra careful as it will replicate all this changes to secondary replicas    To minimize this impact we can follow some best practices  1.Rather then running rebuild index on all the index at a time,We can check for index which are fragmented more than 30% and rebuild, If fragmentation is less then 30% we can reorganize the index  2.Log file size may grow big during this activity we should monitor log file growth to understand the behavior 3. We can switch from synchronous to asynchronous mode to  improve the performance in primary replica during the rebuild to avoid  wait till the time it receives acknowledgement from secondary replica to commit the changes