数据库 (A database)

A SQL Server database can be thought of, in and of itself, as a data dictionary. It is self-describing, in that objects can be scripted into Data Definition Language aka DDL scripts to view all attributes, quickly and easily.

可以将SQL Server数据库本身视为数据字典。 这是自描述的,因为可以将对象编写为数据定义语言 (又称为DDL脚本)的脚本,以快速,轻松地查看所有属性。

SQL Server has functions like sp_helptext to further help describe database objects as well as system views to present views of the database and object collections in a variety of ways. The self-describing nature of a database can be enhanced with Extended properties, which allow user defined descriptions to be attributed to objects at various levels in the database.

SQL Server具有诸如sp_helptext之类的功能,以进一步帮助描述数据库对象以及系统视图,从而以多种方式呈现数据库和对象集合的视图。 可以使用扩展属性来增强数据库的自描述性质,该属性允许将用户定义的描述归因于数据库中各个级别的对象。

Advantage:

优点:

  • Nothing has to be done to take advantage of the self-describing properties of a database. You get all of this out-of-the-box 无需采取任何措施即可利用数据库的自我描述属性。 您可以立即使用所有这些功能

Disadvantage:

坏处:

  • Not in a format that can be easily read, viewed by non-database professionals. Requires knowledge of SQL, functions, system views etc. 非数据库专业人员不能以易于阅读的格式查看。 需要有关SQL,函数,系统视图等的知识。
  • Is only a snapshot in time, contains no historical information, changes or context. 只是时间上的快照,不包含历史信息,更改或上下文。

数据库文件 (Database documentation)

Documentation can be referred as a single instance, or snapshot, the database rendered in an easily readable, user friendly format like HTML or compiled HTML (e.g. chm) that any user can view, even without database experience.

文档可以称为单个实例或快照,该数据库以易于阅读,用户友好的格式(例如HTML或已编译HTML(例如chm),任何用户都可以查看,即使没有数据库经验也可以)呈现。

Disadvantages:

缺点:

  • Is only a snapshot in time, contains no historical information, changes or context. 只是时间上的快照,不包含历史信息,更改或上下文。
  • Requires additional software or programming skills to extract the data and turn it into information, the documentation 需要其他软件或编程技能才能提取数据并将其转变为信息,文档
  • Impossible to query and report on directly as it is information rendered for humans, not computers 由于是为人类而非计算机提供的信息,因此无法直接查询和报告
  • The large file size makes it time-consuming to create and voluminous to archive 较大的文件大小使其创建起来很费时,而且需要大量存档

Advantages

优点

  • Easy to read and understand by anyone, regardless of skill or experience 不论技术或经验如何,任何人都易于阅读和理解
  • Certain advantageous features of the database itself, like Extended properties and can be directly leveraged in the documentation 数据库本身的某些有利功能,例如扩展属性,可以在文档中直接利用
  • Portable; documentation can be emailed, FTP, printed or otherwise distributed 便携式 文档可以通过电子邮件,FTP,打印或其他方式分发

Click here to learn more about SQL Server database documentation.

单击此处以了解有关SQL Server数据库文档的更多信息。

数据库版本控制 (Database version control)

A database, itself, and database documentation are great, but they are one dimensional snapshots in time. Neither can provide the context of changes or history. Version (or source) control provides a solution for that in that all objects can be versioned over time, allowing a user to browse any version of an object or even the entire database in time

数据库本身和数据库文档都很棒,但是它们是及时的一维快照。 两者都无法提供更改或历史的上下文。 版本(或源)控件提供了一种解决方案,可以随时间对所有对象进行版本控制,从而允许用户及时浏览对象的任何版本,甚至整个数据库

Additionally, version control allows users to revert to any previous object version or the entire database itself

此外,版本控制允许用户还原到任何以前的对象版本或整个数据库本身

Disadvantages:

缺点:

  • Requires source control software for repository like Git or Subversion 需要用于仓库(例如Git或Subversion)的源代码控制软件
  • Requires setup time and configuration both for the repository and to get the data loaded into the repository 需要资源库的建立时间和配置,以及将数据加载到资源库中的时间
  • Impossible to query and report on directly 不能直接查询和报告

Advantages:

