dbTalk Databases Forums  

SSAS 2005: How do you drop aggregation design from partition in script

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss SSAS 2005: How do you drop aggregation design from partition in script in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Vimas
 
Posts: n/a

Default SSAS 2005: How do you drop aggregation design from partition in script - 12-05-2006 , 03:42 PM






Hello,

I am building code to drop/create aggregation designs for partition.

As a first step I would like to drop aggregation designs (all) from measures
group.

Below is a part of code that I am trying to use. At first I am trying to
drop aggregation design from partition, and after that delete aggregation
design from measure group. But my code does not work. I am getting error on
code oPartition.AggregationDesign.Drop() :
Errors in the metadata manager. The partition with the ID of 'MyPartition',
Name of 'MyPartition' was invalidated by operations in the transaction.
Errors in the metadata manager. The transaction cannot be committed because
one or more objects were invalidated during the transaction.

If I just try to drop aggregate design from measure group, I am also getting
similar error. This error kind of makes sense - dropping aggregation design
invalidates partition. But that is OK with me, I can reprocess is latter.
Actually partition is not even processed yet. So what would I have to do to
make this code work?

Thanks


My Code
For Each oCube In oDB.Cubes

Dim oMeasureGroup As Microsoft.AnalysisServices.MeasureGroup

For Each oMeasureGroup In oCube.MeasureGroups

If oMeasureGroup.AggregationDesigns.Count > 0 Then

Dim oPartition As Microsoft.AnalysisServices.Partition

For Each oPartition In oMeasureGroup.Partitions

If Not oPartition.AggregationDesignID Is Nothing Then

MsgBox("Dropped Agg Design from partition: " &
oPartition.Name)

oPartition.AggregationDesign.Drop()

oPartition.Update()

End If

Next

For i = 0 To oMeasureGroup.AggregationDesigns.Count - 1

oMeasureGroup.AggregationDesigns(i).Drop()

Next i

oMeasureGroup.Update()

End If

Next

Next



Reply With Quote
  #2  
Old   
Peter Yang [MSFT]
 
Posts: n/a

Default RE: SSAS 2005: How do you drop aggregation design from partition in script - 12-05-2006 , 09:52 PM






Hello Vimas,

I was able to reproduce the issue with your code. Also, I tried to change
the code as follows with the same result:

oPartition.AggregationDesign.Drop(DropOptions.Alte rOrDeleteDependents )

I will report this issue to product team and if there is any update, I will
let you know. Thank you for your feedback and patience.

Best Regards,

Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications
<http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
<http://msdn.microsoft.com/subscriptions/support/default.aspx>.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
  #3  
Old   
Peter Yang [MSFT]
 
Posts: n/a

Default RE: SSAS 2005: How do you drop aggregation design from partition in script - 12-06-2006 , 02:05 AM



Hello Vimas,

Basd on the feedback from product team, this behavior is expected. You are
dropping the AggregationDesign, but the partition is still referring to it.
You may want to use the following code to see if it works:

For Each oCube In oDB.Cubes

Dim oMeasureGroup As Microsoft.AnalysisServices.MeasureGroup

For Each oMeasureGroup In oCube.MeasureGroups

If oMeasureGroup.AggregationDesigns.Count > 0 Then

Dim oPartition As Microsoft.AnalysisServices.Partition

For Each oPartition In oMeasureGroup.Partitions

If Not oPartition.AggregationDesignID Is Nothing Then

MsgBox("Dropped Agg Design from partition: " &
oPartition.Name)

oPartition.AggregationDesignID = ''
oPartition.Update(UpdateOptions.AlterDependents)


'oPartition.AggregationDesign.Drop()
'oPartition.Update()

End If

Next

For i = 0 To oMeasureGroup.AggregationDesigns.Count - 1

oMeasureGroup.AggregationDesigns(i).Drop()

Next i

oMeasureGroup.Update()

End If

Next

Next

If you have further questions or comments, please feel free to let's know.
Thank you!


Best Regards,

Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support


================================================== ===

This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====



Reply With Quote
  #4  
Old   
Vimas
 
Posts: n/a

Default Re: SSAS 2005: How do you drop aggregation design from partition in script - 12-06-2006 , 07:35 AM



Hi Peter,

Thank you very much. This worked. I spend so much time trying to make it
work, but could not figure out myself.

Thanks again, you are very very helpfull as allways!

Vimas




"Peter Yang [MSFT]" <petery (AT) online (DOT) microsoft.com> wrote

Quote:
Hello Vimas,

Basd on the feedback from product team, this behavior is expected. You are
dropping the AggregationDesign, but the partition is still referring to
it.
You may want to use the following code to see if it works:

For Each oCube In oDB.Cubes

Dim oMeasureGroup As Microsoft.AnalysisServices.MeasureGroup

For Each oMeasureGroup In oCube.MeasureGroups

If oMeasureGroup.AggregationDesigns.Count > 0 Then

Dim oPartition As Microsoft.AnalysisServices.Partition

For Each oPartition In oMeasureGroup.Partitions

If Not oPartition.AggregationDesignID Is Nothing Then

MsgBox("Dropped Agg Design from partition: " &
oPartition.Name)

oPartition.AggregationDesignID = ''
oPartition.Update(UpdateOptions.AlterDependents)


'oPartition.AggregationDesign.Drop()
'oPartition.Update()

End If

Next

For i = 0 To oMeasureGroup.AggregationDesigns.Count - 1

oMeasureGroup.AggregationDesigns(i).Drop()

Next i

oMeasureGroup.Update()

End If

Next

Next

If you have further questions or comments, please feel free to let's know.
Thank you!


Best Regards,

Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support


================================================== ===

This posting is provided "AS IS" with no warranties, and confers no
rights.
================================================== ====





Reply With Quote
  #5  
Old   
Peter Yang [MSFT]
 
Posts: n/a

Default Re: SSAS 2005: How do you drop aggregation design from partition in script - 12-06-2006 , 07:36 PM



Hello Vimas,

You are welcome! Your experience on this issue will also benefit the
community. :-)

Best Regards,

Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support


================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.