Friday, September 13, 2019

Analyze tables in oracle

C:\Users\rajam>sqlplus system/admin

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Sep 14 00:32:02 2019

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL>
SQL> SELECT table_name,
  2         num_rows,
  3         logging,
  4         last_analyzed
  5    FROM user_tables
  6   WHERE table_name = 'EMP';

TABLE_NAME                       NUM_ROWS LOG LAST_ANAL
------------------------------ ---------- --- ---------
EMP                                    14 YES 02-JUL-19

SQL> EXEC dbms_stats.gather_table_stats('SYSTEM','EMP',estimate_percent=>100,cascade=>true,degree=>4);

PL/SQL procedure successfully completed.

SQL> SELECT table_name,
  2         num_rows,
  3         logging,
  4         last_analyzed
  5    FROM user_tables
  6   WHERE table_name = 'EMP';

TABLE_NAME                       NUM_ROWS LOG LAST_ANAL
------------------------------ ---------- --- ---------
EMP                                    14 YES 14-SEP-19

SQL>

No comments:

Post a Comment