Share via


New-MasterDataServicesDatabase (PowerShell)

建立 Master Data Services 資料庫。

語法

New-MasterDataServicesDatabase [-Server] <Microsoft.MasterDataServices.Configuration.DatabaseServerInformation>
      [-DatabaseName] <String> [-AdminAccount] <String> [-Collation <String>]

說明

New-MasterDataServicesDatabase 會建立 Master Data Services 資料庫。它會確認指定的 SQL Server 執行個體是否為可主控 Master Data Services 資料庫的支援版本,以及確認指定的帳戶是否在該執行個體上擁有建立資料庫的權限。

參數

-Server

Server 參數是來自 Get-MasterDataServicesDatabaseServerInformation 的資料庫伺服器資訊物件。這個物件用來連接到建立 Master Data Services 資料庫的 SQL Server 執行個體。

必要項?

true

位置?

0

預設值

接受管線輸入

true (ByValue)

接受萬用字元?

false

-DatabaseName

DatabaseName 參數是指定新 Master Data Services 資料庫名稱的字串。

必要項?

true

位置?

1

預設值

接受管線輸入

false

接受萬用字元?

false

-AdminAccount

AdminAccount 參數是指定要授與新 Master Data Services 資料庫權限之網域帳戶和 Windows 帳戶的字串。

必要項?

true

位置?

2

預設值

接受管線輸入

false

接受萬用字元?

false

-Collation

Collation 參數是指定新 Master Data Services 資料庫之定序的字串。

必要項?

false

位置?

具名

預設值

伺服器的預設定序。

接受管線輸入

false

接受萬用字元?

false

輸入和輸出

輸入類型是可透過管道傳送至指令程式的物件類型。傳回類型是指令程式所傳回的物件類型。

輸入

Microsoft.MasterDataServices.Configuration.DatabaseServerInformation

來自 Get-MasterDataServicesDatabaseServerInformation 的資料庫伺服器資訊物件。

輸出

範例

輸出

下列是使用這個指令程式時傳回的輸出範例。

Name             : MyDatabase
HasAccess        : True
Collation        : SQL_Latin1_General_CP1_CI_AS
ServiceAccount   :
MdsAdministrator : MyDomain\AccountName
Server           : Microsoft.MasterDataServices.Configuration.DatabaseServerInformation
IsDatabaseOwner  : True

使用變數和具名參數

這個範例使用 Get-MasterDataServicesDatabaseServerInformation 指令程式,設定 New-MasterDataServicesDatabase 指令程式中的 Server 參數所用的 $server 變數。這些參數為具名參數,而且預設定序用於新資料庫,因為沒有指定定序。

C:\PS> $server = Get-MasterDataServicesDatabaseServerInformation 
    -ConnectionString 'Data Source=MyServer\MyInstance;Initial catalog=;Integrated Security=True;User ID=;Password='; 
    New-MasterDataServicesDatabase -Server $server 
    -DatabaseName 'MyDatabase' -AdminAccount 'MyDomain\AccountName';

透過管道傳送輸出以及使用具名參數

針對 New-MasterDataServicesDatabase 中的 Server 參數,這個範例透過管道將輸出從 Get-MasterDataServicesDatabaseServerInformation 傳送到 New-MasterDataServicesDatabase。這些參數為具名參數。

C:\PS> Get-MasterDataServicesDatabaseServerInformation 
    -ConnectionString 'Data Source=MyServer\MyInstance;Initial catalog=;Integrated Security=True;User ID=;Password=' | 
    New-MasterDataServicesDatabase -DatabaseName 'MyDatabase' 
    -AdminAccount 'MyDomain\AccountName' -Collation 'SQL_Latin1_General_CP1_CI_AS';

使用變數和位置參數

這個範例使用 Get-MasterDataServicesDatabaseServerInformation 指令程式,設定 New-MasterDataServicesDatabase 指令程式中的 Server 參數所用的 $server 變數。這些參數為位置參數,而且預設定序用於新資料庫,因為沒有指定定序。

C:\PS> $server = Get-MasterDataServicesDatabaseServerInformation 
    -ConnectionString 'Data Source=MyServer\MyInstance;Initial catalog=;Integrated Security=True;User ID=;Password='; 
    New-MasterDataServicesDatabase $server 'MyDatabase' 'MyDomain\AccountName';