优点:

  • Full version control and history of all versioned objects with all of the features offered from popular source control systems like labels and version history. 完整版本控制和所有版本对象的历史记录,以及流行的源代码控制系统提供的所有功能,例如标签和版本历史记录。
  • Portable in that documentation can be emailed, FTP, printed or otherwise distributed 该文档中的便携式内容可以通过电子邮件,FTP,打印或其他方式分发
  • Immutable, once created, at least in formats like PDF and CHM, the documentation can’t be changed, which is helpful for auditing purposes 一旦创建后就不可变,至少采用PDF和CHM之类的格式,该文档无法更改,这有助于审核
  • Allows for iterative checking in and checking out of objects, so that a source control archive isn’t just a collection of snapshots but a close-to-real-time rendering of the database status 允许迭代签入和签出对象,因此源代码控制档案不仅是快照的集合,而且是数据库状态的接近实时的呈现
  • Comments can be associated with changes to provide additional context 注释可以与更改关联以提供其他上下文

Click here to learn more about SQL Server source control.

单击此处以了解有关SQL Server源代码管理的更多信息。

数据字典 (A Data Dictionary)

A data dictionary combines elements of the database, as

数据字典结合了数据库的元素,例如

  1. it is itself (usually) stored in the database, 它本身(通常)存储在数据库中,
  2. and documentation, as it attempts to render the information is a view that is easier to consume, query and view, 和文档,因为它试图呈现信息是一个易于使用,查询和查看的视图,
  3. but also version control, as it stores versioned snapshot of the database schema. 而且还有版本控制,因为它存储了数据库模式的版本化快照。

But since a database dictionary exists, itself, in a database, unlike version control, it lends itself to being easily queried and reported against

但是由于数据库字典本身存在于数据库中,因此与版本控制不同,它易于查询和报告

Disadvantages:

缺点:

  • Requires initial setup and creation of a job to periodically load the data dictionary with information 需要初始设置和创建作业以定期向数据字典加载信息
  • Not portable, like documentation. Information must be queried to be viewed 不可移植,例如文档。 必须查询信息才能查看

Advantages:

优点:

  • Full version control and history of all versioned objects 完整版本控制和所有版本对象的历史记录
  • Although not immutable, can be made tamper resistant with security, permissions etc. 虽然不是一成不变的,但可以使其具有安全性,权限等防篡改功能。
  • Leverages the power of an RDBMs with querying, filtering, sorting, grouping etc. 利用RDBM的功能进行查询,过滤,排序,分组等。
  • Efficient storage of information with easy retrieval, backup etc. 高效的信息存储,易于检索,备份等
  • Can be used as a basis to easily create reports with a variety of technologies like SSRS 可以用作使用SSRS等各种技术轻松创建报告的基础
  • Would be faster to update than documentation 更新将比文档更新更快

数据字典到底是什么? (What exactly is a data dictionary?)

A simple data dictionary is a repository of information about the database, usually in a database itself, that stores object information and attributes, versioned over time.

一个简单的数据字典是有关数据库的信息的存储库,通常存储在数据库本身中,该数据库存储对象信息和属性,并随时间进行版本控制。

A data dictionary can contain the following information about a particular object:

数据字典可以包含有关特定对象的以下信息:

  • Datetime the current object was created or changed 当前对象的创建或更改日期
  • Object name 对象名称
  • Object owner 对象所有者
  • User who created or update the object 创建或更新对象的用户
  • Data definition language script 数据定义语言脚本
  • List of data element (column) names and details 数据元素(列)名称和详细信息列表
  • Key order for all the elements (which can be possible keys) 所有元素的键顺序(可以是可能的键)
  • Information about indexes and other attributes 有关索引和其他属性的信息
  • Relationships 人际关系
  • Changes 变化
  • Extended properties 扩展属性

“哑巴”与“智能”数据字典 (“Dumb” vs “Smart” data dictionaries)

Dumb dictionaries are repository of schema snapshots, regardless of what if any data changed. Such dumb dictionaries can be created by simply scripting the schema to a table nightly.

哑字典是架构快照的存储库,而不管数据是否更改。 可以通过每晚简单地将模式脚本编写到表中来创建此类哑字典。

This raw data provides a true representation of the database state but since most of the records are duplicates, versions of the same unchanged objects, much of the value of a data dictionary can’t be unlocked. A version history could be easily created from a dumb dictionary, but most of the “versions” would be duplicates. As most of the objects are static versions of what existed, vs what changed, it wouldn’t be possible to query the data for information about change transactions like the number of objects a user changed each month

这些原始数据提供了数据库状态的真实表示,但是由于大多数记录都是重复的,是相同未更改对象的版本,因此无法解锁数据字典的大部分值。 可以使用哑字典轻松创建版本历史记录,但是大多数“版本”都是重复的。 由于大多数对象都是已存在和已更改的静态版本,因此无法在数据中查询有关更改事务的信息,例如用户每月更改的对象数量

