oracle.rst
changeset 1490 db9fb38505e1
parent 1486 f3be7476145d
child 1494 f7e956de0cd7
equal deleted inserted replaced
1481:01eecd0d108e 1490:db9fb38505e1
    58 
    58 
    59 Используемое пространство таблиц::
    59 Используемое пространство таблиц::
    60 
    60 
    61   select distinct tablespace_name from user_tables;
    61   select distinct tablespace_name from user_tables;
    62 
    62 
       
    63 Profiling.
       
    64 ==========
       
    65 
       
    66 Timing info about last queries::
       
    67 
       
    68   select LAST_LOAD_TIME, ELAPSED_TIME, MODULE, SQL_TEXT elasped from v$sql
       
    69     order by LAST_LOAD_TIME desc
       
    70 
       
    71 Improved version of above code::
       
    72 
       
    73   column LAST_LOAD_TIME format a20;
       
    74   column TIME format a20;
       
    75   column MODULE format a10;
       
    76   column SQL_TEXT format a60;
       
    77 
       
    78   set autotrace off;
       
    79   set timing off;
       
    80 
       
    81   select * from (
       
    82     select LAST_LOAD_TIME, to_char(ELAPSED_TIME/1000, '999,999,999.000') || ' ms' as TIME, MODULE, SQL_TEXT from SYS."V_\$SQL"
       
    83       where SQL_TEXT like '%BATCH_BRANCHES%'
       
    84       order by LAST_LOAD_TIME desc
       
    85     ) where ROWNUM <= 5;
       
    86 
       
    87 In SQL/Plus::
       
    88 
       
    89   SET TIMING ON;
       
    90   -- do stuff
       
    91   SET TIMING OFF;
       
    92 
       
    93 or::
       
    94 
       
    95   set serveroutput on
       
    96   variable n number
       
    97   exec :n := dbms_utility.get_time;
       
    98   select ......
       
    99   exec dbms_output.put_line( (dbms_utility.get_time-:n)/100) || ' seconds....' );
       
   100 
       
   101 See:
       
   102 
       
   103   http://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2113.htm
       
   104                 $SQL lists statistics on shared SQL area without the GROUP BY
       
   105                 clause.
       
   106 
       
   107 Last table modification time.
       
   108 =============================
       
   109 ::
       
   110 
       
   111   select max(scn_to_timestamp(ora_rowscn)) from TBL;
       
   112 
       
   113   select timestamp from all_tab_modifications where table_owner = 'OWNER';
       
   114   select timestamp from all_tab_modifications where table_name = 'TABLE';
       
   115 
       
   116 List of Oracle Reserved Words.
       
   117 ==============================
       
   118 
       
   119  * http://docs.oracle.com/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm