11.2. SMO Instance Classes for Administering Objects Not Used for Data Storage Reference
This section describes the classes used to administer SQL Server SMO instance classes that are not used to store data. The classes are arranged into functional groups.
11.2.1. Server Configuration
The SMO classes
used to manage configuration information for a SQL Server instance are described in Table 11-1.
Table 11-1. SMO classes for managing SQL Server configurationClass | Description |
---|
ConfigProperty | Represents configuration option information. | ConfigPropertyCollection | Represents a collection of ConfigProperty objects. The Properties property of the Configuration class returns the collection of configuration. | Configuration | Represents configuration information for a SQL Server instance. The configuration information object for a configuration option setting is exposed through the properties of the Configuration object that returns a ConfigProperty object.
The Configuration object is accessed through the Configuration property of the Server class. |
11.2.2. Registered Servers
Registered servers let you save connection information for SQL Server instances. Server groups create a hierarchy similar to an operating system directory to facilitate organization of registered servers. Registered servers and server groups can be viewed in the Registered Servers view in SQL Server Management Studio.
The SMO classes used to manage registered SQL servers and server groups are described in Table 11-2. These classes are located in the Microsoft.SqlServer.Management.Smo.RegisteredServers namespace.
Table 11-2. SMO classes for managing registered servers and server groupsClass | Description |
---|
RegisteredServer | Represents a registered SQL Server. | RegisteredServerCollection | Represents a collection of registered SQL Servers as RegisteredServer objects.
The RegisteredServers property of the ServerGroup class returns a RegisteredServerCollection object containing SQL servers included in the parent server group.
The RegisteredServers property of the SmoApplication.SqlServerRegistrations class returns a RegisteredServerCollection object containing SQL servers defined on the SmoApplication object. | ServerGroup | Represents a group of registered SQL Server instances. | ServerGroupCollection | Represents a collection of registered SQL Server groups as ServerGroup objects. The ServerGroups property of the SmoApplication.SqlServerRegistrations class returns a ServerGroupCollection object containing SQL server groups defined on the SmoApplication object. |
11.2.3. Linked Servers
A linked server is a database system other than SQL Server that is linked to a SQL Server instance through an OLE DB driver. The SMO classes
used to manage linked servers are described in Table 11-3.
Table 11-3. SMO classes for managing linked serversClass | Description |
---|
LinkedServer | Represents a database system other than SQL Server. | LinkedServerCollection | Represents a collection of linked servers as LinkedServer objects. The LinkedServers property of the Server class returns the collection of linked servers registered with the SQL Server instance. | LinkedServerLogin | Represents a SQL Server logon account that has permission to connect to a linked server. | LinkedServerLoginCollection | Represents a collection of linked server logins as LinkedServerLogin objects. The LinkedServerLogins property of the LinkServer class returns the collection of linked server logins defined on the linked server. |
11.2.4. Database Defaults
The SMO classes used to manage database defaults are described in Table 11-4.
Table 11-4. SMO classes for managing database defaultsClass | Description |
---|
Default | Represents a SQL Server database default. | DefaultCollection | Represents a collection of database defaults as Default objects. The Defaults property of the Database class returns the collection of defaults defined on the database. |
11.2.5. Files and Filegroups
A SQL Server database is mapped over a series of operating system files with data files and log files always stored in separate files. Data can be mapped to both a single primary data file (.mdf file), which is the starting point for all database operations, and optional secondary data files (.ndf files). Log files contain information used to recover the database and are mapped to one or more operating system files (.ldf files).
Filegroups are used to group together database objects and files for allocation and administrative purposes. Log files are not part of a filegroup and are managed separately from the data space.
The SMO classes used to manage data files, log files, and filegroups are described in Table 11-5.
Table 11-5. SMO classes for managing files and filegroupsClass | Description |
---|
DataFile | Represents a SQL Server data file. | DataFileCollection | Represents a collection of data files as DataFile objects. The Files property of the FileGroup class returns the collection of data files defined in the filegroup. | FileGroup | Represents a SQL Server filegroup. | FileGroupCollection | Represents a collection of filegroups as FileGroup objects. The FileGroups property of the Database class returns the collection of filegroups defined on the database. | LogFile | Represents a SQL Server log file. | LogFileCollection | Represents a collection of log files as LogFile objects. The LogFiles property of the Database class returns the collection of log files defined on the database. |
11.2.6. Partition Functions
Partitioning a database splits large tables into smaller tables to improve performance and simplify maintenance. A partition function maps each row of a table or index into a partition based on the values of a specified column. A partition is scoped at the database level.
The SMO classes used to manage partition functions are described in Table 11-6.
Table 11-6. SMO classes for managing partition functionsClass | Description |
---|
PartitionFunction | Represents a partition function. | PartitionFunctionCollection | Represents a collection of partition functions as PartitionFunction objects. The PartitionFunctions property of the Database class returns the collection of partition functions defined on the database. | PartitionFunctionEvents | Represents the settings required for SQL Server partition function event notification. The PartitionFunctionEvents object is obtained using the Events property of the PartitionFunction object and cannot be created as a standalone object. | PartitionFunctionParameter | Represents a partition function parameter. | PartitionFunctionParameterCollection | Represents a collection of partition function parameters as PartitionFunctionParameter objects. The PartitionFunctionParameters property of the PartitionFunction class returns the collection of partition function parameters defined on the partition function. |
11.2.7. Partition Schemes
A partition scheme maps partitions of a partitioned table or index to filegroups. The SMO classes
used to manage partition schemes are described in Table 11-7.
Table 11-7. SMO classes for managing partition schemesClass | Description |
---|
PartitionScheme | Represents a partition scheme. | PartitionSchemeCollection | Represents a collection of partition schemes as PartitionScheme objects. The PartitionSchemes property of the Database class returns the collection of partition schemes defined on the database. | PartitionSchemeEvents | Represents the settings required for SQL Server partition scheme event notification. The PartitionSchemeEvents object is obtained using the Events property of the PartitionScheme object and cannot be created as a standalone object.
The SubscribeToEvents( ) method of the PartitionSchemeEvents class specifies the events to receive as an ObjectEventSet object. | PartitionSchemeParameter | Represents a partition scheme parameter. | PartitionSchemeParameterCollection | Represents a collection of partition scheme parameters as PartitionSchemeParameter objects. The PartitionSchemeParameters property of both the Table and Index classes returns the collection of partition scheme parameters defined on the table or index. |
11.2.8. Logins
The SMO classes used to manage logins are described in Table 11-8.
Table 11-8. SMO classes for managing loginsClass | Description |
---|
DatabaseMapping | Represents a SQL Server database mapping of logins to database users for each database.
The EnumDatabaseMappings( ) method of the Login class returns an array of DatabaseMapping objects for the login account. | Login | Represents a SQL Server login account granted access to SQL Server through either Windows or SQL Server standard authentication. | LoginCollection | Represents a collection of Login objects. The Logins property of the Server class returns a LoginsCollection object containing all login accounts defined on the SQL Server instance. | LoginEvents | Represents the settings required for SQL Server login event notification. The LoginEvents object is obtained using the Events property of the Login object and cannot be created as a standalone object.
The SubscribeToEvents( ) method of the LoginEvents class specifies the events to receive as an ObjectEventSet object. |
11.2.9. Users
The SMO classes
used to manage users are described in Table 11-9.
Table 11-9. SMO classes for managing usersClass | Description |
---|
User | Represents a SQL Server usera security principal used for controlling access permission within a database. While a login is created at the server level, a user maps to a single SQL Server login in the database in which the user is defined. | UserCollection | Represents a collection of User objects. The Users property of the Database class returns a UserCollection object containing all users defined for the database. | UserEvents | Represents the settings required for SQL Server user event notification. The UserEvents object is obtained using the Events property of the User object and cannot be created as a standalone object.
The SubscribeToEvents( ) method of the UserEvents class specifies the events to receive as an ObjectEventSet object. | UserOptions | Represents a set of configurable server options relating to users. The UserOptions object is obtained using the UserOptions property of the Server object and cannot be created as a standalone object. |
11.2.10. Server Roles
The SMO classes used to manage server roles
are described in Table 11-10.
Table 11-10. SMO classes for managing server rolesClass | Description |
---|
ServerRole | Represents a server security role. | ServerRoleCollection | Represents a collection of server roles as ServerRole objects. The Roles property of the Server class returns the collection of roles defined on the SQL Server instance. |
11.2.11. Database Roles
The SMO classes used to manage database roles are described in Table 11-11.
Table 11-11. SMO classes for managing database rolesClass | Description |
---|
DatabaseRole | Represents a SQL Server database security role. | DatabaseRoleCollection | Represents a collection of DatabaseRole objects. The Roles property of the Database class returns a DatabaseRoleCollection object containing all roles defined for the database. |
11.2.12. Server Permissions
The SMO classes
used to manage server permissions are described in Table 11-12.
Table 11-12. SMO classes for managing server permissionsClass | Description |
---|
ServerPermission | Represents a server permission. A ServerPermissionSet object containing a set of ServerPermission objects is used to specify permissions for the Grant( ), Deny( ), and Revoke( ) methods of the Server object. | ServerPermissionInfo | Represents information about a server-level permission for a database server. The EnumServerPermissions( ) method of the Server class returns permission information as an array of ServerPermissionInfo objects. | ServerPermissionSet | Represents a set of server permissions. The ServerPermissionSet class is used to specify multiple permissions for the Grant( ), Deny( ), and Revoke( ) methods of the Server object. |
11.2.13. Database Permissions
The SMO classes used to manage database permissions are described in Table 11-13.
Table 11-13. SMO classes for managing database permissionsClass | Description |
---|
DatabasePermission | Represents a SQL Server database permission. A DatabasePermissionSet object containing a set of DatabasePermission objects is used to specify permissions for the Grant( ), Deny( ), and Revoke( ) methods of the Database object. | DatabasePermissionInfo | Represents information about a server-level permission for a database server. The EnumDatabasePermissions( ) method of the Database class returns permission information as an array of DatabasePermissionInfo objects. | DatabasePermissionSet | Represents a set of database permissions. The DatabasePermissionSet class is used to specify multiple permissions for the Grant( ), Deny( ), and Revoke( ) methods of the Database object. |
11.2.14. Application Roles
The SMO classes used to manage application roles
are described in Table 11-14.
Table 11-14. SMO classes for managing application rolesClass | Description |
---|
ApplicationRole | Represents an application security role used to set privileges from an application. | ApplicationRoleCollection | Represents a collection of application roles as ApplicationRole objects. The ApplicationRoles property of the Database class returns the collection of roles defined on the database. | ApplicationRoleEvents | Represents the settings required for SQL Server application role event notification. The ApplicationRoleEvents object is obtained using the Events property of the ApplicationRole object and cannot be created as a standalone object.
The SubscribeToEvents( ) method of the ApplicationRoleEvents class specifies the events to receive as an ObjectEventSet object. |
11.2.15. .NET Framework Assemblies
SQL Server 2005, through CLR integration, lets you create database objects such as functions, stored procedures, triggers, user-defined data types, and user-defined aggregate functions from .NET Framework
assemblies
. The SMO classes
used to manage .NET Framework assemblies are described in Table 11-15.
Table 11-15. SMO classes for managing .NET Framework assembliesClass | Description |
---|
SqlAssembly | Represents a .NET Framework assembly. | SqlAssemblyCollection | Represents a collection of .NET Framework assemblies as SqlAssembly objects. The Assemblies property of the Database class returns a SqlAssemblyCollection object containing all .NET Framework assemblies defined on the database. | SqlAssemblyEvent | Represents an assembly event. The SqlAssemblyEvent class contains a property for each event that the database can respond to. | SqlAssemblyEvents | Represents the settings required for SQL Server assembly event notification. The SqlAssemblyEvents object is obtained using the Events property of the SqlAssembly object and cannot be created as a standalone object.
The SubscribeToEvents( ) method of the SqlAssemblyEvents class specifies the events to receive as an SqlAssemblyEventSet object. | SqlAssemblyEventSet | Represents a set of SQL Server database events and is used to specify the set of events for the DatabaseEvent class. | SqlAssemblyFile | Represents the binary file that stores a .NET Framework assembly. | SqlAssemblyFileCollection | Represents a collection of .NET Framework assembly files as SqlAssemblyFile objects. The SqlAssemblyFiles property of the SqlAssembly class returns a SqlAssemblyFileCollection object containing all files associated with the .NET Framework assemblies. |
11.2.16. Endpoints
An endpoint is a service that can listen natively for requests. An endpoint can expose methods to calling clients. Endpoints can use either an HTTP or TCP protocol, and handle SOAP, Service Broker, T-SQL, or database mirroring payloads. The SMO classes used to manage endpoints are described in Table 11-16.
Table 11-16. SMO classes for managing endpointsClass | Description |
---|
DatabaseMirroringPayload | Represents a SQL Server database mirroring payload. The DatabaseMirroring property of the Payload class returns a DatabaseMirroringPayload object representing the database mirroring payload for the endpoint. | Endpoint | Represents a SQL Server endpoint service. | EndpointCollection | Represents a collection of endpoints as Endpoint objects. The Endpoints property of the Server class returns the collection of endpoints defined on the SQL Server instance. | EndpointProtocol | Represents an endpoint protocol. The Protocol property of the Endpoint class returns a Protocol object representing the protocol for the endpoint. | HttpProtocol | Represents an HTTP protocol. The Http property of the Protocol class returns an HttpProtocol object representing the HTTP protocol. | Payload | Represents an HTTP endpoint payload. The Payload property of the Endpoint class returns a Payload object representing the payload for the endpoint. | Protocol | Represents a protocol used by an endpoint. | ServiceBrokerPayload | Represents a SQL Server Service Broker payload. The ServiceBroker property of the Payload class returns a ServiceBrokerPayload object representing the Service Broker payload for the endpoint. | SoapPayload | Represents a SQL Server SOAP payload. The Soap property of the Payload class returns a SoapPayload object representing the SOAP payload for the endpoint. | SoapPayloadMethod | Represents a SOAP payload method. | SoapPayloadMethodCollection | Represents a collection of SOAP payload methods as SoapPayloadMethod objects. The SoapPayloadMethods property of the SoapPayload class returns the collection of SOAP payload methods defined for the SOAP payload. | TcpProtocol | Represents a TCP protocol. The Tcp property of the Protocol class returns a TcpProtocol object representing the TCP protocol. |
11.2.17. XML Schemas
XML schemas are used to validate XML documents and data type instances and to define complex XML data types. The SMO classes
used to manage XML schemas are described in Table 11-17.
Table 11-17. SMO classes for managing XML schemasClass | Description |
---|
XmlSchemaCollection | Represents a collection of XML namespaces. | XmlSchemaCollectionCollection | Represents a collection of XML namespaces as XmlSchemaCollection objects. The XmlSchemaCollections property of the Database class returns the collection of XML namespaces defined on the database. |
11.2.18. Languages
The SMO classes used to manage supported languages are described in Table 11-18.
Table 11-18. SMO classes for managing supported languagesClass | Description |
---|
Language | Represents a SQL Server language. | LanguageCollection | Represents a collection of SQL Server languages as Language objects. The Languages property of the Server class returns the collection of languages supported by the SQL Server instance. |
11.2.19. Statistics
Statistics contain information about the distribution of values in a column. This information is used to calculate optimal query plans. The SMO classes used to manage SQL Server statistics are described in Table 11-19.
Table 11-19. SMO classes for managing statisticsClass | Description |
---|
Statistic | Represents a SQL Server statistics counter. | StatisticCollection | Represents a collection of SQL Server statistic counters as Statistic objects. The Statistics property of the Table class returns a StatisticCollection object containing all statistics counters defined for the table. | StatisticColumn | Represents a column defined in a SQL Server statistics counter. | StatisticColumnCollection | Represents a collection of columns defined in a SQL Server statistics counter as StatisticColumn objects. The StatisticColumns property of the Statistic class returns a StatisticColumnCollection object containing all statistic columns defined in the statistics counter. | StatisticEvents | Represents the setting required for SQL Server statistic-event notification. The StatisticEvents object is obtained using the Events property of the Statistic object and cannot be created as a standalone object.
The SubscribeToEvents( ) method of the StatisticEvents class specifies the events to receive as an ObjectEventSet object. |
11.2.20. Certificates
A certificate is a digitally signed statement that binds the value of a public key to a person, service, or device that holds the corresponding private key. The SMO classes used to manage certificates are described in Table 11-20.
Table 11-20. SMO classes for managing certificatesClass | Description |
---|
Certificate | Represents a SQL Server certificate. | CertificateCollection | Represents a collection of SQL Server certificates as Certificate objects. The Certificates property of the Database class returns the collection of certificates defined on a database. | CertificateEvents | Represents the settings required for SQL Server certificate event notification. The CertificateEvents object is obtained using the Events property of the Certificate object and cannot be created as a standalone object.
The SubscribeToEvents( ) method of the CertificateEvents class specifies the events to receive as an ObjectEventSet object. |
11.2.21. Credentials
A credential contains authentication information needed to connect to a secured resource outside of SQL Server. A credential can be associated with multiple SQL Server logins, but a login can only be mapped to one credential. The SMO classes
used to manage credentials are described in Table 11-21.
Table 11-21. SMO classes for managing credentialsClass | Description |
---|
Credential | Represents a SQL Server credential. | CredentialCollection | Represents a collection of SQL Server credentials as Credential objects. The Credentials property of the Server class returns the collection of credentials defined on the SQL Server instance. |
11.2.22. Keys
The SMO classes used to manage asymmetric and symmetric keys are described in Table 11-22.
Table 11-22. SMO classes for managing keysClass | Description |
---|
AsymmetricKey | Represents a SQL Server asymmetric key. | AsymmetricKeyCollection | Represents a collection of asymmetric keys as AsymmetricKey objects. The AsymmetricKeys property of the Database class returns the collection of asymmetric keys defined on the database. | SymmetricKey | Represents a SQL Server symmetric key. | SymmetricKeyCollection | Represents a collection of symmetric keys as SymmetricKey objects. The SymmetricKeys property of the Database class returns the collection of symmetric keys defined on the database. | SymmetricKeyEncryption | Represents the type of encryption (asymmetric, certificate, password, or symmetric) used when encrypting a symmetric key object.
The AddKeyEncryption( ) method of the SymmetricKey Class adds a type of encryption to the symmetric key. |
11.2.23. Synonyms
A synonym is a database object that provides an alternate name for a database object either on the local server or on a remote server. The SMO classes
used to manage SQL Server synonyms are described in Table 11-23.
Table 11-23. SMO classes for managing synonymsClass | Description |
---|
Synonym | Represents a SQL Server synonym. | SynonymCollection | Represents a collection of SQL Server synonyms as Synonym objects. The Synonyms property of the Database class returns a SynonymCollection object containing synonyms defined on the database. | SynonymEvents | Represents settings required for SQL Server synonym event notification. |
11.2.24. System Messages
The SMO classes used to manage system messages are described in Table 11-24.
Table 11-24. SMO classes for managing system messagesClass | Description |
---|
SystemMessage | Represents a system message defined on a SQL Server instance. | SystemMessageCollection | Represents a collection of SQL Server system messages as SystemMessage objects. The SystemMessages property of the Server class returns a SystemMessageCollection object containing all system messages defined on the SQL server instance. |
11.2.25. User-Defined Messages
The SMO classes used to manage user-defined error and warning messages are described in Table 11-25.
Table 11-25. SMO classes for managing user-defined messagesClass | Description |
---|
UserDefinedMessage | Represents a user-defined message on a SQL Server instance. | UserDefinedMessageCollection | Represents a collection of SQL Server user-defined messages as UserDefinedMessage objects. The UserDefinedMessages property of the Server class returns a UserDefinedMessageCollection object containing all user-defined messages defined on the SQL server instance. |
11.2.26. Full-Text Search
Full-Text Search lets you perform linguistic searches against the words and phrases in your data. The SMO classes
used to manage Full-Text Search catalogs and indexes are described in Table 11-26.
Table 11-26. SMO classes for managing Full-Text SearchClass | Description |
---|
FullTextCatalog | Represents a full-text catalog letting you programmatically create, manage, and configure the catalog. | FullTextCatalogCollection | Represents a collection of full-text catalogs as FullTextCatalog objects. The FullTextCatalogs property of the Database class returns a FullTextCatalogCollection object containing all full-text catalogs defined on the database. | FullTextIndex | Represents a full-text index letting you programmatically create, manage, and configure the index.
The FullTextIndex property of the Table or View class returns the full-text index on the table or view. | FullTextIndexColumn | Represents a column in a full-text index letting you programmatically create, manage, and configure the column. | FullTextIndexColumnCollection | Represents a collection of full-text index columns as FullTextIndexColumn objects. The IndexedColumns property of the FullTextIndex class returns a FullTextIndexColumnCollection object containing all columns defined on the full-text index. | FullTextService | Provides programmatic access to the Full-Text Search settings. The FullText property of the Server class returns the full-text service implementation for the SQL Service instance. |
11.2.27. OLE DB Providers
The SMO classes used to manage SQL Server OLE DB providers
are described in Table 11-27.
Table 11-27. SMO classes for managing OLE DB ProvidersClass | Description |
---|
OleDbProviderSettings | Represents the settings for a SQL Server OLE DB provider. | OleDbProviderSettingsCollection | Represents a collection of OleDbProviderSettings objects. The OleDbProviderSettings property of the Settings class returns the collection of OLE provider settings defined on the SQL Server instance. The Settings property of the Server class returns a Settings object representing a set of configurable settings on the SQL Server instance. |
|