Starting with version 10gR2 you can use DBMS_SPACE.CREATE_INDEX_COST
DBMS_SPACE.CREATE_INDEX_COST ( ddl IN VARCHAR2, used_bytes OUT NUMBER, alloc_bytes OUT NUMBER, plan_table IN VARCHAR2 DEFAULT NULL);
In the docs: "This procedure determines the cost of creating an index in an existing table. Input is the DDL statement that will be used to create the index. The procedure will display the storage needed to create the index."
See https://docs.oracle.com/database/121/ARPLS/d_space.htm#ARPLS68101
Example (also in sqlfiddle ):
DECLARE ub NUMBER; ab NUMBER; BEGIN DBMS_SPACE.CREATE_INDEX_COST ( ddl => 'CREATE INDEX x_1 ON t1 (a,b,c) TABLESPACE users', used_bytes => ub, alloc_bytes => ab ); DBMS_OUTPUT.PUT_LINE('Used MBytes: ' || ROUND(ub/1024/1024)); DBMS_OUTPUT.PUT_LINE('Alloc MBytes: ' || ROUND(ab/1024/1024)); END; /
Output:
Used MBytes: 1 Alloc MBytes: 2
Gwu
source share