File indexing completed on 2024-04-06 12:23:00
0001
0002
0003
0004
0005
0006
0007
0008 column pind format a2
0009 column table_name format a30
0010 column column_name format a30
0011 column pname format a30
0012
0013 DROP TABLE SPLITTER;
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 CREATE TABLE SPLITTER AS
0025 select table_name, column_name, pname, max(pind) pind, num_rows
0026 from (select t.table_name,
0027 column_name,
0028 regexp_replace(partition_name, '_[0-9]+$', '') pname,
0029 regexp_replace(partition_name, '.*_', '') pind, u.num_rows num_rows
0030 from
0031 user_tab_partitions t join user_part_key_columns c on t.table_name =
0032 c.name join user_tables u on t.table_name = u.table_name)
0033 group by pname, table_name, column_name, num_rows order by num_rows asc;
0034
0035
0036
0037
0038
0039 ALTER TABLE SPLITTER ADD MAXVAL INT DEFAULT 0;
0040
0041 COLUMN A FORMAT A30
0042
0043 SET HEAD OFF
0044 SET ECHO OFF
0045
0046
0047
0048
0049
0050 column a format a35
0051 SPOOL UPDATESPLITTER1.sql
0052 SELECT 'SELECT ''UPDATE SPLITTER SET MAXVAL = '', COALESCE(MAX(',
0053 COLUMN_NAME, '),0), '' WHERE TABLE_NAME = ',
0054 REGEXP_REPLACE(REGEXP_REPLACE(TABLE_NAME, '^ *', ''''''),
0055 ' *$', '''''') A,
0056 ';'' FROM ', TABLE_NAME, ';'
0057 FROM SPLITTER;
0058 SPOOL OFF
0059
0060
0061
0062
0063
0064 SPOOL UPDATESPLITTER2.sql;
0065 @UPDATESPLITTER1;
0066 SPOOL OFF
0067
0068
0069
0070
0071 @UPDATESPLITTER2;
0072
0073
0074
0075
0076 SET LINE 400
0077 SPOOL SPLITPARTITIONS.sql
0078 SELECT 'ALTER TABLE ' || TABLE_NAME || ' SPLIT PARTITION ' || PNAME || '_' ||
0079 PIND || ' AT (' || MAXVAL || ') INTO (PARTITION ' || PNAME || '_' ||
0080 (PIND) || ' TABLESPACE CMS_ECAL_COND_20' || PIND || '_DATA' ||
0081 ', PARTITION ' || PNAME || '_' || (PIND + 1) ||
0082 ' TABLESPACE CMS_ECAL_COND_20' || (PIND+1) ||
0083 '_DATA) UPDATE GLOBAL INDEXES;'
0084 FROM SPLITTER WHERE MAXVAL > 0 ORDER BY NUM_ROWS ASC;
0085 SPOOL OFF
0086
0087
0088
0089
0090
0091
0092
0093
0094