Files
sql-server-samples/samples/features/epm-framework/sample-policies/Database Collation.xml
T

252 lines
15 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--Copyright (c) Microsoft Corporation.-->
<!--Licensed under the MIT License-->
<model xmlns="smlif.xsd">
<_locDefinition xmlns="urn:locstudio">
<_locDefault _loc="locNone" />
<_locTag _loc="locData">DMF:Name</_locTag>
<_locTag _loc="locData">DMF:Description</_locTag>
<_locTag _loc="locData">DMF:Condition</_locTag>
<_locTag _loc="locData">DMF:ObjectSet</_locTag>
<_locTag _loc="locData">DMF:RootCondition</_locTag>
<_locTag _loc="locData">DMF:PolicyCategory</_locTag>
<_locTag _loc="locData">DMF:HelpText</_locTag>
</_locDefinition>
<identity>
<name>urn:uuid:96fe1236-abf6-4a57-b54d-e9baab394fd1</name>
<baseURI>http://documentcollection/</baseURI>
</identity>
<xs:bufferSchema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<definitions xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08">
<document>
<docinfo>
<aliases>
<alias>/system/schema/DMF</alias>
</aliases>
<sfc:version DomainVersion="3" />
</docinfo>
<data>
<xs:schema targetNamespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="sml.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="Policy">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ObjectSet">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Condition">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="PolicyCategory">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TargetSet">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TargetSetLevel">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<DMF:bufferData xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08">
<instances xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08">
<document>
<docinfo>
<aliases>
<alias>/PolicyStore/Policy/Database Collation</alias>
</aliases>
<sfc:version DomainVersion="3" />
</docinfo>
<data>
<DMF:Policy xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="sml.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<DMF:Parent>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore</sml:Uri>
</sfc:Reference>
</DMF:Parent>
<DMF:PolicyCondition>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore/Condition/Collation Matches master or model</sml:Uri>
</sfc:Reference>
</DMF:PolicyCondition>
<DMF:PolicyObjectSet>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore/ObjectSet/Database Collation__ObjectSet</sml:Uri>
</sfc:Reference>
</DMF:PolicyObjectSet>
<DMF:PolicyPolicyCategory>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore/PolicyCategory/Microsoft Best Practices_b Performance</sml:Uri>
</sfc:Reference>
</DMF:PolicyPolicyCategory>
<DMF:Name type="string">Database Collation</DMF:Name>
<DMF:Description type="string">Looks for user-defined databases that have a collation different from the master or model databases. It is recommended that you not use this configuration because collation conflicts can occur that might prevent code from executing. For example, when a stored procedure joins one table to a temporary table, SQL Server might end the batch and return a collation conflict error if the collations of the user-defined database and the model database are different. This happens because temporary tables are created in tempdb, which obtains its collation based on that of the model database. If you experience collation conflict errors, consider one of the following solutions:&lt;?char 13?&gt;
* Export the data from the user database and import it into new tables that have the same collation as the master and model databases.&lt;?char 13?&gt;
* Rebuild the system databases to use a collation that matches the user database collation.&lt;?char 13?&gt;
* Modify any stored procedures that join user tables to tables in tempdb to create the tables in tempdb by using the collation of the user database. To do this, add the COLLATE database_default clause to the column definitions of the temporary table. For example: CREATE TABLE #temp1 ( c1 int, c2 varchar(30) COLLATE database_default )</DMF:Description>
<DMF:Condition type="string">Collation Matches master or model</DMF:Condition>
<DMF:ObjectSet type="string">Database Collation_ObjectSet</DMF:ObjectSet>
<DMF:PolicyCategory type="string">Microsoft Best Practices: Performance</DMF:PolicyCategory>
<DMF:Enabled type="boolean">false</DMF:Enabled>
<DMF:AutomatedPolicyEvaluationMode type="AutomatedPolicyEvaluationMode">None</DMF:AutomatedPolicyEvaluationMode>
<DMF:HelpText type="string" />
<DMF:HelpLink type="string">http://go.microsoft.com/fwlink/?LinkId=116336</DMF:HelpLink>
<DMF:ActiveEndDate type="dateTime">0001-01-01T00:00:00</DMF:ActiveEndDate>
<DMF:ActiveStartDate type="dateTime">0001-01-01T00:00:00</DMF:ActiveStartDate>
</DMF:Policy>
</data>
</document>
<document>
<docinfo>
<aliases>
<alias>/PolicyStore/ObjectSet/Database Collation__ObjectSet</alias>
</aliases>
<sfc:version DomainVersion="3" />
</docinfo>
<data>
<DMF:ObjectSet xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="sml.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<DMF:TargetSets>
<sfc:Collection>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore/ObjectSet/Database Collation__ObjectSet/TargetSet/Server_/Database</sml:Uri>
</sfc:Reference>
</sfc:Collection>
</DMF:TargetSets>
<DMF:Parent>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore</sml:Uri>
</sfc:Reference>
</DMF:Parent>
<DMF:Name type="string">Database Collation_ObjectSet</DMF:Name>
<DMF:Facet type="string">IDatabasePerformanceFacet</DMF:Facet>
</DMF:ObjectSet>
</data>
</document>
<document>
<docinfo>
<aliases>
<alias>/PolicyStore/Condition/Collation Matches master or model</alias>
</aliases>
<sfc:version DomainVersion="3" />
</docinfo>
<data>
<DMF:Condition xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="sml.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<DMF:Parent>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore</sml:Uri>
</sfc:Reference>
</DMF:Parent>
<DMF:Expression type="string">&lt;Operator&gt;&lt;?char 13?&gt;
&lt;TypeClass&gt;Bool&lt;/TypeClass&gt;&lt;?char 13?&gt;
&lt;OpType&gt;EQ&lt;/OpType&gt;&lt;?char 13?&gt;
&lt;Count&gt;2&lt;/Count&gt;&lt;?char 13?&gt;
&lt;Attribute&gt;&lt;?char 13?&gt;
&lt;TypeClass&gt;Bool&lt;/TypeClass&gt;&lt;?char 13?&gt;
&lt;Name&gt;CollationMatchesModelOrMaster&lt;/Name&gt;&lt;?char 13?&gt;
&lt;/Attribute&gt;&lt;?char 13?&gt;
&lt;Function&gt;&lt;?char 13?&gt;
&lt;TypeClass&gt;Bool&lt;/TypeClass&gt;&lt;?char 13?&gt;
&lt;FunctionType&gt;True&lt;/FunctionType&gt;&lt;?char 13?&gt;
&lt;ReturnType&gt;Bool&lt;/ReturnType&gt;&lt;?char 13?&gt;
&lt;Count&gt;0&lt;/Count&gt;&lt;?char 13?&gt;
&lt;/Function&gt;&lt;?char 13?&gt;
&lt;/Operator&gt;</DMF:Expression>
<DMF:Name type="string">Collation Matches master or model</DMF:Name>
<DMF:Description type="string">Confirms that the collation of the database matches the master or model databases.</DMF:Description>
<DMF:Facet type="string">IDatabasePerformanceFacet</DMF:Facet>
</DMF:Condition>
</data>
</document>
<document>
<docinfo>
<aliases>
<alias>/PolicyStore/PolicyCategory/Microsoft Best Practices_b Performance</alias>
</aliases>
<sfc:version DomainVersion="3" />
</docinfo>
<data>
<DMF:PolicyCategory xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="sml.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<DMF:Parent>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore</sml:Uri>
</sfc:Reference>
</DMF:Parent>
<DMF:Name type="string">Microsoft Best Practices: Performance</DMF:Name>
</DMF:PolicyCategory>
</data>
</document>
<document>
<docinfo>
<aliases>
<alias>/PolicyStore/ObjectSet/Database Collation__ObjectSet/TargetSet/Server_/Database</alias>
</aliases>
<sfc:version DomainVersion="3" />
</docinfo>
<data>
<DMF:TargetSet xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="sml.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<DMF:Levels>
<sfc:Collection>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore/ObjectSet/Database Collation__ObjectSet/TargetSet/Server_/Database/TargetSetLevel/Server_/Database</sml:Uri>
</sfc:Reference>
</sfc:Collection>
</DMF:Levels>
<DMF:Parent>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore/ObjectSet/Database Collation__ObjectSet</sml:Uri>
</sfc:Reference>
</DMF:Parent>
<DMF:TargetTypeSkeleton type="string">Server/Database</DMF:TargetTypeSkeleton>
<DMF:Enabled type="boolean">true</DMF:Enabled>
</DMF:TargetSet>
</data>
</document>
<document>
<docinfo>
<aliases>
<alias>/PolicyStore/ObjectSet/Database Collation__ObjectSet/TargetSet/Server_/Database/TargetSetLevel/Server_/Database</alias>
</aliases>
<sfc:version DomainVersion="3" />
</docinfo>
<data>
<DMF:TargetSetLevel xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="sml.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<DMF:Parent>
<sfc:Reference sml:ref="true">
<sml:Uri>/PolicyStore/ObjectSet/Database Collation__ObjectSet/TargetSet/Server_/Database</sml:Uri>
</sfc:Reference>
</DMF:Parent>
<DMF:TargetTypeSkeleton type="string">Server/Database</DMF:TargetTypeSkeleton>
<DMF:LevelName type="string">Database</DMF:LevelName>
<DMF:Condition type="string" />
</DMF:TargetSetLevel>
</data>
</document>
</instances>
</DMF:bufferData>
</xs:schema>
</data>
</document>
</definitions>
</xs:bufferSchema>
</model>