TechNet
Export (0) Print
Expand All

Database Class

 

Represents an SQL Server database.

Namespace:   Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)


[EvaluationModeAttribute(AutomatedPolicyEvaluationMode::CheckOnSchedule)]
[PhysicalFacetAttribute]
public ref class Database sealed : ScriptNameObjectBase, ISfcSupportsDesignMode, 
	ICreatable, IAlterable, IDroppable, IDropIfExists, IRenamable, 
	IExtendedProperties, IScriptable, IDatabaseOptions, IDmfFacet

NameDescription
System_CAPS_pubmethodDatabase()

Initializes a new instance of the Database class.

System_CAPS_pubmethodDatabase(Server^, String^)

Initializes a new instance of the Database class on the specified server and with the specified name.

NameDescription
System_CAPS_pubpropertyActiveConnections

Gets the number of active connections to the database.

System_CAPS_pubpropertyActiveDirectory

Obsolete.Gets the information about the Active Directory settings for the database.

System_CAPS_pubpropertyAnsiNullDefault

Gets or sets a value that specifies whether the ANSI_NULL_DEFAULT database option is active.

System_CAPS_pubpropertyAnsiNullsEnabled

Gets or sets a value that specifies whether the ANSI_NULLS_ENABLED database option is active.

System_CAPS_pubpropertyAnsiPaddingEnabled

Gets or sets a value that specifies whether the ANSI_PADDING_ENABLED database option is active.

System_CAPS_pubpropertyAnsiWarningsEnabled

Gets or sets a value that specifies whether the ANSI_WARNINGS_ENABLED database option is active.

System_CAPS_pubpropertyApplicationRoles

Gets a collection of ApplicationRole objects. Each ApplicationRole object represents an application role defined on the database.

System_CAPS_pubpropertyArithmeticAbortEnabled

Gets or sets a value that specifies whether the ARITHMETICABORT database option is active.

System_CAPS_pubpropertyAssemblies

Gets a collection of SqlAssembly objects. Each SqlAssembly object represents an assembly defined on the database.

System_CAPS_pubpropertyAsymmetricKeys

Gets a collection of AsymmetricKey objects. Each AsymmetricKey object represents an asymmetric key defined on the database.

System_CAPS_pubpropertyAutoClose

Gets or sets a value that specifies whether the AUTOCLOSE database option is set.

System_CAPS_pubpropertyAutoCreateIncrementalStatisticsEnabled

Gets a value that specifies whether the incremental statistics are automatically created for the database.

System_CAPS_pubpropertyAutoCreateStatisticsEnabled

Gets a value that specifies whether statistics are automatically created for the database.

System_CAPS_pubpropertyAutoShrink

Gets or sets a value that specifies whether the AUTO_SHRINK database option is active.

System_CAPS_pubpropertyAutoUpdateStatisticsAsync

Gets or sets a value that specifies whether the AUTOUPDATESTATISTICSASYNC database option is active.

System_CAPS_pubpropertyAutoUpdateStatisticsEnabled

Gets or sets a value that specifies whether statistics are automatically updated for the database.

System_CAPS_pubpropertyAvailabilityDatabaseSynchronizationState

Gets the synchronization state of the availability database.

System_CAPS_pubpropertyAvailabilityGroupName

Gets the availability group name in the database.

System_CAPS_pubpropertyAzureEdition

System_CAPS_pubpropertyAzureServiceObjective

System_CAPS_pubpropertyBrokerEnabled

Gets or sets a value that specifies whether the Service Broker service is enabled.

System_CAPS_pubpropertyCaseSensitive

Gets a value that specifies whether uppercase letters and lowercase letters are evaluated as equal.

System_CAPS_pubpropertyCertificates

Gets a collection of Certificate objects. Each Certificate object represents a certificate defined on the database.

System_CAPS_pubpropertyChangeTrackingAutoCleanUp

Gets or sets a value that specifies whether the CHANGE_TRACKING_AUTO_CLEANUP OPTION is enabled.

System_CAPS_pubpropertyChangeTrackingEnabled

Gets or sets a value that specifies whether the CHANGE_TRACKING_VALUE option is enabled.

System_CAPS_pubpropertyChangeTrackingRetentionPeriod

Gets or sets the CHANGE_TRACKING_RETENTION_PERIOD value.

System_CAPS_pubpropertyChangeTrackingRetentionPeriodUnits

Gets or sets the unit type for a retention period value.

System_CAPS_pubpropertyCloseCursorsOnCommitEnabled

Gets or sets a value that specifies whether the CURSOR_CLOSE_ON_COMMIT database option is active.

System_CAPS_pubpropertyCollation

Gets or sets the default collation used by the database.

System_CAPS_pubpropertyColumnEncryptionKeys

System_CAPS_pubpropertyColumnMasterKeys

System_CAPS_pubpropertyCompatibilityLevel

Gets or sets the compatibility level for the database.

System_CAPS_pubpropertyConcatenateNullYieldsNull

Gets or sets a value that specifies whether the CONCAT_NULL_YIELDS_NULL database option is active.

System_CAPS_pubpropertyContainmentType

Gets or sets the type of containment.

System_CAPS_pubpropertyCreateDate

Gets the date that the database was created.

System_CAPS_pubpropertyDatabaseAuditSpecifications

Gets a collection of DatabaseAuditSpecification objects. Each DatabaseAuditSpecification object represents a database audit specification defined on the server.

System_CAPS_pubpropertyDatabaseEncryptionKey

Gets a DataBaseEncryptionKey data type.

System_CAPS_pubpropertyDatabaseGuid

Gets the Guid value that uniquely identifies the database.

System_CAPS_pubpropertyDatabaseOptions

Gets the DatabaseOptions object that contains configuration options for the database.

System_CAPS_pubpropertyDatabaseOwnershipChaining

Gets or sets a value that specifies whether the database ownership chaining is active.

System_CAPS_pubpropertyDatabaseScopedCredentials

System_CAPS_pubpropertyDatabaseSnapshotBaseName

Gets the name of the snapshot base for the database.

System_CAPS_pubpropertyDataSpaceUsage

Gets the space used by the data in the database.

System_CAPS_pubpropertyDateCorrelationOptimization

Gets or sets a value that specifies whether the date correlation optimization is active.

System_CAPS_pubpropertyDboLogin

Gets a value that specifies whether the current user is logged on as the database owner (DBO).

System_CAPS_pubpropertyDefaultFileGroup

Gets the default file group used by the database.

System_CAPS_pubpropertyDefaultFileStreamFileGroup

Gets the file group name for the default file stream.

System_CAPS_pubpropertyDefaultFullTextCatalog

Gets the default full-text catalog used by the database.

System_CAPS_pubpropertyDefaultFullTextLanguage

Gets the default full text language.

System_CAPS_pubpropertyDefaultLanguage

Gets or sets the default language.

System_CAPS_pubpropertyDefaults

Gets a collection of Default objects. Each Default object represents a default defined on the database.

System_CAPS_pubpropertyDefaultSchema

Gets the default schema of the user.

System_CAPS_pubpropertyDelayedDurability

Gets or sets the delayed durability setting of a database.

System_CAPS_pubpropertyEncryptionEnabled

Gets or sets a value that indicates whether the data encryption is enabled.

System_CAPS_pubpropertyEvents

Gets the events associated with the database.

System_CAPS_pubpropertyExecutionManager
System_CAPS_pubpropertyExtendedProperties

Gets the extended properties of the database.

System_CAPS_pubpropertyExtendedStoredProcedures

Gets a collection of ExtendedStoredProcedure objects. Each ExtendedStoredProcedure object represents an extended stored procedure defined on the database.

System_CAPS_pubpropertyExternalDataSources

System_CAPS_pubpropertyExternalFileFormats

System_CAPS_pubpropertyFederations

Gets a collection of Federation objects. Each Federation represents a data being partitioned on the database.

System_CAPS_pubpropertyFileGroups

Gets a collection of FileGroup objects. Each FileGroup object represents a file group defined on the database.

System_CAPS_pubpropertyFilestreamDirectoryName

Gets or sets the name of file stream share directory.

System_CAPS_pubpropertyFilestreamNonTransactedAccess

Gets or sets the file stream non-transacted access setting for database.

System_CAPS_pubpropertyFullTextCatalogs

Gets a collection of FullTextCatalog objects. Each FullTextCatalog object represents a full-text catalog defined on the database.

System_CAPS_pubpropertyFullTextStopLists

Gets a collection of FullTextStopList objects. Each FullTextStopList object represents a full text stop list defined on the server.

System_CAPS_pubpropertyHasFileInCloud

Gets a value that indicates whether the database has file in Cloud database.

System_CAPS_pubpropertyHasMemoryOptimizedObjects

Gets the Boolean value that specifies whether the database contains memory optimized objects.

System_CAPS_pubpropertyHonorBrokerPriority

Gets or sets a value that specifies whether the priority specified by the broker is acknowledged or not.

System_CAPS_pubpropertyID

Gets the database ID value that uniquely identifies the database.

System_CAPS_pubpropertyIndexSpaceUsage

Gets the space used by the indexes in the database.

System_CAPS_pubpropertyIsAccessible

Gets a value that specifies whether the database can be accessed.

System_CAPS_pubpropertyIsDatabaseSnapshot

Gets a value that specifies whether the database is a snapshot database.

System_CAPS_pubpropertyIsDatabaseSnapshotBase

Gets a value that specifies whether the database is the base database for a snapshot database.

System_CAPS_pubpropertyIsDbAccessAdmin

Gets a value that specifies whether the current user is a member of the DbAccessAdmin database role.

System_CAPS_pubpropertyIsDbBackupOperator

Gets a value that specifies whether the current user is a member of the DbBackupOperator database role.

System_CAPS_pubpropertyIsDbDatareader

Gets a value that specifies whether the current user is a member of the DbDatareader database role.

System_CAPS_pubpropertyIsDbDatawriter

Gets a value that specifies whether the current user is a member of the DbDatawriter database role.

System_CAPS_pubpropertyIsDbDdlAdmin

Gets a value that specifies whether the current user is a member of the DbDdlAdmin database role.

System_CAPS_pubpropertyIsDbDenyDatareader

Gets a value that specifies whether the current user is a member of the DbDenyDatareader database role.

System_CAPS_pubpropertyIsDbDenyDatawriter

Gets a value that specifies whether the current member is a member of the DbDenyDatawriter database.

System_CAPS_pubpropertyIsDbManager

Gets a value that specifies whether the current login is a database manager in SQL Database.

System_CAPS_pubpropertyIsDbOwner

Gets a value that specifies whether the current user is a member of the DbOwner database role.

System_CAPS_pubpropertyIsDbSecurityAdmin

Gets a value that specifies whether the current user is a member of the DbSecurityAdmin database role.

System_CAPS_pubpropertyIsFederationMember

Gets or sets a value that specifies whether the database is a member of federation.

System_CAPS_pubpropertyIsFullTextEnabled

Gets or sets a value that specifies whether the database is enabled for full-text search.

System_CAPS_pubpropertyIsLoginManager

Gets a value that specifies whether the current login is a login manager in SQL Database.

System_CAPS_pubpropertyIsMailHost

Gets a value that specifies whether the database is configured as a mail host.

System_CAPS_pubpropertyIsManagementDataWarehouse

Gets a value that specifies whether the database is a management data warehouse.

System_CAPS_pubpropertyIsMirroringEnabled

Gets a value that specifies whether mirroring is enabled on the database.

System_CAPS_pubpropertyIsParameterizationForced

Gets or sets a value that specifies whether parameterization is forced on the database.

System_CAPS_pubpropertyIsReadCommittedSnapshotOn

Gets or sets a value that specifies whether transactions with the read committed isolation level use row versioning.

System_CAPS_pubpropertyIsSystemObject

Gets a value that specifies whether the database is a system object or a user-defined database.

System_CAPS_pubpropertyIsUpdateable

Gets a value that specifies whether the database can be updated.

System_CAPS_pubpropertyIsVarDecimalStorageFormatEnabled

Gets or sets a value that specifies whether VarDecimal storage is enabled.

System_CAPS_pubpropertyLastBackupDate

Gets the date and time when the database was last backed up.

System_CAPS_pubpropertyLastDifferentialBackupDate

Gets the date and time when the last differential backup was performed.

System_CAPS_pubpropertyLastLogBackupDate

Gets the date and time when the transaction log was last backed up.

System_CAPS_pubpropertyLocalCursorsDefault

Gets or sets a value that specifies whether the local server cursors are used by default.

System_CAPS_pubpropertyLogFiles

Gets a collection of LogFile objects. Each LogFile object represents a log file defined on the database.

System_CAPS_pubpropertyLogReuseWaitStatus

Gets the type of operation on which the reuse of transaction log space is waiting.

System_CAPS_pubpropertyMasterKey

Gets the master key that is used to encrypt the private keys of certificates.

System_CAPS_pubpropertyMemoryAllocatedToMemoryOptimizedObjectsInKB

Gets the memory (in kilobytes) allocated to memory-optimized objects in the database.

System_CAPS_pubpropertyMemoryUsedByMemoryOptimizedObjectsInKB

Gets the memory used (in kilobytes) by memory-optimized objects in the database.

System_CAPS_pubpropertyMirroringFailoverLogSequenceNumber

Gets the log sequence number at last failover.

System_CAPS_pubpropertyMirroringID

Gets the ID value that uniquely identifies the mirroring partnership.

System_CAPS_pubpropertyMirroringPartner

Gets or sets the address of the Database Engine instance that is the partner server for database mirroring.

System_CAPS_pubpropertyMirroringPartnerInstance

Gets the instance of SQL Server on which the mirroring partner is configured.

System_CAPS_pubpropertyMirroringRedoQueueMaxSize

Gets the maximum size of the redo queue of the mirror server instance in KB.

System_CAPS_pubpropertyMirroringRoleSequence

Gets the role sequence number for primary/backup roles played by the mirroring partners.

System_CAPS_pubpropertyMirroringSafetyLevel

Gets or sets the mirroring safety level.

System_CAPS_pubpropertyMirroringSafetySequence

Gets the role sequence number for safety levels for the mirroring partners.

System_CAPS_pubpropertyMirroringStatus

Gets the status of the database and the database mirroring session.

System_CAPS_pubpropertyMirroringTimeout

Gets or sets the maximum time, in seconds, that the principal server instance waits for a PING message from another instance in the mirroring session before assuming the other instance is disconnected.

System_CAPS_pubpropertyMirroringWitness

Gets or sets the name of the Database Engine instance of the database mirroring witness server.

System_CAPS_pubpropertyMirroringWitnessStatus

Gets the status of the mirroring witness server.

System_CAPS_pubpropertyName

Gets or sets the name of the database.(Overrides NamedSmoObject::Name.)

System_CAPS_pubpropertyNestedTriggersEnabled

Gets or sets a value that indicates whether the nested triggers are enabled.

System_CAPS_pubpropertyNumericRoundAbortEnabled

Gets or sets a value that specifies whether the NUMERIC_ROUNDABORT database option is active.

System_CAPS_pubpropertyOwner

Gets the database principal that is the owner of the database.

System_CAPS_pubpropertyPageVerify

Gets or sets the type of page integrity check that SQL Server performs when reading database pages.

System_CAPS_pubpropertyParent

Gets or sets the Server object that is the parent of the Database object.

System_CAPS_pubpropertyPartitionFunctions

Gets a collection of PartitionFunction objects. Each PartitionFunction object represents a partition function defined on the database.

System_CAPS_pubpropertyPartitionSchemes

Gets a collection of PartitionScheme objects. Each PartitionScheme object represents a partition scheme defined on the database.

System_CAPS_pubpropertyPlanGuides

Gets a collection of plan guides associated with a database.

System_CAPS_pubpropertyPrimaryFilePath

Gets the operating system directory that contains the primary file for the database.

System_CAPS_pubpropertyProperties

Gets a collection of Property objects that represent the object properties.(Inherited from SqlSmoObject.)

System_CAPS_pubpropertyQueryStoreOptions

System_CAPS_pubpropertyQuotedIdentifiersEnabled

Gets or sets a value that specifies whether identifiers delimited by double quotation marks (" ") are Transact-SQL reserved keywords or contain characters not usually allowed by the Transact-SQL syntax rules.

System_CAPS_pubpropertyReadOnly

Gets or sets a value that specifies whether the database is read-only.

System_CAPS_pubpropertyRecoveryForkGuid

Gets the GUID value that specifies the recovery fork on which the database is currently active.

System_CAPS_pubpropertyRecoveryModel

Gets or sets the recovery model for the database.

System_CAPS_pubpropertyRecursiveTriggersEnabled

Gets or sets a value that specifies whether recursive triggers are enabled on the database.

System_CAPS_pubpropertyRemoteDataArchiveCredential

System_CAPS_pubpropertyRemoteDataArchiveEnabled

System_CAPS_pubpropertyRemoteDataArchiveEndpoint

System_CAPS_pubpropertyRemoteDataArchiveLinkedServer

System_CAPS_pubpropertyRemoteDataArchiveUseFederatedServiceAccount

System_CAPS_pubpropertyRemoteDatabaseName

System_CAPS_pubpropertyReplicationOptions

Gets the active replication settings for a database.

System_CAPS_pubpropertyRoles

Gets a collection of DatabaseRole objects. Each DatabaseRole object represents a role defined on the database.

System_CAPS_pubpropertyRules

Gets a collection of Rule objects. Each Rule object represents a rule defined on the database.

System_CAPS_pubpropertySchemas

Gets a collection of Schema objects. Each Schema object represents a schema defined on the database.

System_CAPS_pubpropertySearchPropertyLists

Gets the SearchPropertyListCollection associated with this object.

System_CAPS_pubpropertySecurityPolicies

System_CAPS_pubpropertySequences

Gets the SequenceCollection associated with this object.

System_CAPS_pubpropertyServiceBroker

Gets the ServiceBroker object that represents the Service Broker.

System_CAPS_pubpropertyServiceBrokerGuid

Gets the Guid object that uniquely identifies the instance of Service Broker.

System_CAPS_pubpropertySize

Gets the size of the database in MB.

System_CAPS_pubpropertySnapshotIsolationState

Gets the snapshot isolation state for the database.

System_CAPS_pubpropertySpaceAvailable

Gets the available space in the database in KB.

System_CAPS_pubpropertyState

Gets the state of the referenced object.(Inherited from SmoObjectBase.)

System_CAPS_pubpropertyStatus

Gets the database status.

System_CAPS_pubpropertyStoredProcedures

Gets a collection of StoredProcedure objects. Each StoredProcedure object represents a stored procedure defined on the database.

System_CAPS_pubpropertySymmetricKeys

Gets a collection of SymmetricKey objects. Each SymmetricKey object represents a symmetric key defined on the database.

System_CAPS_pubpropertySynonyms

Gets a collection of Synonym objects. Each Synonym object represents a synonym defined on the database.

System_CAPS_pubpropertyTables

Gets a collection of Table objects. Each Table object represents a table defined on the database.

System_CAPS_pubpropertyTargetRecoveryTime

Gets or sets the target recovery time of the used database.

System_CAPS_pubpropertyTransformNoiseWords

Gets a value that indicates whether an object that sets the transform noise words configuration option is used.

System_CAPS_pubpropertyTriggers

Gets a collection of DatabaseDdlTrigger objects. Each DatabaseDdlTrigger object represents a trigger defined on the database.

System_CAPS_pubpropertyTrustworthy

Gets or sets a value that indicates whether the instance of SQL Server 2005 trusts the database and the contents within it.

System_CAPS_pubpropertyTwoDigitYearCutoff

Gets or sets the specified object that is used to set the two digit year cutoff configuration option.

System_CAPS_pubpropertyUrn

Gets the Uniform Resource Name (URN) address value that uniquely identifies the object.(Inherited from SqlSmoObject.)

System_CAPS_pubpropertyUserAccess

Gets or sets the database user access.

System_CAPS_pubpropertyUserData

Gets or sets user-defined data associated with the referenced object.(Inherited from SmoObjectBase.)

System_CAPS_pubpropertyUserDefinedAggregates

Gets a collection of UserDefinedAggregate objects. Each UserDefinedAggregate object represents a user-defined aggregate defined on the database.

System_CAPS_pubpropertyUserDefinedDataTypes

Gets a collection of UserDefinedDataType objects. Each UserDefinedDataType object represents a user-defined data type on the database.

System_CAPS_pubpropertyUserDefinedFunctions

Gets a collection of UserDefinedFunction objects. Each UserDefinedFunction object represents a user-defined function on the database.

System_CAPS_pubpropertyUserDefinedTableTypes

Gets a collection of UserDefinedTableType objects. Each UserDefinedTableType object represents a user-defined table type on the database.

System_CAPS_pubpropertyUserDefinedTypes

Gets a collection of UserDefinedType objects. Each UserDefinedType object represents a user-defined type on the database.

System_CAPS_pubpropertyUserName

Gets the database user name.

System_CAPS_pubpropertyUsers

Gets a collection of User objects. Each User object represents a user who is defined on the database.

System_CAPS_pubpropertyVersion

Gets the version of the instance of SQL Server that was used to create the database.

System_CAPS_pubpropertyViews

Gets a collection of View objects. Each View object represents a view defined on the database.

System_CAPS_pubpropertyXmlSchemaCollections

Gets a collection of XmlSchemaCollection objects. Each XmlSchemaCollection object represents an XML schema defined on the database.

NameDescription
System_CAPS_pubmethodAlter()

Updates any Database object property changes on the instance of SQL Server. 

System_CAPS_pubmethodAlter(TerminationClause)

Updates any Database object property changes on the instance of SQL Server. 

System_CAPS_pubmethodAlter(TimeSpan)

Updates any Database object property changes on the instance of SQL Server. 

System_CAPS_pubmethodChangeMirroringState(MirroringOption)

Changes the mirroring configuration as specified by the options.

System_CAPS_pubmethodCheckAllocations(RepairType)

Scans all pages of the referenced database and tests pages to help ensure integrity.

System_CAPS_pubmethodCheckAllocationsDataOnly()

Scans all pages of the referenced database and tests only the data to help ensure integrity.

System_CAPS_pubmethodCheckCatalog()

Tests the integrity of the database catalog.

System_CAPS_pubmethodCheckIdentityValues()

Verifies the integrity of all identity columns in tables in the database.

System_CAPS_pubmethodCheckpoint()

Issues a checkpoint.

System_CAPS_pubmethodCheckTables(RepairType)

Tests the integrity of database pages for all tables and indexes defined on the tables of the database.

System_CAPS_pubmethodCheckTables(RepairType, RepairOptions)

Tests the integrity of database pages for all tables and indexes defined on the tables of the database.

System_CAPS_pubmethodCheckTables(RepairType, RepairOptions, RepairStructure, Nullable<Int64>)

System_CAPS_pubmethodCheckTables(RepairType, RepairStructure)

Tests the integrity of database pages for all tables and indexes defined on the tables of the database.

System_CAPS_pubmethodCheckTablesDataOnly()

Tests integrity of data in pages that store data for all tables and indexes defined on the tables of the referenced database.

System_CAPS_pubmethodCheckTablesDataOnly(RepairOptions)

Tests integrity of data in pages that store data for all tables and indexes defined on the tables of the referenced database, with the specified repair options.

System_CAPS_pubmethodCheckTablesDataOnly(RepairOptions, RepairStructure, Nullable<Int64>)

System_CAPS_pubmethodCheckTablesDataOnly(RepairStructure)

Tests integrity of data in pages that store data for all tables and indexes defined on the tables of the referenced database with the specified repair structure.

System_CAPS_pubmethodCreate()

Creates a database on the instance of SQL Server as defined by the Database object.

System_CAPS_pubmethodCreate(Boolean)

Creates a database on the instance of SQL Server as defined by the Database object.

System_CAPS_pubmethodDeny(DatabasePermissionSet^, String^)

Denies the specified set of permissions for the specified grantee on the database.

System_CAPS_pubmethodDeny(DatabasePermissionSet^, String^, Boolean)

Denies the specified set of permissions for the specified grantee and other users who the grantee granted the specified set of permissions on the database.

System_CAPS_pubmethodDeny(DatabasePermissionSet^, array<String^>^)

Denies the specified set of permissions for the specified grantees on the database.

System_CAPS_pubmethodDeny(DatabasePermissionSet^, array<String^>^, Boolean)

Denies the specified set of permissions for the specified grantees and other users who the grantee granted the specified set of permissions on the database.

System_CAPS_pubmethodDisableAllPlanGuides()

Disables all Plan Guides in a database.

System_CAPS_pubmethodDiscover()

Discovers a list of type Object.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodDrop()

Drops the database.

System_CAPS_pubmethodDropAllPlanGuides()

Drops all Plan Guides in a database.

System_CAPS_pubmethodDropBackupHistory()

Drops the backup history for the database.

System_CAPS_pubmethodDropIfExists()

System_CAPS_pubmethodEnableAllPlanGuides()

Enables all Plan Guides in a database.

System_CAPS_pubmethodEnumBackupSetFiles()

Returns a DataTable listing files contained in a backup set.

System_CAPS_pubmethodEnumBackupSetFiles(Int32)

Returns a Data table that lists the files in a backup set.

System_CAPS_pubmethodEnumBackupSets()

Returns a DataTable listing the backup sets associated with a database.

System_CAPS_pubmethodEnumCandidateKeys()

Enumerates a list of all candidate primary keys in the database, which can be referenced by a foreign key.

System_CAPS_pubmethodEnumDatabasePermissions()

Enumerates a list of all permissions in the database.

System_CAPS_pubmethodEnumDatabasePermissions(DatabasePermissionSet^)

Enumerates a list of permissions in the database for the specified permission set.

System_CAPS_pubmethodEnumDatabasePermissions(String^)

Enumerates a list of permissions in the database for the specified user.

System_CAPS_pubmethodEnumDatabasePermissions(String^, DatabasePermissionSet^)

Enumerates a list of permissions in the database for the specified user and a specified permission set.

System_CAPS_pubmethodEnumLocks()

Enumerates a list of all current locks held on the database.

System_CAPS_pubmethodEnumLocks(Int32)

Enumerates a list of current locks held on the database for a specified system process ID.

System_CAPS_pubmethodEnumLoginMappings()

Enumerates a list of SQL Server logins for all the users in the database.

System_CAPS_pubmethodEnumMatchingSPs(String^)

Enumerates a list of stored procedures that contain the specified string in the definition.

System_CAPS_pubmethodEnumMatchingSPs(String^, Boolean)

Enumerates a list of stored procedures that contain the specified string in the definition.

System_CAPS_pubmethodEnumObjectPermissions()

Enumerates a list of permissions for objects in the database.

System_CAPS_pubmethodEnumObjectPermissions(ObjectPermissionSet^)

Enumerates a list of permissions for objects in the database limited to the specified permission set.

System_CAPS_pubmethodEnumObjectPermissions(String^)

Enumerates a list of permissions for objects in the database that belong to the specified user.

System_CAPS_pubmethodEnumObjectPermissions(String^, ObjectPermissionSet^)

Enumerates a list of permissions for objects in the database that belong to the specified user and limited to the specified permission set.

System_CAPS_pubmethodEnumObjects()

Enumerates a list of objects in the database.

System_CAPS_pubmethodEnumObjects(DatabaseObjectTypes)

Enumerates a list of objects in the database.

System_CAPS_pubmethodEnumObjects(DatabaseObjectTypes, SortOrder)

Enumerates a list of objects in the database.

System_CAPS_pubmethodEnumTransactions()

Enumerates a list of open transactions on the database.

System_CAPS_pubmethodEnumTransactions(TransactionTypes)

Enumerates a list of open transactions of a specified type on the database.

System_CAPS_pubmethodEnumWindowsGroups()

Enumerates a list of Windows groups.

System_CAPS_pubmethodEnumWindowsGroups(String^)

Enumerates a list of Windows groups for a specified group.

System_CAPS_pubmethodEquals(Object^)

(Inherited from Object.)

System_CAPS_pubmethodExecuteNonQuery(String^)

Executes a statement in the context of the database where there are no results returned.

System_CAPS_pubmethodExecuteNonQuery(String^, ExecutionTypes)

Executes a batch in the context of the database where there are no results returned for the specified execution type only.

System_CAPS_pubmethodExecuteNonQuery(StringCollection^)

Executes a batch in the context of the database where there are no results returned.

System_CAPS_pubmethodExecuteNonQuery(StringCollection^, ExecutionTypes)

Runs a collection of batches in the context of the database where there are no results returned for the specified execution type only.

System_CAPS_pubmethodExecuteWithResults(String^)

Executes a collection of batches in the context of the database where there are results returned.

System_CAPS_pubmethodExecuteWithResults(StringCollection^)

Executes a batch in the context of the database where there are results returned.

System_CAPS_protmethodFormatSqlVariant(Object^)

Formats an object as T: Microsoft.Data.Schema.Sql.DataGenerator.SqlVariant type.(Inherited from SqlSmoObject.)

System_CAPS_protmethodGetContextDB()

Gets the context database that is associated with this object.(Inherited from SqlSmoObject.)

System_CAPS_protmethodGetDBName()

Gets the database name that is associated with the object.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_protmethodGetPropValue(String^)

Gets a property value of the SqlSmoObject object.(Inherited from SqlSmoObject.)

System_CAPS_protmethodGetPropValueOptional(String^)

Gets a property value of the SqlSmoObject object.(Inherited from SqlSmoObject.)

System_CAPS_protmethodGetPropValueOptionalAllowNull(String^)

Gets a property value of the SqlSmoObject object.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodGetRemoteDataArchiveMigrationStatusReports(DateTime, Int32, String^)

System_CAPS_pubmethodGetRemoteDatabaseMigrationStatistics()

System_CAPS_protmethodGetServerObject()

Gets the server of the SqlSmoObject object.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodGetTransactionCount()

Gets the number of open transactions on the database.

System_CAPS_pubmethodGetTransactionCount(TransactionTypes)

Gets the number of open transactions of a specified type on the database.

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodGrant(DatabasePermissionSet^, String^)

Grants the specified set of permissions to the specified grantee on the database.

System_CAPS_pubmethodGrant(DatabasePermissionSet^, String^, Boolean)

Grants access to the specified permission to the grantee and the ability to grant access to other users on the database.

System_CAPS_pubmethodGrant(DatabasePermissionSet^, String^, Boolean, String^)

Grants the specified set of permissions to the grantee and the ability to grant the set of permissions to other users on the database under an assumed role.

System_CAPS_pubmethodGrant(DatabasePermissionSet^, array<String^>^)

Grants the specified set of permissions to the specified grantees on the database.

System_CAPS_pubmethodGrant(DatabasePermissionSet^, array<String^>^, Boolean)

Grants access to the specified permission to the grantees and the ability to grant access to other users on the database.

System_CAPS_pubmethodGrant(DatabasePermissionSet^, array<String^>^, Boolean, String^)

Grants the specified set of permissions to the grantees and the ability to grant the set of permissions to other users on the database under an assumed role.

System_CAPS_pubmethodInitialize()

Initializes the object and forces the properties be loaded.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodInitialize(Boolean)

Initializes the object and forces the properties be loaded.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodIsMember(String^)

Determines whether the specified group or role belongs to the database.

System_CAPS_protmethodIsObjectInitialized()

Verifies whether the object has been initialized.(Inherited from SqlSmoObject.)

System_CAPS_protmethodIsObjectInSpace()

Verifies whether the object is isolated or connected to the instance of SQL Server.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodIsSupportedProperty(String^)

(Inherited from SqlSmoObject.)

System_CAPS_pubmethodPrefetchObjects()

Prefetches database objects.

System_CAPS_pubmethodPrefetchObjects(Type^)

Prefetches database objects of a specified type.

System_CAPS_pubmethodPrefetchObjects(Type^, ScriptingOptions^)

Prefetches database objects of a specified type with scripting options.

System_CAPS_pubmethodReauthorizeRemoteDataArchiveConnection(String^)

System_CAPS_pubmethodRecalculateSpaceUsage()

Recalculates space usage.

System_CAPS_pubmethodRefresh()

Updates the Database object.(Overrides ScriptNameObjectBase::Refresh().)

System_CAPS_pubmethodRemoveFullTextCatalogs()

Removes full-text catalogs from the database.

System_CAPS_pubmethodRename(String^)

Renames the database.

System_CAPS_pubmethodRevoke(DatabasePermissionSet^, String^)

Revokes a previously granted set of permissions from a grantee on the database.

System_CAPS_pubmethodRevoke(DatabasePermissionSet^, String^, Boolean, Boolean)

Revokes previously granted permissions from a grantee on the database and any other users to whom the grantee has granted the specified set of permissions. The grantee is also given the ability to revoke the specified set of permissions from other users under an assumed role.

System_CAPS_pubmethodRevoke(DatabasePermissionSet^, String^, Boolean, Boolean, String^)

Revokes previously granted permissions from a grantee on the database and any other users to whom the grantee has granted the specified set of permissions. The grantee is also given the ability to revoke the specified set of permissions from other users under an assumed role.

System_CAPS_pubmethodRevoke(DatabasePermissionSet^, array<String^>^)

Revokes a previously granted set of permissions from a list of grantees on the database.

System_CAPS_pubmethodRevoke(DatabasePermissionSet^, array<String^>^, Boolean, Boolean)

Revokes previously granted permissions from grantees on the database and any other users to whom the grantees have granted the specified set of permissions. The grantees are also given the ability to revoke the specified set of permissions from other users under an assumed role.

System_CAPS_pubmethodRevoke(DatabasePermissionSet^, array<String^>^, Boolean, Boolean, String^)

Revokes previously granted permissions from grantees on the database and any other users to whom the grantees have granted the specified set of permissions. The grantees are also given the ability to revoke the specified set of permissions from other users under an assumed role.

System_CAPS_pubmethodScript()

Generates a Transact-SQL script that can be used to re-create the database.

System_CAPS_pubmethodScript(ScriptingOptions^)

Generates a Transact-SQL script that can be used to re-create the database as specified by the script options.

System_CAPS_pubmethodSetDefaultFileGroup(String^)

Sets the default file group for the database.

System_CAPS_pubmethodSetDefaultFileStreamFileGroup(String^)

Sets the default filestream group.

System_CAPS_pubmethodSetDefaultFullTextCatalog(String^)

Sets the default full-text catalog for the database.

System_CAPS_pubmethodSetOffline()

Sets the database offline.

System_CAPS_pubmethodSetOnline()

Sets the database online.

System_CAPS_pubmethodSetOwner(String^)

Sets the database owner.

System_CAPS_pubmethodSetOwner(String^, Boolean)

Sets the database owner.

System_CAPS_protmethodSetParentImpl(SqlSmoObject^)

Sets the parent of the SqlSmoObject to the newParent parameter.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodSetSnapshotIsolation(Boolean)

Sets the snapshot isolation level.

System_CAPS_pubmethodShrink(Int32, ShrinkMethod)

Shrinks the database.

System_CAPS_pubmethodToString()

Returns a String that represents the referenced object.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodTruncateLog()

Truncates the database log.

System_CAPS_pubmethodUpdateIndexStatistics()

Updates index statistics.

System_CAPS_pubmethodValidate(String^, array<Object^>^)

Validates the state of an object.(Inherited from SmoObjectBase.)

System_CAPS_pubmethodValidateAllPlanGuides()

Verifies the validity of the execution plans associated with the database.

System_CAPS_pubmethodValidateAllPlanGuides(DataTable^%)

Verifies the validity of the execution plans associated with the database and returns validation report.

NameDescription
System_CAPS_pubeventPropertyChanged

Represents the event that occurs when a property is changed.(Inherited from SqlSmoObject.)

System_CAPS_pubeventPropertyMetadataChanged

Represents the event that occurs when property metadata changes.(Inherited from SqlSmoObject.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject::Discover()

Discovers any dependencies.

Do not reference this member directly in your code. It supports the SQL Server infrastructure.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject::GetDomainRoot()

Returns the root of the domain.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject::GetParent()

Gets the parent of this object. Do not reference this member directly in your code. It supports the SQL Server infrastructure.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject::GetPropertyType(String^)

Gets the type of the specified property.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject::GetPropertyValue(String^, Type^)

Gets the value of the specified property.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject::GetUrn()

Gets the Unified Resource Name (URN) of the object.

Do not reference this member directly in your code. It supports the SQL Server infrastructure.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject::Resolve(String^)

Gets the instance that contains the information about the object from the Unified Resource Name (URN) of the object.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject::SetObjectState(SfcObjectState)

Sets the object state to the specified SfcObjectState value.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject::SetPropertyValue(String^, Type^, Object^)

Sets the property value.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodISfcPropertyProvider::GetPropertySet()

Gets the interface reference to the set of properties of this object.

Do not reference this member directly in your code. It supports the SQL Server infrastructure.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyISfcSupportsDesignMode::IsDesignMode

The Database class represents databases, either system or user-defined, on the instance of SQL Server. The Server class is the parent of the Database class.

By using the Database class, you can do the following:

  • Create a new database or drop an existing database.

  • Register the database in the Active Directory service.

  • Reference database objects in collections, such as tables, users, and triggers.

  • Set up database mirroring.

  • Create a master database key.

  • Set up a full-text search catalog.

  • Check data, allocations, catalogs, and tables.

  • Issue a checkpoint.

  • Grant, revoke, and deny permissions to users on the database.

  • Run Transact-SQL statements.

  • Enumerate database information, such as locks or object permissions.

  • Remove the backup history.

  • Monitor the number of transactions.

  • Set the database offline or online.

  • Change the owner of the database.

  • Update statistics.

  • Shrink the database.

  • Truncate the log.

  • Script the database.

To get Database object properties, a login must be a member of the public fixed server role and the user mapped to this login in the database must be a member of the public database role.

To set Database object properties and run the Alter method, users must have ALTER permission on the database, or be a member of the db_owner fixed database role.

To create a database, users must have CREATE DATABASE, CREATE ANY DATABASE, or ALTER ANY DATABASE permission on the parent server.

To drop a database, users must have CONTROL permission on the database, or be a member of the db_owner fixed database role.

To grant, revoke, or deny other users permission on the database, users must have CONTROL permission on the database or be a member of the db_owner fixed database role.

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

VB

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database($srv, "Test_SMO_Database")
$db.Create()
Write-Host $db.CreateDate
$db.Drop()

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft