Sdílet prostřednictvím


New-AzureSqlJobTarget

Creates a set of databases that can be used as a target for jobs.

Syntax

New-AzureSqlJobTarget
   -ServerName <String>
   -MasterDatabaseCredentialName <String>
   [-LiteralServerName]
   [[-AzureSqlJobConnection] <AzureSqlJobConnection>]
   [<CommonParameters>]
New-AzureSqlJobTarget
   -ServerName <String>
   -DatabaseName <String>
   [-LiteralServerName]
   [[-AzureSqlJobConnection] <AzureSqlJobConnection>]
   [<CommonParameters>]
New-AzureSqlJobTarget
   -ShardMapManagerServerName <String>
   -ShardMapManagerDatabaseName <String>
   -ShardMapManagerCredentialName <String>
   -ShardMapName <String>
   [-LiteralServerName]
   [[-AzureSqlJobConnection] <AzureSqlJobConnection>]
   [<CommonParameters>]
New-AzureSqlJobTarget
   -CustomCollectionName <String>
   [[-AzureSqlJobConnection] <AzureSqlJobConnection>]
   [<CommonParameters>]

Description

The New-AzureSqlJobTarget cmdlet creates a set of databases that can be used as a target for jobs. Targets can be created in the form of either custom collections, Elastic Scale shard maps or databases.

Examples

Example 1: Create a database target

PS C:\>New-AzureSqlJobTarget -ServerName "MyServer.database.contoso.net" -DatabaseName "MyDatabase"
TargetDescription : {"ServerName":"myServer.database.windows.net","DatabaseName":"myDatabase"}
ServerName        : myServer.database.windows.net
DatabaseName      : myDatabase
TargetId          : caab9f96-e34a-4c51-9df9-feb33f5cdb50

TargetType        : Database

This command creates a database target using the database server named MyServer.database.contoso.net and database named MyDatabase.

Example 2: Create a custom collection

PS C:\>New-AzureSqlJobTarget -CustomCollectionName "MyCustomCollection"    
TargetDescription             CustomCollectionName          TargetId                                         TargetType
-----------------             --------------------          --------                                         ----------
{"CustomCollectionName":"m... MyCustomCollection            b525727e-6ed0-44cc-94da-63...              CustomCollection

This command creates a custom collection. After a custom collection is created, database targets can be added as child targets using the Add-AzureSqlJobChildTarget cmdlet.

Example 3: Create an Elastic Scale shared map target

PS C:\>New-AzureSqlJobTarget -ShardMapManagerServerName "MyShardMapManagerServer.database.contoso.net" -ShardMapManagerDatabaseName "MyShardMapManagerDatabase" -ShardMapManagerCredentialName "MyShardMapCredentials" -ShardMapName "MyShardMap"
TargetDescription               : {"ShardMapName":"MyShardMap","ShardMapManagerServerName":"MyShardMapManagerServer.dat
                                  abase.windows.net","ShardMapManagerDatabaseName":"MyShardMapManagerDatabase"}
ShardMapName                    : MyShardMap
ShardMapManagerServerName       : myShardMapManagerServer.database.windows.net
ShardMapManagerDatabaseName     : myShardMapManagerDatabase
ShardMapManagerDatabaseTargetId : 9eb3ee50-e4b2-4feb-b2f7-3ee1cd7f7997
ShardMapManagerCredentialName   : MyShardMapCredentials
TargetId                        : 1afd9326-1277-4344-832f-8170d0375ff7
TargetType                      : ShardMap

This command creates an Elastic Scale shared map target using the provided shard map server name, database name and name. Job runs targeting the shard map target expand to run against each database shard in the shard map. The database shards within the shard map are determined by the system through connecting to the shard map database using the specified shard map credentials. A database target for the database server and the database must first be created along with the credentials.

Parameters

-AzureSqlJobConnection

Specifies the connection state object for the job. You can get the connection state object through the New-AzureSqlJobConnection cmdlet. If you do not specify this parameter, the connection state is used from a prior call to the Use-AzureSqlJobConnection cmdlet.

Type:AzureSqlJobConnection
Position:1
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CustomCollectionName

Specifies the name of the custom collection.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DatabaseName

Specifies the name of the database.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-LiteralServerName

{{Fill LiteralServerName Description}}

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MasterDatabaseCredentialName

{{Fill MasterDatabaseCredentialName Description}}

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ServerName

Specifies the name of the server.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ShardMapManagerCredentialName

Specifies the name of the credential to use whenever connecting to the shard map database to lookup the shards within the shard map.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ShardMapManagerDatabaseName

Specifies the database name containing the Elastic Scale shard map.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ShardMapManagerServerName

Specifies the database server name containing the Elastic Scale shard map.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ShardMapName

Specifies the name of the Elastic Scale shard map.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False