Ce sujet n'a pas encore été évalué - Évaluez ce sujet

Classe Database

Represents an SQL Server database.

Espace de noms :  Microsoft.SqlServer.Management.Smo
Assembly :  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)
[PhysicalFacetAttribute]
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)]
public sealed class Database : ScriptNameObjectBase, 
	ICreatable, IAlterable, IDroppable, IRenamable, IExtendedProperties, 
	IScriptable, IDatabaseOptions, IDmfFacet, ISfcSupportsDesignMode

Le type Database expose les membres suivants.

  NomDescription
Méthode publiqueDatabase()Initializes a new instance of the Database class.
Méthode publiqueDatabase(Server, String)Initializes a new instance of the Database class on the specified server and with the specified name.
Haut de la page
  NomDescription
Propriété publiqueActiveConnectionsGets the number of active connections to the database.
Propriété publiqueActiveDirectory Obsolète. Gets the information about the Active Directory settings for the database.
Propriété publiqueAnsiNullDefaultGets or sets a value that specifies whether the ANSI_NULL_DEFAULT database option is active.
Propriété publiqueAnsiNullsEnabledGets or sets a value that specifies whether the ANSI_NULLS_ENABLED database option is active.
Propriété publiqueAnsiPaddingEnabledGets or sets a value that specifies whether the ANSI_PADDING_ENABLED database option is active.
Propriété publiqueAnsiWarningsEnabledGets or sets a value that specifies whether the ANSI_WARNINGS_ENABLED database option is active.
Propriété publiqueApplicationRolesGets a collection of ApplicationRole objects. Each ApplicationRole object represents an application role defined on the database.
Propriété publiqueArithmeticAbortEnabledGets or sets a value that specifies whether the ARITHMETICABORT database option is active.
Propriété publiqueAssembliesGets a collection of SqlAssembly objects. Each SqlAssembly object represents an assembly defined on the database.
Propriété publiqueAsymmetricKeysGets a collection of AsymmetricKey objects. Each AsymmetricKey object represents an asymmetric key defined on the database.
Propriété publiqueAutoCloseGets or sets a value that specifies whether the AUTOCLOSE database option is set.
Propriété publiqueAutoCreateStatisticsEnabledGets a value that specifies whether statistics are automatically created for the database.
Propriété publiqueAutoShrinkGets or sets a value that specifies whether the AUTO_SHRINK database option is active.
Propriété publiqueAutoUpdateStatisticsAsyncGets or sets a value that specifies whether the AUTOUPDATESTATISTICSASYNC database option is active.
Propriété publiqueAutoUpdateStatisticsEnabledGets or sets a value that specifies whether statistics are automatically updated for the database.
Propriété publiqueAvailabilityDatabaseSynchronizationStateGets the synchronization state of the availability database.
Propriété publiqueAvailabilityGroupNameGets the availability group name in the database.
Propriété publiqueBrokerEnabledGets or sets a value that specifies whether the Service Broker service is enabled.
Propriété publiqueCaseSensitiveGets a value that specifies whether uppercase letters and lowercase letters are evaluated as equal.
Propriété publiqueCertificatesGets a collection of Certificate objects. Each Certificate object represents a certificate defined on the database.
Propriété publiqueChangeTrackingAutoCleanUpGets or sets a value that specifies whether the CHANGE_TRACKING_AUTO_CLEANUP OPTION is enabled.
Propriété publiqueChangeTrackingEnabledGets or sets a value that specifies whether the CHANGE_TRACKING_VALUE option is enabled
Propriété publiqueChangeTrackingRetentionPeriodGets or sets the CHANGE_TRACKING_RETENTION_PERIOD value.
Propriété publiqueChangeTrackingRetentionPeriodUnitsGets or sets the unit type for a retention period value.
Propriété publiqueCloseCursorsOnCommitEnabledGets or sets a value that specifies whether the CURSOR_CLOSE_ON_COMMIT database option is active.
Propriété publiqueCollationGets or sets the default collation used by the database.
Propriété publiqueCompatibilityLevelGets or sets the compatibility level for the database.
Propriété publiqueConcatenateNullYieldsNullGets or sets a value that specifies whether the CONCAT_NULL_YIELDS_NULL database option is active.
Propriété publiqueContainmentTypeGets or sets the type of containment.
Propriété publiqueCreateDateGets the date that the database was created.
Propriété publiqueDatabaseAuditSpecificationsGets a collection of DatabaseAuditSpecification objects. Each DatabaseAuditSpecification object represents a database audit specification defined on the server.
Propriété publiqueDatabaseEncryptionKeyGets a DataBaseEncryptionKey data type.
Propriété publiqueDatabaseGuidGets the Guid value that uniquely identifies the database.
Propriété publiqueDatabaseOptionsGets the DatabaseOptions object that contains configuration options for the database.
Propriété publiqueDatabaseOwnershipChainingGets or sets a value that specifies whether the database ownership chaining is active.
Propriété publiqueDatabaseSnapshotBaseNameGets the name of the snapshot base for the database.
Propriété publiqueDataSpaceUsageGets the space used by the data in the database.
Propriété publiqueDateCorrelationOptimizationGets or sets a value that specifies whether the date correlation optimization is active.
Propriété publiqueDboLoginGets a value that specifies whether the current user is logged on as the database owner (DBO).
Propriété publiqueDefaultFileGroupGets the default file group used by the database.
Propriété publiqueDefaultFileStreamFileGroupGets the file group name for the default file stream.
Propriété publiqueDefaultFullTextCatalogGets the default full-text catalog used by the database.
Propriété publiqueDefaultFullTextLanguageGets the default full text language.
Propriété publiqueDefaultLanguageGets or sets the default language.
Propriété publiqueDefaultsGets a collection of Default objects. Each Default object represents a default defined on the database.
Propriété publiqueDefaultSchemaGets the default schema of the user.
Propriété publiqueEncryptionEnabledGets or sets a value that indicates whether the data encryption is enabled.
Propriété publiqueEventsGets the events associated with the database.
Propriété publiqueExtendedPropertiesGets the extended properties of the database.
Propriété publiqueExtendedStoredProceduresGets a collection of ExtendedStoredProcedure objects. Each ExtendedStoredProcedure object represents an extended stored procedure defined on the database.
Propriété publiqueFederationsGets a collection of Federation objects. Each Federation represents a data being partitioned on the database.
Propriété publiqueFileGroupsGets a collection of FileGroup objects. Each FileGroup object represents a file group defined on the database.
Propriété publiqueFilestreamDirectoryNameGets or sets the name of file stream share directory.
Propriété publiqueFilestreamNonTransactedAccessGets or sets the file stream non-transacted access setting for database.
Propriété publiqueFullTextCatalogsGets a collection of FullTextCatalog objects. Each FullTextCatalog object represents a full-text catalog defined on the database.
Propriété publiqueFullTextStopListsGets a collection of FullTextStopList objects. Each FullTextStopList object represents a full text stop list defined on the server.
Propriété publiqueHonorBrokerPriorityGets or sets a value that specifies whether the priority specified by the broker is acknowledged or not.
Propriété publiqueIDGets the database ID value that uniquely identifies the database.
Propriété publiqueIndexSpaceUsageGets the space used by the indexes in the database.
Propriété publiqueIsAccessibleGets a value that specifies whether the database can be accessed.
Propriété publiqueIsDatabaseSnapshotGets a value that specifies whether the database is a snapshot database.
Propriété publiqueIsDatabaseSnapshotBaseGets a value that specifies whether the database is the base database for a snapshot database.
Propriété publiqueIsDbAccessAdminGets a value that specifies whether the current user is a member of the DbAccessAdmin database role.
Propriété publiqueIsDbBackupOperatorGets a value that specifies whether the current user is a member of the DbBackupOperator database role.
Propriété publiqueIsDbDatareaderGets a value that specifies whether the current user is a member of the DbDatareader database role.
Propriété publiqueIsDbDatawriterGets a value that specifies whether the current user is a member of the DbDatawriter database role.
Propriété publiqueIsDbDdlAdminGets a value that specifies whether the current user is a member of the DbDdlAdmin database role.
Propriété publiqueIsDbDenyDatareaderGets a value that specifies whether the current user is a member of the DbDenyDatareader database role.
Propriété publiqueIsDbDenyDatawriterGets a value that specifies whether the current member is a member of the DbDenyDatawriter database.
Propriété publiqueIsDbManagerGets a value that specifies whether the current login is a database manager in Base de données SQL.
Propriété publiqueIsDbOwnerGets a value that specifies whether the current user is a member of the DbOwner database role.
Propriété publiqueIsDbSecurityAdminGets a value that specifies whether the current user is a member of the DbSecurityAdmin database role.
Propriété publiqueIsFederationMemberGets or sets a value that specifies whether the database is a member of federation.
Propriété publiqueIsFullTextEnabledGets or sets a value that specifies whether the database is enabled for full-text search.
Propriété publiqueIsLoginManagerGets a value that specifies whether the current login is a login manager in Base de données SQL.
Propriété publiqueIsMailHostGets a value that specifies whether the database is configured as a mail host.
Propriété publiqueIsManagementDataWarehouseGets a value that specifies whether the database is a management data warehouse.
Propriété publiqueIsMirroringEnabledGets a value that specifies whether mirroring is enabled on the database.
Propriété publiqueIsParameterizationForcedGets or sets a value that specifies whether parameterization is forced on the database.
Propriété publiqueIsReadCommittedSnapshotOnGets or sets a value that specifies whether transactions with the read committed isolation level use row versioning.
Propriété publiqueIsSystemObjectGets a value that specifies whether the database is a system object or a user-defined database.
Propriété publiqueIsUpdateableGets a value that specifies whether the database can be updated.
Propriété publiqueIsVarDecimalStorageFormatEnabledGets or sets a value that specifies whether VarDecimal storage is enabled.
Propriété publiqueLastBackupDateGets the date and time when the database was last backed up.
Propriété publiqueLastDifferentialBackupDateGets the date and time when the last differential backup was performed.
Propriété publiqueLastLogBackupDateGets the date and time when the transaction log was last backed up.
Propriété publiqueLocalCursorsDefaultGets or sets a value that specifies whether the local server cursors are used by default.
Propriété publiqueLogFilesGets a collection of LogFile objects. Each LogFile object represents a log file defined on the database.
Propriété publiqueLogReuseWaitStatusGets the type of operation on which the reuse of transaction log space is waiting.
Propriété publiqueMasterKeyGets the master key that is used to encrypt the private keys of certificates.
Propriété publiqueMirroringFailoverLogSequenceNumberGets the log sequence number at last failover.
Propriété publiqueMirroringIDGets the ID value that uniquely identifies the mirroring partnership.
Propriété publiqueMirroringPartnerGets or sets the address of the Moteur de base de données instance that is the partner server for database mirroring.
Propriété publiqueMirroringPartnerInstanceGets the instance of SQL Server on which the mirroring partner is configured.
Propriété publiqueMirroringRedoQueueMaxSizeGets the maximum size of the redo queue of the mirror server instance in KB.
Propriété publiqueMirroringRoleSequenceGets the role sequence number for primary/backup roles played by the mirroring partners.
Propriété publiqueMirroringSafetyLevelGets or sets the mirroring safety level.
Propriété publiqueMirroringSafetySequenceGets the role sequence number for safety levels for the mirroring partners.
Propriété publiqueMirroringStatusGets the status of the database and the database mirroring session.
Propriété publiqueMirroringTimeoutGets 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.
Propriété publiqueMirroringWitnessGets or sets the name of the Moteur de base de données instance of the database mirroring witness server.
Propriété publiqueMirroringWitnessStatusGets the status of the mirroring witness server.
Propriété publiqueNameGets or sets the name of the database. (remplace NamedSmoObject.Name.)
Propriété publiqueNestedTriggersEnabledGets or sets a value that indicates whether the nested triggers are enabled.
Propriété publiqueNumericRoundAbortEnabledGets or sets a value that specifies whether the NUMERIC_ROUNDABORT database option is active.
Propriété publiqueOwnerGets the database principal that is the owner of the database.
Propriété publiquePageVerifyGets or sets the type of page integrity check that SQL Server performs when reading database pages.
Propriété publiqueParentGets or sets the Server object that is the parent of the Database object.
Propriété publiquePartitionFunctionsGets a collection of PartitionFunction objects. Each PartitionFunction object represents a partition function defined on the database.
Propriété publiquePartitionSchemesGets a collection of PartitionScheme objects. Each PartitionScheme object represents a partition scheme defined on the database.
Propriété publiquePlanGuidesGets a collection of plan guides associated with a database.
Propriété publiquePrimaryFilePathGets the operating system directory that contains the primary file for the database.
Propriété publiquePropertiesGets a collection of Property objects that represent the object properties. (hérité de SqlSmoObject.)
Propriété publiqueQuotedIdentifiersEnabledGets 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.
Propriété publiqueReadOnlyGets or sets a value that specifies whether the database is read-only.
Propriété publiqueRecoveryForkGuidGets the GUID value that specifies the recovery fork on which the database is currently active.
Propriété publiqueRecoveryModelGets or sets the recovery model for the database.
Propriété publiqueRecursiveTriggersEnabledGets or sets a value that specifies whether recursive triggers are enabled on the database.
Propriété publiqueReplicationOptionsGets the active replication settings for a database.
Propriété publiqueRolesGets a collection of DatabaseRole objects. Each DatabaseRole object represents a role defined on the database.
Propriété publiqueRulesGets a collection of Rule objects. Each Rule object represents a rule defined on the database.
Propriété publiqueSchemasGets a collection of Schema objects. Each Schema object represents a schema defined on the database.
Propriété publiqueSearchPropertyListsGets the SearchPropertyListCollection associated with this object.
Propriété publiqueSequencesGets the SequenceCollection associated with this object.
Propriété publiqueServiceBrokerGets the ServiceBroker object that represents the Service Broker.
Propriété publiqueServiceBrokerGuidGets the Guid object that uniquely identifies the instance of Service Broker.
Propriété publiqueSizeGets the size of the database in MB.
Propriété publiqueSnapshotIsolationStateGets the snapshot isolation state for the database.
Propriété publiqueSpaceAvailableGets the available space in the database in KB.
Propriété publiqueStateGets the state of the referenced object. (hérité de SmoObjectBase.)
Propriété publiqueStatusGets the database status.
Propriété publiqueStoredProceduresGets a collection of StoredProcedure objects. Each StoredProcedure object represents a stored procedure defined on the database.
Propriété publiqueSymmetricKeysGets a collection of SymmetricKey objects. Each SymmetricKey object represents a symmetric key defined on the database.
Propriété publiqueSynonymsGets a collection of Synonym objects. Each Synonym object represents a synonym defined on the database.
Propriété publiqueTablesGets a collection of Table objects. Each Table object represents a table defined on the database.
Propriété publiqueTargetRecoveryTimeGets or sets the target recovery time of the used database.
Propriété publiqueTransformNoiseWordsGets a value that indicates whether an object that sets the transform noise words configuration option is used.
Propriété publiqueTriggersGets a collection of DatabaseDdlTrigger objects. Each DatabaseDdlTrigger object represents a trigger defined on the database.
Propriété publiqueTrustworthyGets or sets a value that indicates whether the instance of SQL Server 2005 trusts the database and the contents within it.
Propriété publiqueTwoDigitYearCutoffGets or sets the specified object that is used to set the two digit year cutoff configuration option.
Propriété publiqueUrnGets the Uniform Resource Name (URN) address value that uniquely identifies the object. (hérité de SqlSmoObject.)
Propriété publiqueUserAccessGets or sets the database user access.
Propriété publiqueUserDataGets or sets user-defined data associated with the referenced object. (hérité de SmoObjectBase.)
Propriété publiqueUserDefinedAggregatesGets a collection of UserDefinedAggregate objects. Each UserDefinedAggregate object represents a user-defined aggregate defined on the database.
Propriété publiqueUserDefinedDataTypesGets a collection of UserDefinedDataType objects. Each UserDefinedDataType object represents a user-defined data type on the database.
Propriété publiqueUserDefinedFunctionsGets a collection of UserDefinedFunction objects. Each UserDefinedFunction object represents a user-defined function on the database.
Propriété publiqueUserDefinedTableTypesGets a collection of UserDefinedTableType objects. Each UserDefinedTableType object represents a user-defined table type on the database.
Propriété publiqueUserDefinedTypesGets a collection of UserDefinedType objects. Each UserDefinedType object represents a user-defined type on the database.
Propriété publiqueUserNameGets the database user name.
Propriété publiqueUsersGets a collection of User objects. Each User object represents a user who is defined on the database.
Propriété publiqueVersionGets the version of the instance of SQL Server that was used to create the database.
Propriété publiqueViewsGets a collection of View objects. Each View object represents a view defined on the database.
Propriété publiqueXmlSchemaCollectionsGets a collection of XmlSchemaCollection objects. Each XmlSchemaCollection object represents an XML schema defined on the database.
Haut de la page
  NomDescription
Méthode publiqueAlter()Updates any Database object property changes on the instance of SQL Server. 
Méthode publiqueAlter(TimeSpan)Updates any Database object property changes on the instance of SQL Server. 
Méthode publiqueAlter(TerminationClause)Updates any Database object property changes on the instance of SQL Server. 
Méthode publiqueChangeMirroringStateChanges the mirroring configuration as specified by the options.
Méthode publiqueCheckAllocationsScans all pages of the referenced database and tests pages to help ensure integrity.
Méthode publiqueCheckAllocationsDataOnlyScans all pages of the referenced database and tests only the data to help ensure integrity.
Méthode publiqueCheckCatalogTests the integrity of the database catalog.
Méthode publiqueCheckIdentityValuesVerifies the integrity of all identity columns in tables in the database.
Méthode publiqueCheckpointIssues a checkpoint.
Méthode publiqueCheckTables(RepairType)Tests the integrity of database pages for all tables and indexes defined on the tables of the database.
Méthode publiqueCheckTables(RepairType, RepairOptions)Tests the integrity of database pages for all tables and indexes defined on the tables of the database.
Méthode publiqueCheckTables(RepairType, RepairStructure)Tests the integrity of database pages for all tables and indexes defined on the tables of the database.
Méthode publiqueCheckTables(RepairType, RepairOptions, RepairStructure)Tests the integrity of database pages for all tables and indexes defined on the tables of the database.
Méthode publiqueCheckTablesDataOnly()Tests integrity of data in pages that store data for all tables and indexes defined on the tables of the referenced database.
Méthode publiqueCheckTablesDataOnly(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.
Méthode publiqueCheckTablesDataOnly(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.
Méthode publiqueCheckTablesDataOnly(RepairOptions, 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 options and repair structure.
Méthode publiqueCreate()Creates a database on the instance of SQL Server as defined by the Database object.
Méthode publiqueCreate(Boolean)Creates a database on the instance of SQL Server as defined by the Database object.
Méthode publiqueDeny(DatabasePermissionSet, String)Denies the specified set of permissions for the specified grantee on the database.
Méthode publiqueDeny(DatabasePermissionSet, String[])Denies the specified set of permissions for the specified grantees on the database.
Méthode publiqueDeny(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.
Méthode publiqueDeny(DatabasePermissionSet, 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.
Méthode publiqueDisableAllPlanGuidesDisables all Plan Guides in a database.
Méthode publiqueDiscoverDiscovers a list of type Object. (hérité de SqlSmoObject.)
Méthode publiqueDropDrops the database.
Méthode publiqueDropAllPlanGuidesDrops all Plan Guides in a database.
Méthode publiqueDropBackupHistoryDrops the backup history for the database.
Méthode publiqueEnableAllPlanGuidesEnables all Plan Guides in a database.
Méthode publiqueEnumBackupSetFiles()Returns a DataTable listing files contained in a backup set.
Méthode publiqueEnumBackupSetFiles(Int32)Returns a Data table that lists the files in a backup set
Méthode publiqueEnumBackupSetsReturns a DataTable listing the backup sets associated with a database.
Méthode publiqueEnumCandidateKeysEnumerates a list of all candidate primary keys in the database, which can be referenced by a foreign key.
Méthode publiqueEnumDatabasePermissions()Enumerates a list of all permissions in the database.
Méthode publiqueEnumDatabasePermissions(String)Enumerates a list of permissions in the database for the specified user.
Méthode publiqueEnumDatabasePermissions(DatabasePermissionSet)Enumerates a list of permissions in the database for the specified permission set.
Méthode publiqueEnumDatabasePermissions(String, DatabasePermissionSet)Enumerates a list of permissions in the database for the specified user and a specified permission set.
Méthode publiqueEnumLocks()Enumerates a list of all current locks held on the database.
Méthode publiqueEnumLocks(Int32)Enumerates a list of current locks held on the database for a specified system process ID.
Méthode publiqueEnumLoginMappingsEnumerates a list of SQL Server logins for all the users in the database.
Méthode publiqueEnumMatchingSPs(String)Enumerates a list of stored procedures that contain the specified string in the definition.
Méthode publiqueEnumMatchingSPs(String, Boolean)Enumerates a list of stored procedures that contain the specified string in the definition.
Méthode publiqueEnumObjectPermissions()Enumerates a list of permissions for objects in the database.
Méthode publiqueEnumObjectPermissions(String)Enumerates a list of permissions for objects in the database that belong to the specified user.
Méthode publiqueEnumObjectPermissions(ObjectPermissionSet)Enumerates a list of permissions for objects in the database limited to the specified permission set.
Méthode publiqueEnumObjectPermissions(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.
Méthode publiqueEnumObjects()Enumerates a list of objects in the database.
Méthode publiqueEnumObjects(DatabaseObjectTypes)Enumerates a list of objects in the database.
Méthode publiqueEnumObjects(DatabaseObjectTypes, SortOrder)Enumerates a list of objects in the database.
Méthode publiqueEnumTransactions()Enumerates a list of open transactions on the database.
Méthode publiqueEnumTransactions(TransactionTypes)Enumerates a list of open transactions of a specified type on the database.
Méthode publiqueEnumWindowsGroups()Enumerates a list of Windows groups.
Méthode publiqueEnumWindowsGroups(String)Enumerates a list of Windows groups for a specified group.
Méthode publiqueEquals (hérité de Object.)
Méthode publiqueExecuteNonQuery(StringCollection)Executes a batch in the context of the database where there are no results returned.
Méthode publiqueExecuteNonQuery(String)Executes a statement in the context of the database where there are no results returned.
Méthode publiqueExecuteNonQuery(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.
Méthode publiqueExecuteNonQuery(String, ExecutionTypes)Executes a batch in the context of the database where there are no results returned for the specified execution type only.
Méthode publiqueExecuteWithResults(StringCollection)Executes a batch in the context of the database where there are results returned.
Méthode publiqueExecuteWithResults(String)Executes a collection of batches in the context of the database where there are results returned.
Méthode protégéeFormatSqlVariantFormats an object as SqlVariant type. (hérité de SqlSmoObject.)
Méthode protégéeGetContextDBGets the context database that is associated with this object. (hérité de SqlSmoObject.)
Méthode protégéeGetDBNameGets the database name that is associated with the object. (hérité de SqlSmoObject.)
Méthode publiqueGetHashCode (hérité de Object.)
Méthode protégéeGetPropValueGets a property value of the SqlSmoObject object. (hérité de SqlSmoObject.)
Méthode protégéeGetPropValueOptionalGets a property value of the SqlSmoObject object. (hérité de SqlSmoObject.)
Méthode protégéeGetPropValueOptionalAllowNullGets a property value of the SqlSmoObject object. (hérité de SqlSmoObject.)
Méthode protégéeGetServerObjectGets the server of the SqlSmoObject object. (hérité de SqlSmoObject.)
Méthode publiqueGetTransactionCount()Gets the number of open transactions on the database.
Méthode publiqueGetTransactionCount(TransactionTypes)Gets the number of open transactions of a specified type on the database.
Méthode publiqueGetType (hérité de Object.)
Méthode publiqueGrant(DatabasePermissionSet, String)Grants the specified set of permissions to the specified grantee on the database.
Méthode publiqueGrant(DatabasePermissionSet, String[])Grants the specified set of permissions to the specified grantees on the database.
Méthode publiqueGrant(DatabasePermissionSet, String, Boolean)Grants access to the specified permission to the grantee and the ability to grant access to other users on the database.
Méthode publiqueGrant(DatabasePermissionSet, String[], Boolean)Grants access to the specified permission to the grantees and the ability to grant access to other users on the database.
Méthode publiqueGrant(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.
Méthode publiqueGrant(DatabasePermissionSet, 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.
Méthode publiqueInitialize()Initializes the object and forces the properties be loaded. (hérité de SqlSmoObject.)
Méthode publiqueInitialize(Boolean)Initializes the object and forces the properties be loaded. (hérité de SqlSmoObject.)
Méthode publiqueIsMemberDetermines whether the specified group or role belongs to the database.
Méthode protégéeIsObjectInitializedVerifies whether the object has been initialized. (hérité de SqlSmoObject.)
Méthode protégéeIsObjectInSpaceVerifies whether the object is isolated or connected to the instance of SQL Server. (hérité de SqlSmoObject.)
Méthode publiquePrefetchObjects()Prefetches database objects.
Méthode publiquePrefetchObjects(Type)Prefetches database objects of a specified type.
Méthode publiquePrefetchObjects(Type, ScriptingOptions)Prefetches database objects of a specified type with scripting options.
Méthode publiqueRecalculateSpaceUsageRecalculates space usage.
Méthode publiqueRefreshUpdates the Database object. (remplace ScriptNameObjectBase.Refresh().)
Méthode publiqueRemoveFullTextCatalogsRemoves full-text catalogs from the database.
Méthode publiqueRenameRenames the database.
Méthode publiqueRevoke(DatabasePermissionSet, String)Revokes a previously granted set of permissions from a grantee on the database.
Méthode publiqueRevoke(DatabasePermissionSet, String[])Revokes a previously granted set of permissions from a list of grantees on the database.
Méthode publiqueRevoke(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.
Méthode publiqueRevoke(DatabasePermissionSet, 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.
Méthode publiqueRevoke(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.
Méthode publiqueRevoke(DatabasePermissionSet, 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.
Méthode publiqueScript()Generates a Transact-SQL script that can be used to re-create the database.
Méthode publiqueScript(ScriptingOptions)Generates a Transact-SQL script that can be used to re-create the database as specified by the script options.
Méthode publiqueSetDefaultFileGroupSets the default file group for the database.
Méthode publiqueSetDefaultFileStreamFileGroupSets the default filestream group.
Méthode publiqueSetDefaultFullTextCatalogSets the default full-text catalog for the database.
Méthode publiqueSetOfflineSets the database offline.
Méthode publiqueSetOnlineSets the database online.
Méthode publiqueSetOwner(String)Sets the database owner.
Méthode publiqueSetOwner(String, Boolean)Sets the database owner.
Méthode protégéeSetParentImplSets the parent of the SqlSmoObject to the newParent parameter. (hérité de SqlSmoObject.)
Méthode publiqueSetSnapshotIsolationSets the snapshot isolation level.
Méthode publiqueShrinkShrinks the database.
Méthode publiqueToStringReturns a String that represents the referenced object. (hérité de SqlSmoObject.)
Méthode publiqueTruncateLogTruncates the database log.
Méthode publiqueUpdateIndexStatisticsUpdates index statistics.
Méthode publiqueValidateValidates the state of an object. (hérité de SmoObjectBase.)
Méthode publiqueValidateAllPlanGuides()Verifies the validity of the execution plans associated with the database.
Méthode publiqueValidateAllPlanGuides(DataTable)Verifies the validity of the execution plans associated with the database and returns validation report.
Haut de la page
  NomDescription
Événement publicPropertyChangedRepresents the event that occurs when a property is changed. (hérité de SqlSmoObject.)
Événement publicPropertyMetadataChangedRepresents the event that occurs when property metadata changes. (hérité de SqlSmoObject.)
Haut de la page
  NomDescription
Implémentation d'interface expliciteMéthode privéeIAlienObject.DiscoverDiscovers any dependencies. Ne faites pas directement référence à ce membre dans votre code. Il prend en charge l'infrastructure SQL Server. (hérité de SqlSmoObject.)
Implémentation d'interface expliciteMéthode privéeIAlienObject.GetDomainRootReturns the root of the domain. (hérité de SqlSmoObject.)
Implémentation d'interface expliciteMéthode privéeIAlienObject.GetParentGets the parent of this object. Ne faites pas directement référence à ce membre dans votre code. Il prend en charge l'infrastructure SQL Server. (hérité de SqlSmoObject.)
Implémentation d'interface expliciteMéthode privéeIAlienObject.GetPropertyTypeGets the type of the specified property. (hérité de SqlSmoObject.)
Implémentation d'interface expliciteMéthode privéeIAlienObject.GetPropertyValueGets the value of the specified property. (hérité de SqlSmoObject.)
Implémentation d'interface expliciteMéthode privéeIAlienObject.GetUrnGets the Unified Resource Name (URN) of the object. Ne faites pas directement référence à ce membre dans votre code. Il prend en charge l'infrastructure SQL Server. (hérité de SqlSmoObject.)
Implémentation d'interface expliciteMéthode privéeIAlienObject.ResolveGets the instance that contains the information about the object from the Unified Resource Name (URN) of the object. (hérité de SqlSmoObject.)
Implémentation d'interface expliciteMéthode privéeIAlienObject.SetObjectStateSets the object state to the specified SfcObjectState value. (hérité de SqlSmoObject.)
Implémentation d'interface expliciteMéthode privéeIAlienObject.SetPropertyValueSets the property value. (hérité de SqlSmoObject.)
Implémentation d'interface expliciteMéthode privéeISfcPropertyProvider.GetPropertySetGets the interface reference to the set of properties of this object. (hérité de SqlSmoObject.)
Implémentation d'interface explicitePropriété privéeISfcSupportsDesignMode.IsDesignModeGets a value that indicates whether the object supports design mode. Identifié à titre d'information uniquement. Non pris en charge. La compatibilité future n'est pas garantie.
Haut de la page

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.

Thread Safety

Tout membre statique public (Partagé dans Microsoft Visual Basic) de ce type est sûr dans le cadre des opérations à plusieurs threads. Tous les membres de l'instance ne sont pas garantis comme étant thread-safe.

VB

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Define a Database object variable by supplying the server and the database name arguments in the constructor.
Dim db As Database
db = New Database(srv, "Test_SMO_Database")
'Create the database on the instance of SQL Server.
db.Create()
'Reference the database and display the date when it was created.
db = srv.Databases("Test_SMO_Database")
Console.WriteLine(db.CreateDate)
'Remove the database.
db.Drop()

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()
Tous les membres publics static (Shared dans Visual Basic) de ce type sont thread-safe. Tous les membres de l'instance ne sont pas garantis comme étant thread-safe.
Cela vous a-t-il été utile ?
(1500 caractères restants)

Ajouts de la communauté

AJOUTER
© 2013 Microsoft. Tous droits réservés.