How to count Primavera P6 ADMUSER tables in Oracle
Counting ADMUSER table is helpful to find which tables holds large number of records. By this, we can truncate temp tables, and optimize other costly tables like remove wasted space, gather stats to improve the performance of Primavera P6 .
The below query list the number of records in each table in a particular schema. In this case, we are going to login as ADMUSER
Note: Make sure you have enabled the DBMS OUTPUT . If you run it from SQL Developer then you can enable it by Go to View Menu , Select DBMS Output and Click the GREEN PLUS icon ,
DECLARE MYCOUNT1 NUMBER; BEGIN DBMS_OUTPUT.ENABLE; FOR T IN (SELECT TABLE_NAME FROM USER_TABLES ) LOOP EXECUTE IMMEDIATE 'SELECT count(*) FROM ' || T.table_name||'' INTO MYCOUNT1; DBMS_OUTPUT.PUT_LINE(T.table_name || ' = ' || MYCOUNT1 ); END LOOP; END;