“Smart” data dictionaries start with a baseline and write only data that has changed. This allows users querying the data to mine real information, knowing that each new version of an object, represents an actual change. In this way, a version history of an object would show only versions that actually changed, making this feature as powerful as version history in source control.

“智能”数据字典从基线开始, 写入已更改的数据。 这样,用户就可以查询数据以挖掘真实信息,同时知道对象的每个新版本都代表实际更改。 这样,对象的版本历史记录将仅显示实际更改的版本,从而使此功能与源代码管理中的版本历史记录一样强大。

Knowing that each object record reflected an actual change, we can layer on lots of value added reports that instantly tell the transactional history of the database e.g. changes per day/month/year, changes by user, the object with the most changes etc.

知道每个对象记录都反映了实际的更改,因此我们可以基于大量增值报告,这些报告可以立即告诉数据库交易记录,例如每天/每月/每年的更改,用户的更改,更改最多的对象等。

By unlocking the potential to see a true object change history and isolate specific changes without having to sort through duplicates, coupled with the ability to run investigative queries, would transform even the simplest “smart” data dictionary into a powerful tool for forensic auditing and even recovery, as any changes could be easily reverted to a previous version

通过释放查看真实对象更改历史记录的可能性并隔离特定更改而无需对重复项进行分类,再加上运行调查查询的能力,即使是最简单的“智能”数据字典也可以转化为强大的工具,可用于法医审核甚至恢复,因为任何更改都可以轻松还原到以前的版本

用途 (Uses)

The primary purpose of a data dictionary is to be an auditing archive of changes that is easy to query and report on. Large amounts of data can be stored efficiently leveraging the power of a RDBMS. Data can be easily filtered, extracted, sorted and grouped into meaningful reports.

数据字典的主要目的是成为易于查询和报告的变更审核档案。 利用RDBMS的强大功能,可以有效地存储大量数据。 可以轻松地过滤,提取,分类数据并将其分组为有意义的报告。

A data dictionary provides information that can easily be converted into other views. For example, you could query your data dictionary to see the full history of changes for a particular object

数据字典提供了可以轻松转换为其他视图的信息。 例如,您可以查询数据字典以查看特定对象的完整更改历史记录

A data dictionary can be used for version control and auditing purposes, even without using a source control repository, clients or having developers even know changes were being logged. In this way, setting up such a “poor man’s” version control system is a straightforward task of creating the data dictionary

数据字典可用于版本控制和审核目的,即使不使用源代码控制存储库,客户端或让开发人员甚至都不知道正在记录更改。 这样,建立这样的“穷人”版本控制系统是创建数据字典的直接任务。

Data dictionaries provide a great medium for transactional and aggregate reporting. Since the data dictionary is a repository of all changes, it can be used to create reports to track the count of transactions over time, by user, by object and produce a series of reports, that provide great insight into the transactional changes of a database over time, like shown below:

数据字典为事务报告和汇总报告提供了很好的媒介。 由于数据字典是所有更改的存储库,因此它可以用于创建报告以按时间,按用户,按对象跟踪事务计数,并生成一系列报告,这些报告可以很好地了解数据库的事务更改随着时间的推移,如下图所示:

Examples of reports include:

报告示例包括:

  1. Total transactions – Count of changes by hour/day/week/month/year 交易总数–按小时/天/周/月/年的变化计数
  2. Total transactions by type – Count of changes by hour/day/week/month/year by Type e.g., Update, Insert, Delete 按类型划分的总交易–按类型按小时/天/周/月/年的变化计数,例如更新,插入,删除
  3. Busiest day – Top days of the week by the most changes 最忙的一天–一周中最繁忙的日子,变化最多
  4. Most productive developer report – top users by the most changes 生产力最高的开发人员报告–变化最多的顶级用户
  5. Most dynamic object report – top objects by the most changes 最动态的对象报告-最多的对象变化最多
  6. etc. 等等

In the next part of this series, How to build a “smart” SQL Server Data dictionary, I’ll explore How to create a Smart SQL Server data dictionary and in the final article in the series, I’ll explore how to leverage it to its full advantage for object history and change auditing as well as transactional reporting. Stay tuned!

在本系列的下一部分, 如何构建“智能” SQL Server数据字典 ,我将探讨如何创建智能SQL Server数据字典,在本系列的最后一篇文章中,我将探讨如何利用它。充分利用对象历史和变更审核以及事务报告的优势。 敬请关注!

翻译自: https://www.sqlshack.com/sql-server-data-dictionary-want-create-one/

什么是SQL Server数据字典?为什么要创建一个?相关推荐

  1. 03.三月风雨愁断肠,学习大数据特别忧伤——谈谈AKS创建SQL Server大数据群集创建愁断肠

    03.三月风雨愁断肠,学习大数据特别忧伤--谈谈AKS创建SQL Server大数据群集创建愁断肠 [TOC] 前言 使用AKS创建SQL Server大数据群集有几种方法,由于产品不断的更新,SQL ...

  2. 在SQL Server中配置索引创建内存设置的最佳实践

    介绍 (Introduction) The Index Create Memory setting is an advanced SQL Server configuration setting wh ...

  3. 如何使用SQL Server Microsoft Mobile Publisher创建移动仪表盘?

    Over the past three years, I read some interesting news about Microsoft which was "Microsoft ac ...

  4. 如何在SQL Server Management Studio中创建和配置链接服务器以连接到MySQL

    This article will guide you with all the necessary steps to successfully create a linked server in S ...

  5. SQL Server 2017 SELECT…INTO 创建的新表指定到文件组

    SQL Server 2017 SELECT-INTO 创建的新表指定到文件组 原文:SQL Server 2017 SELECT-INTO 创建的新表指定到文件组 SELECT-INTO 在 SQL ...

  6. mysql的事件探查器_用SQL Server事件探查器创建跟踪

    SQL Server事件探查器(Profiler)可以帮助数据库管理员跟踪SQL Server数据库所执行的特定事件,监视数据库的行为;并将这些有价值的信息保存到文件或表,以便以后用来分析解决数据库出 ...

  7. [SQL Server]树形结构的创建

    对于SQL Server来说,构建显示一个树形结构不是一件容易的事情,逻辑构造能力不是它的强项.不过也不是说它没有能力干这个事情,只要换一种思维方式就可以理解它的工作原理. 例如,现在有一张表的内容如 ...

  8. SQL Server 中关于 @@error 的一个小误区

    原文:SQL Server 中关于 @@error 的一个小误区 在SQL Server中,我常常会看到有些前辈这样写: if(@@error<>0)ROLLBACK TRANSACTIO ...

  9. 今天在webcasts上看sql server 2008的新功能介绍,无意中发现在连接sql server 数据库时,还有一个...

    今天在webcasts上看sql server 2008的新功能介绍,无意中发现在连接sql server 数据库时,还有一个 Failover Partner的选项.以前都没注意过,它的主要功能就是 ...

最新文章

  1. ASP.NET 3.5之屠龙刀
  2. We7 从这里开始---安装we7
  3. python【数据结构与算法】选数问题(选不相连最大值——DP)
  4. 长春理工大学第十四届程序设计竞赛(重现赛)F.Successione di Fixoracci
  5. 电脑开机提示EFI Netword 0 for ipv4 boot failed的原因及解决方法
  6. 安全扫描工具_固件级安全,微软安全工具新增UEFI扫描功能
  7. 在linux下编译android下的opencv,使用cmake的方法
  8. Echarts数据可视化全解
  9. 蓝绿部署、滚动发布、灰度发布等方案对比总结
  10. ASP.Net七大内置对象 (整理的不错,转过来参考)
  11. 描述计算机病毒来源的几种代表性看法,关于计算机病毒的起源
  12. 计算机 变成飞行模式无法上网,win10电脑中开启了飞行模式不能上网如何解决
  13. 安卓开发实现悬浮窗显示(全局显示),通过悬浮窗实时监控当前流量
  14. 网络安全运营能力建设
  15. 项目经理论坛_项目经理晋升之路:诚信、自信、韧性
  16. 华为手机信息不弹屏了为什么_华为手机验证码不弹出是怎么回事
  17. 推荐几个常用常玩的小游戏网址包括4399.com
  18. crontab——定时周期性执行任务
  19. MySQL processlist的state属性详解
  20. 内存拷贝函数 void * memcpy ()

热门文章

  1. 军队计算机使用管理规定,军队通用计算机系统使用安全要求.doc
  2. Android外存的读写
  3. springcloud配置动态更新
  4. java Int数据工具类
  5. AES加密,解决了同步问题,和随机密钥和固定密钥,多端通信加密不一致解决办法...
  6. Windows 10 使用问题
  7. 低姿态生活,高境界做人
  8. ★LeetCode(942)——增减字符串匹配(JavaScript)
  9. (进阶)LeetCode(338)——比特位计数(JavaScript)
  10. 计算机网络学习笔记(4. Internet结构)