Community编程与开发github.com

mianhtsys/landingMod3

全面的 Microsoft SQL Server 专家和路由器,覆盖 2016-2025 版本及云平台(Azure SQL 数据库、Azure SQL 托管实例、Azure VM 上的 SQL、AWS RDS、Google Cloud SQL)的完整数据库管理生命周期。路由到运维、监控、高可用/集群、工程、基础设施、云、安全以及离线 DuckDB 驱动的分析与建议(顾问)等专业技能。适用场景:"SQL Server"、"MSSQL"、"T-SQL"、"SSMS"、"sqlcmd"、"DBA"、"数据库管理"、通用或跨领域 SQL Server 问题,或具体管理领域不明确时。

landingMod3 是什么?

该技能 (`mianhtsys/landingMod3`) 是一个用于 AI 代理(如 Claude Code、Cursor、Codex)的顶级 SQL Server 专家和路由器。它整合了跨领域的 SQL Server 知识,并将特定领域的工作分派给同一插件中的八个专业技能(覆盖运维、监控、工程、基础设施、云、安全、高可用性/集群和离线分析)。主要优势在于其全面的版本和平台覆盖(包括 Azure SQL、AWS RDS 和 Google Cloud SQL),一个清晰的请求处理工作流(识别版本/平台、分类领域、加载专业参考、应用特定推理),以及一个完整的安全变更分类系统,以确保生产更改的安全执行。该技能提供了一个详细的路由表(将问题映射到正确的专业技能)、版本和平台对照表,以及基本的 SQL Server 常识,从而使其能够处理从备份和恢复到性能调优、高可用性设置和云迁移的任何事务。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mianhtsys/landingMod3/tree/HEAD/MODULO_3_DESARROLLO_AL_LADO_DEL_CLIENTE_Y_SERVIDOR_WEB/architecture-skills-framework/.agents/skills/sql-server

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

SQL Server 专家 (路由器)

您是 Microsoft SQL Server 的顶级专家和路由器。您掌握跨领域的 SQL Server 知识,并将特定领域的工作分派给此插件中的八个专业技能。直接回答技术与领域无关以及跨领域的问题;将深入的、特定领域的工作路由到正确的专业技能。

如何处理请求

  1. 识别版本和平台。 SQL Server 的行为、功能可用性和 DMV 因版本 (2016 → 2025) 和平台(Windows/Linux/容器上的盒装产品 vs. Azure SQL 数据库 vs. Azure SQL 托管实例 vs. AWS RDS)而异。如果未知且重要,请询问。使用下面的对照表。
  2. 分类管理领域并路由(参见路由表)。
  3. 加载领域技能的相关参考资料以获取深入知识,然后再回答。
  4. 应用 SQL Server 特定的推理 — 切勿给出通用的数据库建议。
  5. 提供可操作、可验证的指导 — 包括 T-SQL 示例、DMV 检查和验证步骤。只读诊断脚本位于每个领域技能的 scripts/ 文件夹中。

路由表

请求涉及……路由到技能触发词
备份/还原、恢复模式、维护、DBCC、SQL Agent 作业、修补、空间sqlserver-operations"backup", "restore", "recovery model", "DBCC CHECKDB", "maintenance", "Agent job", "CU/patch", "disk space"
性能诊断、等待、查询存储、XEvents、阻塞、死锁sqlserver-monitoring"slow", "wait stats", "Query Store", "Extended Events", "blocking", "deadlock", "high CPU", "PLE"
Always On 可用性组、FCI/WSFC、数据库镜像 + 端点、日志传送、复制、灾难恢复sqlserver-ha-clustering"Always On", "availability group", "FCI", "mirroring endpoint", "log shipping", "replication", "failover", "DR"
T-SQL、索引、执行计划、查询优化、基数估算器/统计信息、分区、列存储、架构设计sqlserver-engineering"T-SQL", "index", "execution plan", "query tuning", "cardinality estimator", "parameter sniffing", "partitioning"
实例/操作系统配置、内存、MAXDOP、tempdb、跟踪标志、存储、Linux/容器、网络sqlserver-infrastructure"max server memory", "MAXDOP", "tempdb config", "trace flag", "NUMA", "SQL on Linux", "storage layout", "ports"
Azure SQL DB/MI、VM 上的 SQL、AWS RDS、Cloud SQL、异地复制、故障转移组、迁移sqlserver-cloud"Azure SQL", "Managed Instance", "Hyperscale", "elastic pool", "RDS SQL Server", "geo-replication", "DMA/DMS", "cloud migration"
身份验证、授权、加密、行级安全性 (RLS)、动态数据掩码 (DDM)、审核、账本、加固sqlserver-security"authentication", "Entra ID", "Kerberos", "login/permission", "TDE", "Always Encrypted", "audit", "hardening"
基于在 DuckDB 中分析的只读捕获的离线健康审查/优先级建议(设计、索引、大小、统计信息、配置)sqlserver-advisor"analyze my database", "recommendations to improve", "table design review", "what indexes am I missing", "unused/duplicate indexes", "offline analysis", "DuckDB", "database health report"

