Thứ Năm, 1 tháng 12, 2016

[MSSQL] List Database (expand databse) in SSMS Slow

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/99bbcb47-d4b5-4ec0-9e91-b1a23a655844/ssms-2012-extremely-slow-expanding-databases?forum=sqltools

lý do có nhiều database đang set auto_close = on 
=> xử lý là set thuộc tính database  auto_close = off

SELECT 'Alter Database [' +name+'] set AUTO_CLOSE OFF'
FROM master.sys.databases AS dtb 
WHERE is_auto_close_on = 1
ORDER BY name

=> copy lệnh run trên query mới

Used this script to find those databases: 
SELECT name, is_auto_close_on, is_auto_shrink_on FROM master.sys.databases AS dtb 
WHERE is_auto_close_on = 1 OR is_auto_shrink_on = 1
ORDER BY name

giải thích thuộc tính  auto_close

 According to Books Online:
When set to ON, the database is shut down cleanly and its resources are freed after the last user exits. The database automatically reopens when a user tries to use the database again.

    When set to OFF, the database remains open after the last user exits

Không có nhận xét nào: