Поделиться через


Instance.InstanceDatabaseOptions Property

Gets or sets the instance database properties, including filegroups, data files, log files, and the database collation.

Пространство имен: Microsoft.SqlServer.Management.Nmo
Сборка: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Синтаксис

'Декларация
Public Property InstanceDatabaseOptions As InstanceDatabaseOptions
public InstanceDatabaseOptions InstanceDatabaseOptions { get; set; }
public:
property InstanceDatabaseOptions^ InstanceDatabaseOptions {
    InstanceDatabaseOptions^ get ();
    void set (InstanceDatabaseOptions^ value);
}
/** @property */
public InstanceDatabaseOptions get_InstanceDatabaseOptions ()

/** @property */
public void set_InstanceDatabaseOptions (InstanceDatabaseOptions value)
public function get InstanceDatabaseOptions () : InstanceDatabaseOptions

public function set InstanceDatabaseOptions (value : InstanceDatabaseOptions)

Значение свойства

An InstanceDatabaseOptions object that specifies properties of the instance database.

Замечания

Specifying instance database properties is optional. For more information about default values, see Определение базы данных экземпляра.

Пример

The following example shows how to define database properties for an instance of Notification Services:

// Define instance database properties
// Create the InstanceDatabaseOptions object
InstanceDatabaseOptions idb = 
    new InstanceDatabaseOptions(myInstance, "MyInstDB");

// Define and add a filegroup
InstanceDatabaseFileGroup idb_fg = 
    new InstanceDatabaseFileGroup(idb, "PRIMARY");
idb.InstanceDatabaseFileGroups.Add(idb_fg);

// Define and add a data file
InstanceDatabaseFile idb_file1 = 
    new InstanceDatabaseFile(idb_fg, "MyInst_PrimaryFile1");
idb_file1.FileName = @"C:\NS\Full\MyInst_PrimaryFile1.mdf";
idb_file1.InitialSize = "5MB";
idb_file1.MaxSize = "15MB";
idb_file1.GrowthIncrement = "10%";
idb_fg.InstanceDatabaseFiles.Add(idb_file1);

// Define and add a log file
InstanceDatabaseLogFile idb_log = 
    new InstanceDatabaseLogFile(idb, "MyInst_LogFile1");
idb_log.FileName = @"C:\NS\Full\MyInst_LogFile1.ldf";
idb_log.InitialSize = "3MB";
idb_log.MaxSize = "10MB";
idb_log.GrowthIncrement = "10%";
idb.InstanceDatabaseLogFiles.Add(idb_log);

// Define database options
idb.CollationName = "Latin1_General_CS_AS";
idb.DefaultFileGroup = "PRIMARY";

// Assign options to Instance.InstanceDatabaseOptions property
myInstance.InstanceDatabaseOptions = idb;
' Create the InstanceDatabaseOptions object
Dim idb As InstanceDatabaseOptions = _
    New InstanceDatabaseOptions(myInstance, "MyInstDB")

' Define and add a filegroup
Dim idb_fg As InstanceDatabaseFileGroup = _
    New InstanceDatabaseFileGroup(idb, "PRIMARY")
idb.InstanceDatabaseFileGroups.Add(idb_fg)

' Define and add a data file
Dim idb_file1 As InstanceDatabaseFile = _
    New InstanceDatabaseFile(idb_fg, "MyInst_PrimaryFile1")
idb_file1.FileName = "C:\NS\Full\MyInst_PrimaryFile1.mdf"
idb_file1.InitialSize = "5MB"
idb_file1.MaxSize = "15MB"
idb_file1.GrowthIncrement = "10%"
idb_fg.InstanceDatabaseFiles.Add(idb_file1)

' Define and add a log file
Dim idb_log As InstanceDatabaseLogFile = _
    New InstanceDatabaseLogFile(idb, "MyInst_LogFile1")
idb_log.FileName = "C:\NS\Full\MyInst_LogFile1.ldf"
idb_log.InitialSize = "3MB"
idb_log.MaxSize = "10MB"
idb_log.GrowthIncrement = "10%"
idb.InstanceDatabaseLogFiles.Add(idb_log)

' Define database options
idb.CollationName = "Latin1_General_CS_AS"
idb.DefaultFileGroup = "PRIMARY"

' Assign options to Instance.InstanceDatabaseOptions property.
myInstance.InstanceDatabaseOptions = idb

Синхронизация потоков

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

Платформы

Платформы разработки

Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.

Целевые платформы

Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.

См. также

Справочник

Instance Class
Instance Members
Microsoft.SqlServer.Management.Nmo Namespace

Другие ресурсы

Настройка экземпляров служб Notification Services
Database Element (ICF)