Beware of explain plan in combination with alter session set current_schema

The situation: do an explain plan for a SQL which contains table names without schema qualifiers, which reside in a schema other than my own. To explain the SQL without any modifications, alter session set current_schema was used. connect me@db alter session set current_schema=other explain plan for select this, that from there ; select * …

Beware of explain plan in combination with alter session set current_schema weiterlesen

Advertisements

SQL to get the redo volume historically

Redo volume is related to archive log volume, but not identical. Here is and SQL to get the actual cumulated redo sizes from the AWR. select * from ( SELECT TO_CHAR(begin_interval_time, 'yyyymmddhh24mi') tm, s2.instance_number, (s2.value - s1.value)/1024/1024 redo_size FROM dba_hist_sysstat s1 , dba_hist_sysstat s2, dba_hist_snapshot sn WHERE s1.stat_name = 'redo size' and s2.stat_name = 'redo …

SQL to get the redo volume historically weiterlesen

How to estimate the parallel degree for historical SQL

In analysis of SQL stats,  execution times are cumulated for all parallel servers. This makes it difficult to derive the correct execution times from the AWR. Create some test data: The test script:   Output:   Though the SQL runtime was 1,27s, the accumulated elapsed time in v$sqlstats is 17,07s, due to the fact that all parallel …

How to estimate the parallel degree for historical SQL weiterlesen

How to use booleans in SQL and avoid ORA-00904

Try this: select true from dual; ORA-00904: "TRUE": ungültiger Bezeichner The reason behind this behavior is that TRUE and FALSE are only available in PL/SQL, not in SQL. Booleans are simply not usable in SQL queries. How to work around this limitation? The SYS.DIUTIL package's BOOL_TO_INT() function provides a hint. Let's see. declare   n number;   v_true …

How to use booleans in SQL and avoid ORA-00904 weiterlesen