Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Oracle table partition step
1. Table Partition steps is Oracle
1. List Partition.
2. Range Partition.
3. Hash Partition.
RangePartitionSteps:
Existing table is here
ExistingTable.sql
Step1: EnableDBMS_REDEFINITIONforexistingtable
EXECDBMS_REDEFINITION.CAN_REDEF_TABLE('HR','EMPLOYEES');
Step2:Create Partitiontable, Partitiontableattached in the doc.
Range_Partition.txt
Step3:ChangeInitransvalueforPartition tableas perexistingtable
Alter Table HR.EMPLOYEES_REDEFInitrans 1;
Step 4: Start START_REDEF_TABLE forpartitiontable
EXECDBMS_REDEFINITION.START_REDEF_TABLE ('HR','EMPLOYEES','EMPLOYEES_REDEF');
Step 5: CreateUniqueIndex, primarykey,foreignkeyforthis partitiontable.
Unique_primary_foreign.sql
Check count of existing and partition table
select count(*) from EMPLOYEES_REDEF;
--107
select count(*) from EMPLOYEES;
--107
Now insert one row in employees table now checkcount EMPLOYEEStable
select count(*) from EMPLOYEES;
--108
But Still 107 rows in partition table
select count(*) from EMPLOYEES_REDEF;
--107
2. Step 6: FinishFINISH_REDEF_TABLE forpartitiontable
EXECDBMS_REDEFINITION.FINISH_REDEF_TABLE ('HR','EMPLOYEES','EMPLOYEES_REDEF');
Check count of existing and partition table
select count(*) from EMPLOYEES_REDEF;
--108
select count(*) from EMPLOYEES;
--108
Step 7: RowMovementenableanddropthe partitiontable
Alter table HR.EMPLOYEESenablerow movement;
DROP TABLE EMPLOYEES_REDEFcascadeconstraints;
Now checkstructure of existing employees table
After_partition.sql
For List and Hash Partition used same Steps, only differencepartition table create.
SampleList Partitiontable CreationScripts
Sample_list_partition.sql
SampleHashPartitiontableCreationScripts
Hash_Parttion.sql