当请求跨越多个领域时(例如,“在 Azure 上的 Linux 上设置包含 TDE 的可用性组”),将其分解并按顺序从每个相关技能中提取信息。

版本对照表

版本主要版本/兼容性级别主流支持结束日期扩展支持结束日期定义性功能
201613.x / 130已结束2026-07-14查询存储、时态表、Always Encrypted、行级安全性 (RLS)、动态数据掩码 (DDM)、JSON、重大的内存中 OLTP 增强功能(功能在 2014 年正式发布;SP1 将其普及到 Standard/Express)
201714.x / 140已结束2027-10-12Linux 支持、自适应查询处理、图形数据库、自动优化、可恢复索引重建
201915.x / 1502025-02-282030-01-08智能查询处理、加速数据库恢复 (ADR)、大数据集群(已弃用)、所有版本的 TDE
202216.x / 1602028-01-112033-01-11PSP 优化、DOP/CE 反馈、查询存储提示、账本、包含的可用性组、S3 备份、Azure Synapse Link
202517.x / 170待公布待公布原生向量类型 + DiskANN、正则表达式函数、原生 JSON 类型 + JSON 索引、优化锁定、REST 端点调用、变更事件流、Fabric 镜像

2025 脚注: 功能集和版本限制在正式发布 (GA) 附近仍在确定中 — 在依赖特定 2025 功能之前,请查看 Microsoft Learn 上您构建版本的当前 2025 GA 范围/版本限制。

兼容性级别独立于引擎版本控制优化器行为。 请务必同时确认引擎版本 (SELECT @@VERSION) 和数据库兼容性级别 (SELECT name, compatibility_level FROM sys.databases)。

平台/部署对照表

平台是什么修补高可用性模型关键限制
Windows 上的盒装产品完整引擎,您拥有操作系统您(累积更新 (CU))FCI、可用性组、镜像、日志传送完整功能集;您管理所有内容
Linux 上的盒装产品RHEL/Ubuntu/SLES 上的完整引擎您FCI(共享存储)和可用性组 — 两者均由 Pacemaker/Corosync 编排,而不是 WSFCFCI 支持在 Linux 上(Pacemaker 管理,需要 STONITH);一些功能对等性差距(例如 FILESTREAM/PolyBase)—— 请检查版本
容器Docker/K8s 中的引擎镜像交换通过 K8s 操作器的可用性组临时性;需要持久卷;若无适当措施,不适合重负载生产环境
Azure SQL 数据库PaaS 单一数据库/弹性池Microsoft内置(区域/异地)无 SQL Agent(使用弹性作业),无跨数据库查询(使用弹性查询),无实例级功能
Azure SQL 托管实例PaaS 实例,近完整表面积Microsoft内置 + 故障转移组有 SQL Agent,支持跨数据库查询,不支持 FILESTREAM,跟踪标志有限
Azure VM 上的 SQL (IaaS)盒装产品,MS 管理的 VM 扩展您(或自动修补)与盒装产品相同完全控制;SQL IaaS Agent 扩展增加价值
适用于 SQL Server 的 AWS RDS托管盒装产品AWS多可用区(底层使用镜像/可用性组)无 sa,有限的 sysadmin,受限的 xp_cmdshell,无直接操作系统访问
适用于 SQL Server 的 Google Cloud SQL托管盒装产品 (GCP PaaS)Google区域高可用性(主实例 + 区域持久磁盘上的备用实例,自动故障转移);只读副本不会故障转移无 sysadmin/superuser,无操作系统访问;受限制的系统过程/功能;已启用 SQL Server Agent(用于复制/作业);在 Google Cloud 文档上验证当前功能表面

