Sau khi nâng cấp SQL Server 2014 lên 2016, máy chủ sẽ tiếp tục đặt lại các gói và dm*
chế độ xem thực thi được lưu trong bộ nhớ cache (như dm_exec_query_stats
), cứ sau vài giờ
Như thể ai đó thực thi DBCC FREEPROCCACHE
và DBCC DROPCLEANBUFFERS
thủ công (ngoại trừ không có ai làm, nó sẽ tự động xảy ra).
Cơ sở dữ liệu tương tự cũng hoạt động tốt trên SQL Server 2014 và Windows Server 2012, mọi thứ đã đi về phía nam sau khi chuyển sang SQL Server 2016 (và máy chủ Windows 2016)
Điều tôi đã kiểm tra: cơ sở dữ liệu không có cờ "tự động đóng". Máy chủ SQL được ad hoc optimized
đặt thành true
(Tôi nghĩ nó sẽ giúp ích, nhưng không được). "Cửa hàng truy vấn" là "tắt". Máy chủ có bộ nhớ 16 GB.
Không có gì hữu ích trong "Nhật ký máy chủ SQL". Chỉ cần một tin nhắn sao lưu hàng tuần ...
Tôi cũng đã kiểm tra bài viết này https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-set-options (cuộn xuống phần "Ví dụ" và bên phải nó) có một danh sách các tình huống khi kế hoạch được xóa tự động. Không ai trong số đó áp dụng.
CẬP NHẬT:
Thật không may, không có gợi ý nào giúp được. Cấp quyền LPIM, phát hiện và sửa các truy vấn không tham số tạo ra hàng tấn kế hoạch cho cùng một truy vấn, giảm "bộ nhớ máy chủ tối đa" ... Các kế hoạch tiếp tục đặt lại ngẫu nhiên, từ vài giờ đến 5-10 phút một lần. Nếu máy chủ "chịu áp lực bộ nhớ" thì tại sao phiên bản 2014 hoạt động tốt trên cùng một máy.
Đây là đầu ra sp_Blitz theo yêu cầu
**Priority 10: Performance**:
- Query Store Disabled - The new SQL Server 2016 Query Store feature has not been enabled on this database.
* xxx
**Priority 50: Server Info**:
- Instant File Initialization Not Enabled - Consider enabling IFI for faster restores and data file growths.
**Priority 100: Performance**:
- Resource Governor Enabled - Resource Governor is enabled. Queries may be throttled. Make sure you understand how the Classifier Function is configured.
**Priority 120: Query Plans**:
- Implicit Conversion Affecting Cardinality - One of the top resource-intensive queries has an implicit conversion that is affecting cardinality estimation.
*
- Missing Index - One of the top resource-intensive queries may be dramatically improved by adding an index.
*
- RID or Key Lookups - One of the top resource-intensive queries contains RID or Key Lookups. Try to avoid them by creating covering indexes.
*
**Priority 170: File Configuration**:
- System Database on C Drive
* master - The master database has a file on the C drive. Putting system databases on the C drive runs the risk of crashing the server when it runs out of space.
* model - The model database has a file on the C drive. Putting system databases on the C drive runs the risk of crashing the server when it runs out of space.
* msdb - The msdb database has a file on the C drive. Putting system databases on the C drive runs the risk of crashing the server when it runs out of space.
**Priority 200: Backup**:
- MSDB Backup History Not Purged msdb - Database backup history retained back to Jun 10 2017 9:47PM
**Priority 200: Informational**:
- Backup Compression Default Off - Uncompressed full backups have happened recently, and backup compression is not turned on at the server level. Backup compression is included with SQL Server 2008R2 & newer, even in Standard Edition. We recommend turning backup compression on by default so that ad-hoc backups will get compressed.
**Priority 200: Non-Default Server Config**:
- Agent XPs - This sp_configure option has been changed. Its default value is 0 and it has been set to 1.
- max server memory (MB) - This sp_configure option has been changed. Its default value is 2147483647 and it has been set to 15000.
- optimize for ad hoc workloads - This sp_configure option has been changed. Its default value is 0 and it has been set to 1.
- show advanced options - This sp_configure option has been changed. Its default value is 0 and it has been set to 1.
- xp_cmdshell - This sp_configure option has been changed. Its default value is 0 and it has been set to 1.
**Priority 200: Performance**:
- Buffer Pool Extensions Enabled - You have Buffer Pool Extensions enabled, and one lives here: Z:\sql_buffer_pool.BPE. It's currently 60.00000000000 GB. Did you know that BPEs only provide single threaded access 8KB (one page) at a time?
- cost threshold for parallelism - Set to 5, its default value. Changing this sp_configure setting may reduce CXPACKET waits.
**Priority 240: Wait Stats**:
- No Significant Waits Detected - This server might be just sitting around idle, or someone may have cleared wait stats recently.
**Priority 250: Informational**:
- SQL Server Agent is running under an NT Service account - I'm running as NT Service\SQLSERVERAGENT. I wish I had an Active Directory service account instead.
- SQL Server is running under an NT Service account - I'm running as NT Service\MSSQLSERVER. I wish I had an Active Directory service account instead.
**Priority 250: Server Info**:
- Default Trace Contents - The default trace holds 125 hours of data between Aug 19 2017 11:55AM and Aug 24 2017 4:59PM. The default trace files are located in: C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Log
- Hardware - Logical processors: 2. Physical memory: 15GB.
- Hardware - NUMA Config - Node: 0 State: ONLINE Online schedulers: 2 Offline schedulers: 0 Processor Group: 0 Memory node: 0 Memory VAS Reserved GB: 29
- Locked Pages In Memory Enabled - You currently have 12.02534484863 GB of pages locked in memory.
- Memory Model Unconventional - Memory Model: LOCK_PAGES
- Server Last Restart - Aug 20 2017 12:32PM
- Server Name - xx
- Services
- Service: SQL Full-text Filter Daemon Launcher (MSSQLSERVER) runs under service account NT Service\MSSQLFDLauncher. Last startup time: not shown.. Startup type: Manual, currently Running.
- Service: SQL Server (MSSQLSERVER) runs under service account NT Service\MSSQLSERVER. Last startup time: Aug 20 2017 12:32PM. Startup type: Automatic, currently Running.
- Service: SQL Server Agent (MSSQLSERVER) runs under service account NT Service\SQLSERVERAGENT. Last startup time: not shown.. Startup type: Automatic, currently Running.
- SQL Server Last Restart - Aug 20 2017 12:33PM
- SQL Server Service - Version: 13.0.4446.0. Patch Level: SP1. Edition: Enterprise Edition (64-bit). AlwaysOn Enabled: 0. AlwaysOn Mgr Status: 2
- Virtual Server - Type: (HYPERVISOR)
- Windows Version - You're running a pretty modern version of Windows: Server 2012R2 era, version 6.3
**Priority 254: Rundate**:
- Captain's log: stardate something and something...