Get started with AnySQL utility -- chapter 2

    The "DESCRIBE" command in AnySQL tell you more information than SQL*Plus, as following, these information is useful for DBA:

ASQL> desc scott.emp

NO# NAME                      NULLABLE TYPE        
--- ------------------------- -------- ------------
  1 EMPNO                     NOT NULL NUMBER(4)  
  2 ENAME                              VARCHAR2(10)
  3 JOB                                VARCHAR2(9)
  4 MGR                                NUMBER(4)  
  5 HIREDATE                           DATE        
  6 SAL                                NUMBER(7,2)
  7 COMM                               NUMBER(7,2)
  8 DEPTNO                             NUMBER(2)  

TYPE  ISUNQ  INDEX_NAME       NO# COLUMN_NAME DESCEND
------ ------ --------------- --- ----------- -------
NORMAL UNIQUE PK_EMP            1 EMPNO       ASC    

PARTITIONED AVG_ROW_LEN NUM_ROWS BLOCKS EMPTY_BLOCKS
----------- ----------- -------- ------ ------------
NO      

    Before doing some DDL(Rename, Drop etc.), we should check the object dependencies of the underline object, will it invalid some triggers on other tables? with the "DEPEND" command, it will tell which objects it depended on and which objects depend on this object. If you get procedure or view compile failure, you could use this command to find out the root cause.

ASQL> DEPEND SYS.DBMS_SUMMARY

Reference:
TYPE         D_OWNER D_NAME           D_TYPE       DEPEND
------------ ------- ---------------- ------------ ------
PACKAGE BODY SYS     STANDARD         PACKAGE      HARD
PACKAGE      SYS     STANDARD         PACKAGE      HARD
PACKAGE BODY SYS     DBMS_SUMMARY     PACKAGE      HARD
PACKAGE BODY PUBLIC  DBMS_OLAP        SYNONYM      HARD
PACKAGE BODY SYS     DBMS_SUMREF_UTIL PACKAGE      HARD
PACKAGE BODY SYS     DBMS_SUMADVISOR  PACKAGE      HARD
PACKAGE BODY SYS     DBMS_OLAP        NON-EXISTENT HARD

Referenced By:
TYPE    R_OWNER R_NAME       R_TYPE       DEPEND
------- ------- ------------ ------------ ------
PACKAGE PUBLIC  DBMS_SUMMARY SYNONYM      HARD
PACKAGE PUBLIC  DBMS_OLAP    SYNONYM      HARD
PACKAGE SYS     DBMS_SUMMARY PACKAGE BODY HARD

    In my other tools or in STATSPACK, we always see a number called "hash value", use the following command to get the full SQL text:

ASQL> ora hash 3109775760

SELECT /* AnySQL */ SQL_TEXT "SQL Executing"
FROM V$SQLTEXT_WITH_NEWLINES
WHERE HASH_VALUE = TO_NUMBER(:1)
ORDER BY PIECE

    More features will be introduced later.

Post a comment

SCode:
Mail(*, but will not be displayed):
Home: