技术开发 频道

SQL Server 2008基于策略的管理

  任务三:创建一个策略来强制执行用户定义的条件

  步骤:16. 在Object Explorer 中,依次展开Management/Policy Management/Policies, 然后右键点击Policies 并点击New Policy…

  17. 在General 选项卡中,输入: “DBO is not a valid user-defined Schema Name - Base Tables, Views & SPs” 作为策略的名称

  18. 在Check condition 下拉列表中,找到Multipart Name 组并选择“DBO is not a valid user-defined Schema Name”

  19. 完成后你将可以设置该策略都要应用到那些对象上。在Against Targets 中选择Every StoredProcedure, Table 以及View,但只应用到“Development Databases.” 为了创建我们所要定义的“Development Databases”,点击? Database 然后点击New Condition…

  20. 在General 选项卡中,输入:“Development Databases (explicitly named)” 作为条件的名称

  21. 在Facet 下拉列表中,选择Database.

  22. 在Expression 中,首先点击Field 下拉列表,然后选择@Name.

  23. 在Expression 中,点击Operator 下拉列表,此时我们希望@Name IN (‘AdventureWorks’, ‘AdventureWorksDW’) ,因此我们在Operator 下拉列表中选择IN

  24. 最后在Value 列中输入‘AdventureWorks2008’, ‘AdventureWorksDW2008’, AdventureWorksLT2008’ (包括上引号和逗号,另外不要直接从此实验手册中复制粘贴,否则引号格式将发生改变)

  25. 点击下面的空行,从而完成当前行的输入。然后点击OK 退出

  26. 此时OK 按钮依然无法点击。目前这是IN 操作符的一个bug,因此对上述内容进行修改,只针对AdventureWorks2008. 最终的条件将变为@Name = ‘AdventureWorks2008’. 点击OK 并创建此条件

  27. 在Create New Policy 对话框中,为每一个对象类型(StoredProcedure, Table, 和View)勾选? , 然后选择“Development Databases (explicitly named)”:

  28. 当设置完目标以后,我们将设置Execution Mode 为On Change – Prevent.

  29. 在Server restriction 选项中,保留默认设置None.

  30. 在Description 选项卡中,设置Category 为“Database Best Practice: Security ”.

  31. 然后输入描述信息“Corporate standard (as of September 2008), is to use schemas for better security and granularity. Objects should not be owned by the dbo - especially if cross-database ownership chaining were to become enabled.”

  32. 此外在Additional Help Hyperlink 中添加一些辅助信息,如下所示:

  Text to display: Please see our Security Guidelines and Best Practices here

  Address: http://InternalWebsite/Policies/SQLServerSecurity.htm

  33. 返回到General 选项卡,并勾选? Enabled 复选框来启用该策略

  34. 点击OK

0
相关文章