Merge-Partition cmdlet

 

Applies To: SQL Server 2016

Merges the data of one or more source partitions into a target partition and then deletes the source partitions.

Merge-ASDatabase [-Name] <string> [-SourcePartitions] <System.String[]> -Database <string> -Cube <string> -MeasureGroup <string> [-Server <string>] [-Credentials <PSCredential>] [<CommonParameters>]

Merge-ASDatabase -TargetPartition <Microsoft.AnalysisServices.Partition> [-SourcePartitions] <System.String[]> -Database <string> -Cube <string> -MeasureGroup <string> [-Server <string>] [-Credentials <PSCredential>] [<CommonParameters>]

The Merge-Partition cmdlet merges the data of one or more source partitions into a target partition and then deletes the source partitions. Partitions can be merged only if they meet all the following criteria:

  • Partitions are in the same measure group.

  • Partitions are on the same computer.

  • Partitions share the same storage mode (MOLAP, HOLAP, and ROLAP for multidimensional databases).

-Name <string>

Specifies the target partition into which the source partition data will be merged. This partition must already exist.

Required?true
Position?0
Default value
Accept pipeline input?false
Accept wildcard characters?false

-SourcePartition <string>

Specifies the source partition that will be merged into the target partition. You can create a comma delimited list of the partitions you want to merge. Use a variable to store the list. For example, $Sources=”Sales_2008”, “Sales_2009”, “Sales_2010”.

Required?true
Position?1
Default value
Accept pipeline input?false
Accept wildcard characters?false

-Database <string>

Specifies the database to which the partitions belong.

Required?true
Position?named
Default value
Accept pipeline input?false
Accept wildcard characters?false

-Cube <string>

Specifies the cube to which the partitions belong.

Required?true
Position?named
Default value
Accept pipeline input?false
Accept wildcard characters?false

-MeasureGroup <string>

Specifies the measure group to which the partition belongs.

Required?true
Position?named
Default value
Accept pipeline input?false
Accept wildcard characters?false

-Server <string>

Specifies the Analysis Services instance to which the cmdlet will connect and execute. If no server name is provided, a connection is made to localhost. For default instances, specify just the server name. For named instances, use the format servername\instancename. For HTTP connections, use the format http[s]://server[:port]/virtualdirectory/msmdpump.dll.

Required?false
Position?named
Default valuelocalhost
Accept pipeline input?false
Accept wildcard characters?false

-Credential <PSCredential>

This parameter is used to pass in a username and password when using an HTTP connection to an Analysis Service instance, for an instance that you have configured for HTTP access. For more information, see Configure HTTP Access to Analysis Services on Internet Information Services (IIS) 8.0 and PowerShell scripting in Analysis Services for HTTP connections.

If this parameter is specified, the username and password will be used to connect to the specified Analysis Server instance. If no credentials are specified default windows account of the user who is running the tool will be used.

To use this parameter, first create a PSCredential object using Get-Credential to specify the username and password (for example, $Cred=Get-Credential “adventure-works\bobh”. You can then pipe this object to the –Credential parameter (-Credential:$Cred).

Required?false
Position?named
Default value
Accept pipeline input?True (ByValue)
Accept wildcard characters?false

-TargetPartition <Microsoft.AnalysisServices.Partition>

Specifies the target partition to which the source partitions will be merged.

Required?true
Position?named
Default value
Accept pipeline input?true
Accept wildcard characters?false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see About_CommonParameters.

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns.

InputsSystem.string
OutputsNone

PS SQL SERVER:\sqlas\locahost\default\Databases\AWTEST\Cubes\Adventure Works\MeasureGroups\sales orders\partitions> $Source=”Total_Orders_2001”, “Total_Orders_2002”, “Total_Orders_2003” PS SQL SERVER:\sqlas\locahost\default\Databases\AWTEST\Cubes\Adventure Works\MeasureGroups\sales orders\partitions> Merge-Partition –Name “Total_Orders_2004” –SourcePartitions:$Source –database “AWTEST” –cube “Adventure Works” –MeasureGroup “Sales Orders”

This command merges partitions from 2001, 2002, and 2003 into the partition for 2004, and then deletes the partitions from previous years.

PowerShell scripting in Analysis Services
Manage Tabular Models Using PowerShell

Community Additions

ADD
Show: