You are on page 1of 2

HOW TO EXECUTE REORG ZOPIT EXERCISE

1. Use DB02 – Detail Analysis to check each partition size for ZOPIT

 DB02 – Database Performance : Tables and Indexes


 Detail Analysis - Memory Management : Tables and Indexes
 Enter Tablespace = PSAPZOPIT – (F6)
 Tables and Indexes : Analysis

Owner Object Type Tablespace KBytes Blocks Extents MaxExtents Next (K)
SAPECP ZOPIT0180 TABLE PART PSAPZOPIT 14,501,568 1,812,696 3,299 1- 0
SAPECP ZOPIT0061 TABLE PART PSAPZOPIT 610,304 76,288 874 1- 0

2. Use DB02 OR BRTOOLS – Check the current free space available in


PSAPZOPIT

 DB02 – Database Performance : Tables and Indexes


 Freespace statistics

Tablespace Freespace Fragments Max next Critical objects


Maximum/kb Maximum/kb Total/kb extent/kb now after reorg a. autoext

SYSTEM 185216 195008 3 1024 0 0 0


PSAPUNDO 2592640 39464896 1387 8192 0 0 0
PSAPTEMP 0 0 not calc. not calc. not calc. not calc. not calc.
PSAPECP 873408 31988480 1127 65536 0 0 0
PSAPZOPIT 182912 15996544 7729 65536 0 0 0

 Freespace statistics – History Of Tablespaces

Scale: Day Size (Kbyte) Free(Kbyte) Used (Kbyte) %-Used Tables/Indices Extents
Tablespace Total Chg/day Total Total Chg/day Total Chg Total Chg/day Total Chg/day

PSAPZOPIT 880,235,888 0 15,996,544 864,239,344 3,652,862 98 0 1,205 5 532,257 833

3. Ensure the free space in PSAPZOPIT is bigger than the ZOPIT partition you
want to reorg.

4. Use sqlplus to execute the reorg script for each station/partition. The reorg
scripts are in /home/ecpadm/reorg.

Example :-
% pg z0061.sql
set timing on;
spool z0061;

lock table zopit partition (zopit0061) in exclusive mode;

create table z0061 tablespace psapzopit parallel nologging as


select * from zopit partition (zopit0061);

alter table zopit exchange partition zopit0061 with table z0061


without validation;
commit;

alter index "ZOPIT~0" rebuild partition zopit0061 parallel nologging online;


alter index "ZOPIT~1" rebuild partition zopit0061 parallel nologging online;
alter index "ZOPIT~2" rebuild partition zopit0061 parallel nologging online;
alter index "ZOPIT~3" rebuild partition zopit0061 parallel nologging online;
alter index "ZOPIT~4" rebuild partition zopit0061 parallel nologging online;
alter index "ZOPIT~5" rebuild partition zopit0061 parallel nologging online;
alter index "ZOPIT~7" rebuild partition zopit0061 parallel nologging online;
alter index "ZOPIT~8" rebuild partition zopit0061 parallel nologging online;

exit;

Login : ecpadm

%cd /home/ecpadm/reorg
%sqlplus sapecp/<password>@ECP @z<SSSS>.sql

The reorg execution log will be created as /home/ecpadm/reorg/z<SSSS>.lst.

5. Check if the reorg station is ok by comparing the record counts as per following
example :-

%sqlplus sapecp/<password>@ECP

sql> select count(*) from zopit partition(zopit<SSSS>);

AND

sql> select count(*) from z<SSSS>;

OR

%sqlplus sapecp/<password>@ECP @c.sql <SSSS>

6. If the count above are the same, then drop table z<SSSS> as follows :-

%sqlplus sapecp/<password>@ECP

sql> drop table z<SSSS>;

7. Repeat step 2 to step 6.

You might also like