跨领域基础知识

这些适用于所有场景;领域技能会更深入地探讨。

首先确定实例(只读)

在任何版本或版本敏感的建议之前,先确定您连接的是哪个实例:

-- 只读诊断:确定引擎版本、版本、平台
SELECT @@VERSION;
SELECT
    SERVERPROPERTY('Edition')             AS Edition,
    SERVERPROPERTY('EngineEdition')       AS EngineEdition,   -- 数字平台/版本类别(映射如下)
    SERVERPROPERTY('ProductMajorVersion') AS MajorVersion,    -- 13=2016 … 17=2025
    SERVERPROPERTY('IsHadrEnabled')       AS IsHadrEnabled;   -- 1 = 已启用 Always On 可用性组

EngineEdition 值映射(告诉您平台,而不仅仅是 SKU — 对于新版本,请在 Microsoft Learn 上验证):

值含义
3盒装产品 Enterprise / Standard / Developer / Evaluation
4Express
5Azure SQL 数据库(所有服务层级,包括 Hyperscale)
6Azure Synapse Analytics(专用 SQL 池)
8Azure SQL 托管实例
9Azure SQL Edge
11Azure Synapse 无服务器 SQL 池(不是 Hyperscale)
12Microsoft Fabric SQL 数据库(当前的 Microsoft Learn;请根据版本验证)

存储引擎要点

  • 页 = 8 KB;区 = 8 页 (64 KB)。最大行大小 8,060 字节(LOB/行溢出处理剩余部分)。
  • 堆(无聚集索引,RID 定位器)vs. 聚集索引(叶节点就是数据,每个表一个)。优先选择窄、唯一、静态、单调递增的聚集键。
  • 每个数据库只有一个由预写日志记录 (WAL) 控制的事务日志:在其日志记录被持久化之前,不会有脏页写入磁盘。

恢复模式(一行概览;详情在 sqlserver-operations 中)

  • 简单 — 无日志备份,无时间点恢复。仅限开发/测试。
  • 完整 — 需要日志备份,完整的时间点恢复。生产环境默认。
  • 大容量日志 — 最小记录批量操作;在批量操作窗口期间时间点恢复受限。

隔离级别(详情在 sqlserver-engineering 中)

两个不同的轴 — 不要混淆它们:

  • 四个 ANSI 级别(隔离性递增,锁定/阻塞增加):READ UNCOMMITTED → READ COMMITTED(默认)→ REPEATABLE READ → SERIALIZABLE。
  • 两个行版本控制选项(读取器不阻塞写入器;版本保存在 tempdb 中):RCSI (READ_COMMITTED_SNAPSHOT ON — 将语句级版本控制替换到 READ COMMITTED 中,无需更改代码)和 SNAPSHOT (ALLOW_SNAPSHOT_ISOLATION ON — 事务级一致性,通过 SET TRANSACTION ISOLATION LEVEL SNAPSHOT 选择启用)。

对于 OLTP,优先选择 RCSI,而不是散布 NOLOCK。注意:行版本控制为每个修改的行添加一个 14 字节的版本标记,并在 tempdb 中添加一个版本存储区 — 相应地,将 tempdb 放置在快速存储上并调整其大小。

诊断入口点

从等待统计信息 (sys.dm_os_wait_stats) 开始,了解 SQL Server 在等待什么,然后深入到顶级查询 → 阻塞 → 执行计划 → 配置。完整工作流在 sqlserver-monitoring 中。

版本(功能限制)

  • Enterprise — 所有功能,无资源上限(在线索引创建/重建,无限内存,完整的 IQP,在 2016 SP1 之前分区传统上仅为 EE)。
  • Standard — 受限(内存限制,例如 128 GB 缓冲池;历史上可用性组仅限于基本/2 节点)。不支持在线索引操作 — ONLINE = ON 是 Enterprise 独占(也是 Developer/Evaluation;Azure SQL DB/MI 引擎支持它)跨所有盒装产品版本 2016–2025;Standard 从未获得此功能。在 Standard 上,REBUILD 是离线操作(Sch-M 锁阻塞表)—— 默认使用 REORGANIZE 或在批准的维护窗口内进行计划的离线重建。(可恢复重建需要 ONLINE = ON,因此在盒装产品上同样是 Enterprise 限制;可恢复索引创建在 2019+ 中引入。)请根据版本在 Microsoft Learn 上验证。
  • Developer — Enterprise 功能,仅限非生产环境,免费。
  • Express — 免费,小型(10 GB 数据库上限,已限制内存/核心数),无 SQL Agent。
  • 2016 SP1+ 将许多可编程功能(分区、列存储、内存中 OLTP)普及到 Standard/Express。TDE 在 2019 年推广到所有版本。

变更分类标签与安全约定(插件范围)

此插件标记每个非只读的 T-SQL 示例,以便代理或用户永远不会将生产变更与安全查询混淆。领域技能在其代码围栏上应用这些标签;此路由器是分类法的跨领域参考:

标签覆盖范围注意事项
-- [配置变更]sp_configure/RECONFIGURE、ALTER DATABASE ... SET、作用域配置、ALTER SERVER CONFIGURATION可运行的教学示例;占位符数据库名称;通过 DB_NAME() 确认目标;注意版本限制
-- [性能变更]查询存储强制/取消强制/提示、索引 REBUILD/REORGANIZE/CREATE、UPDATE STATISTICS可运行;仅在批准的维护窗口内运行影响数据大小或导致阻塞的操作
-- [架构变更]阻塞/数据大小的 DDL:ADD ... PERSISTED、WITH CHECK CHECK CONSTRAINT、大型索引 DDL、ADD/DROP COLUMN可运行;维护窗口;存在状态回滚的情况
-- [安全变更]`CREATE/ALTER LOGINUSER
-- [数据丢失风险]可能导致已提交数据丢失或不可逆:FORCE_FAILOVER_ALLOW_DATA_LOSS、FORCE_SERVICE_ALLOW_DATA_LOSS、DBCC ... REPAIR_ALLOW_DATA_LOSS、RESTORE ... WITH REPLACE、QUERY_STORE CLEAR、DROP、账本表创建不可运行的 Runbook 模板 — 每一行可执行代码都被注释掉,真实名称由 [CONFIRM_*] 占位符替换,前面有一个预检清单(验证角色/状态;对于故障转移比较 last_hardened_lsn/同步状态;记录批准;验证备份;冻结应用;指定协调/回滚负责人)。例外:还原教程其主题就是还原,保持可运行但保留标签和“WITH REPLACE 会覆盖目标 — 确认实例/数据库”的注意事项

机密: 切勿提交真实机密或将其粘贴到 T-SQL/shell 历史记录中;从机密管理器获取,并轮换曾经从文档中复制过的任何内容。

反模式(适用于所有领域)

  1. 到处使用 NOLOCK — 读取未提交、重复或跳过的行。改用 RCSI。
  2. 启用 AUTO_SHRINK — 碎片化索引,消耗 CPU,文件重新增长。切勿启用。
  3. 忽略 tempdb 配置 — 分配页争用。每个核心最多 8 个文件,大小相等。
  4. 未测试的还原 — 未测试的备份不是备份。
  5. 应用程序帐户为 sysadmin/db_owner — 通过角色实现最小权限。
  6. 并行的成本阈值保持为 5 — 太低了;从 50 开始。
  7. 将云 PaaS 视为盒装产品 — 每个产品的功能差距(Agent、跨数据库查询、跟踪标志)不同。

此插件中的领域技能

  • sqlserver-operations — 备份/恢复、维护、DBCC、Agent 作业、修补、容量规划。
  • sqlserver-monitoring — 等待、DMV、查询存储、扩展事件、阻塞、死锁。
  • sqlserver-ha-clustering — Always On 可用性组、FCI/WSFC、镜像 + 端点、日志传送、复制、灾难恢复。
  • sqlserver-engineering — T-SQL、索引、计划、优化、统计信息、分区、架构设计。
  • sqlserver-infrastructure

…(为翻译而截断)

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

mianhtsys/landingMod3

Implement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.

mianhtsys/landingMod3

Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.

mianhtsys/landingMod3

Diseña y compara alternativas arquitectónicas trazables a RF/RNF sin implementar código.

mianhtsys/landingMod3

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.

mianhtsys/landingMod3

Revisión adversarial de la arquitectura contra RF/RNF, detectando contradicciones, cobertura faltante y complejidad innecesaria.

mianhtsys/landingMod3

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.

mianhtsys/landingMod3

>- Generate grounded-and-verified, engine-agnostic database documentation that reaches 100% parity with the real schema. Introspects the LIVE database as ground truth and cross-validates it against ORM models, migrations, generated types, seeds, and application queries, then proves completeness by diffing the docs back against the database. Produces ER diagrams (mermaid), per-table data dictionaries, and a machine-readable schema.json. Works with PostgreSQL, MySQL, SQL Server, and SQLite across any ORM (Prisma, TypeORM, Drizzle, Sequelize, Knex, Django, Rails) or raw SQL. Use when asked to document a database, produce an ERD or data dictionary, write db/schema docs, audit schema drift, or refresh existing DB docs.

mianhtsys/landingMod3

Compara estrategias de persistencia y motores de datos según consistencia, concurrencia, volumen, recuperación y operación.

mianhtsys/landingMod3

Design robust, scalable database schemas for SQL and NoSQL databases. Provides normalization guidelines, indexing strategies, migration patterns, constraint design, and performance optimization. Ensures data integrity, query performance, and maintainable data models.

mianhtsys/landingMod3

Consolida análisis especializados en una recomendación arquitectónica, matriz de decisión, ADR y plan de validación.

mianhtsys/landingMod3

Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.

mianhtsys/landingMod3

Build and maintain web frontends — component architecture, state management, API integration, responsive layout, client-side performance, and frontend testing patterns. Framework agnostic, focused on web frontend implementation. Do not use for backend service implementation, data engineering, or platform infrastructure work.

mianhtsys/landingMod3

Evalúa despliegue, contenedores, escalado, alta disponibilidad, observabilidad, backup, recuperación y CI/CD de forma proporcional.

mianhtsys/landingMod3

Execute read-only SQL queries against multiple Microsoft SQL Server databases. Use when: (1) querying MSSQL/SQL Server databases, (2) exploring database schemas/tables, (3) running SELECT queries for data analysis, (4) checking database contents. Supports multiple database connections with descriptions for intelligent auto-selection. Blocks all write operations (INSERT, UPDATE, DELETE, DROP, etc.) for safety.

mianhtsys/landingMod3

Generate and maintain OpenAPI 3.1 specifications from code, design-first specs, and validation patterns. Use when creating API documentation, generating SDKs, or ensuring API contract compliance.

mianhtsys/landingMod3

PHP 8.0+ development — XAMPP, RESTful APIs, PDO/MySQL/MariaDB, and authentication. Use when building PHP backends, creating API endpoints, configuring XAMPP, or integrating PHP with databases.

mianhtsys/landingMod3

Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features

mianhtsys/landingMod3

Analiza requisitos funcionales y no funcionales, reglas, restricciones, capacidad y ambigüedades antes de seleccionar tecnologías.

mianhtsys/landingMod3

Implement modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first breakpoint strategies. Use when building adaptive interfaces, implementing fluid layouts, or creating component-level responsive behavior.

mianhtsys/landingMod3

>- Use when designing or implementing software securely: define security requirements, threat-model a feature, choose secure defaults, design authentication and authorization, handle untrusted data and secrets, evaluate dependencies, design multi-tenant trust boundaries, or review security-sensitive changes. Use for prevention during requirements, design, implementation, and review; not for post-build security assessments or scanning an existing codebase.

相关技能