In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
ORACLE in practice, due to the increase of business, the amount of data of some tables that were not planned to be very large has greatly increased. In order to optimize these tables, we need to change these tables from ordinary tables to partitioned tables. Now let's introduce a technique that comes with ORACLE to deal with this situation-this technique is called online table redefinition.
The first step is to create a temporary table:
Create table test_table
(ID NUMEBER (10) NOT NULL
STATUS VARCHAR2 (30) NULL
CREATE_DATE DATE
) PARTITION BY RANGE (CREATE_DATE)
(PARTITION part23 VALUES LESS THAN (TO_DATE ('2010-09-24)
PARTITION part24 VALUES LESS THAN (TO_DATE ('2010-09-25,' YYYY-MM-DD'))
PARTITION Part25 VALUES LESS THAN (TO_DATE ('2010-09-26,' YYYY-MM-DD'))
PARTITION partmax VALUES LESS THAN (MAXVALUE)
);
Alter table test_table add constraint test_table_pk primary key (id)
The second step is to determine whether the target data table can be redefined. Use the CAN_REDEF_TABLE method of the DBMS_REDEFINITION package to judge.
Exec dbms_redefinition.can_redef_table ('user','table',dbms_redefinition.cons_use_pk)
The materialized view created using cons_use_pk redefinition is based on the normal refresh mode.
You can also use ROWID's method.
Exec dbms_redefinition.can_redef_table ('user','table',dbms_redefinition.cons_use_rowid)
Materialized views created when using cons_use_rowid redefinition are refreshed based on ROWID.
The third step begins to redefine
Exec dbms_redefinition.start_redef_table ('user',' table', 'test_table')
Synchronize data in the temporary table with the original table
Exec dbms_redefinition.sync_interim_table ('user',' table', 'test_table')
Start copying the properties of the table
DeclareCLAR
Num_errors PLS_INTEGER
BEGIN
DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS ('user','table','test_table'
DBMS_REDEFINITION.CONS_ORIG_PARAMS, TRUE, num_errors)
END
/
Including indexes, rules, promoters
Complete the redefinition
Exec dbms_redefinition.finish_redef_table ('user',' table', 'test_table')
_ Competition)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.