powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / OLAP и DWH [игнор отключен] [закрыт для гостей] / Динамическое создание partitions
6 сообщений из 6, страница 1 из 1
Динамическое создание partitions
    #32947745
EugenT
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
А возможно ли в SQL 2000 (AS) динамическое создание разделов (Partitions)?

Например, в DTS пакете? Если возможно укажите в каком направлении искать.
...
Рейтинг: 0 / 0
Динамическое создание partitions
    #32947770
Dmitry Biryukov
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
всё через DSO
в DTS через ActiveX script task
...
Рейтинг: 0 / 0
Динамическое создание partitions
    #33411957
Владимир Штепа
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Dmitry Biryukovвсё через DSO
в DTS через ActiveX script task

Можете ли указать на какой Public пример (дабы самому велосипед не выдумывать).
...
Рейтинг: 0 / 0
Динамическое создание partitions
    #33412019
Dmitry Biryukov
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
C:\Program Files\Microsoft Analysis Services\Samples\VbDSOExample\advancedsamplecode.bas
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
'
'   CreatePartition - create new partition in the Sales cube
'                     use "sales_fact_1997" as the partition's fact table
'
Public Sub CreatePartition()
    ' lock the cube for writing
    ' so that no other application can modify it
    
    On Error GoTo Err_Lock
    m_dsoCube.LockObject olaplockWrite, _
                         "DSOSample is adding new partition to the cube"
        
    ' NOTE: we do not have to lock the partition after adding it to the cube
    '       by adding it to the locked cube, the partition is also locked
    
    ' create the new partition
    On Error GoTo Err_Create
    Dim dsoPartition As DSO.MDStore
    Set dsoPartition = m_dsoCube.MDStores.AddNew("Sales 1997")
    
    ' NOTE: since the partition will be using the same datasource as the cube,
    '       we don't have to set the partition's datasource, it is by default
    '       the same as the cube's
    
    ' get the quoting characters from the datasource
    Dim sLQuote As String, sRQuote As String
    sLQuote = dsoPartition.DataSources( 1 ).OpenQuoteChar
    sRQuote = dsoPartition.DataSources( 1 ).CloseQuoteChar
    
    ' set the partition fact table
    dsoPartition.SourceTable = sLQuote & "sales_fact_1997" & sRQuote

    ' set the number of records in the fact table that will be loaded into
    ' the cube
    dsoPartition.EstimatedRows =  86837 

    ' set the storage mode
    ' this partition will be ROLAP 0 aggregations
    dsoPartition.OlapMode = olapmodeRolap
    
    ' set the prefix for the aggregation tables
    dsoPartition.AggregationPrefix = "Sales1997_"

    ' set the partition's FromClause and JoinClause
    dsoPartition.FromClause = StringReplace(m_dsoCube.FromClause, _
                                            m_dsoCube.SourceTable, _
                                            dsoPartition.SourceTable)
    
    dsoPartition.JoinClause = StringReplace(m_dsoCube.JoinClause, _
                                            m_dsoCube.SourceTable, _
                                            dsoPartition.SourceTable)
                                            
    ' if you want to limit the records from the partition's fact table
    ' that are to be loaded into the partition, you can use the
    ' SourceTableFilter property.
    ' Ex: dsoPartition.SourceTableFilter = "sales_fact_1997"."time_id" = <value>
    
    ' set the partition data slice
    ' the data slice is a hint for the server
    ' the server will not bother sending a query to this partition
    '   if it notices that based on the data slice, the query does
    '   not require any data from this partition
    ' set the slice to year 199
    ' the slice value is the member key, not member name
    Dim dsoPartitionDimension As DSO.Dimension
    Dim dsoPartitionLevel As DSO.Level
    Set dsoPartitionDimension = dsoPartition.Dimensions("Time")
    Set dsoPartitionLevel = dsoPartitionDimension.Levels("All")
    dsoPartitionLevel.SliceValue = "All Years"
    Set dsoPartitionLevel = dsoPartitionDimension.Levels("Year")
    dsoPartitionLevel.SliceValue = "1997"
       
    ' save the partition definition in the metadata repository
    On Error GoTo Err_Update
    dsoPartition.Update
        
    ' unlock the cube
    m_dsoCube.UnlockObject
        
Exit Sub

Err_Lock:
    ' Failed to lock the cube
    ' Possible reasons:
    '   - the cube is already locked by another application
    '   - the machine on which OLAP server is running is not reachable

Err_Create:
    ' Failed to create the partition.
    ' Possible reasons:
    '   - the metadata repository is unreachable
    
Err_Update:
    ' Failed to persist the partition definition in the metadata repository
    ' Possible reasons:
    '   - the metadata repository is unreachable
    '       you can see where the metadata repository resides by looking
    '       up the following registry entry:
    '       HKEY_LOCAL_MACHINE\Software\Microsoft\OLAP Server\Server Connection Info
    '           Repository Connection String
    '   - the DSO datasource object is being locked by another DSO application
    '       it is not possible for two DSO apps to persist the same object
    '       at the same time
    '       it is not possible to persist a DSO object, it another DSO app
    '       has explicitly locked it
    
    
    ' unlock the cube
    m_dsoCube.UnlockObject
    
    MsgBox "Create partition failed" & vbCrLf & Err.Description

End Sub
...
Рейтинг: 0 / 0
Динамическое создание partitions
    #33412028
AAron
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
/topic/225026&hl=
...
Рейтинг: 0 / 0
Динамическое создание partitions
    #33412075
Владимир Штепа
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Большое спасибо.
...
Рейтинг: 0 / 0
6 сообщений из 6, страница 1 из 1
Форумы / OLAP и DWH [игнор отключен] [закрыт для гостей] / Динамическое создание partitions
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]