3.9 Enforcing IT Standards with PBM
This section considers scope when using
Policy-Based Management (PBM) to report and potentially enforce
organization IT standards within the database. Many organizations
suffer from staff turnover, lack of adherence, and missing or
conflicting standards for object naming conventions.
There is potentially an overlap between the
policies in this section and those in the preceding best practices
section. Arguably some of these policies are best practices, but when
adopting these conventions as organizational standards, PBM can be used
to enforce these policies. That is to say, PBM could prevent a
developer or administrator from making a change that is noncompliant
with the organization’s standards.
In order to configure a policy to utilize the On
Change: prevent evaluation mode, the facet must support Data Definition
Language (DDL) changes.
OUT-OF-THE-BOX BEST PRACTICE POLICIES
SQL Server provides a number of best
practice policies. You can import these policies, which are located in
the Program Files folder. These policies provide a useful starting
point, although they often require modification to achieve the desired
outcome.
3.10 Object Naming Conventions
Naming conventions are a good area in
environments with a lot of best practice guidance. However, an
organization needs to determine which approach will best suit its needs.
One commonly used convention is to prefix all stored procedures with the characters ‘usp_’. This clearly identifies these as user-created stored procedures, thereby differentiating them from system stored procedures.
To do so, create a condition, choose a meaningful
name, and select the Stored Procedure facet. In the Expression pane,
choose the field @Name, use the LIKE operator, and type ’usp_%’ in the Value field, as shown in Figure 8.
Once the condition has been created, create a new
policy and select the check condition created earlier. In the Against
targets pane, choose Every Stored Procedure in Every database. If
desirable, change the Evaluation Mode to On change: prevent. This will
cause an error and rollback for any CREATE PROCEDURE statement that does not comply with the naming convention. Figure 9 shows the policy configuration.