This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL> create table t as (select/*+ materialize */ decode(owner,'SYS','SYS','SYSTEM','SYSTEM','OTHERS') owner, object_type from dba_objects); | |
Table created. | |
SQL> explain plan for | |
2 select * | |
3 from t | |
4 pivot ( | |
5 count(*) for owner in ('SYS','SYSTEM','OTHERS') | |
6 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL> select to_char(systimestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
2 union all | |
3 select to_char(count(*)) from dba_objects,dba_tables | |
4 union all | |
5 select to_char(localtimestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
6 / | |
TO_CHAR(SYSTIMESTAMP,'DD.MM.YYYYHH24:MI: | |
---------------------------------------- | |
04.05.2023 11:13:14.432061 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
o.obj# , o.owner# , o.name , o.namespace, | |
o.type# , o.ctime , o.stime, o.status, | |
o.flags , o.oid$ , o.signature, | |
--o.dflcollid, | |
'type' d, | |
t.typecode,t.hashcode, | |
'coll', | |
c.* | |
,s.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL> @tests/patch_fm.sql | |
SQL> create table test(n,x, constraint test_pk primary key(n)) | |
2 as select level n, level x from dual connect by level<=100; | |
Table created. | |
SQL> set serverout on; | |
SQL> declare | |
2 res varchar2(4000); | |
3 begin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table T_BOP_DSCR_STD_dbg as | |
select | |
systimestamp tmp | |
,cast(null as varchar2(100)) bind_code | |
,s.sid, s.serial# | |
,t.* | |
from T_BOP_DSCR_STD t, v$session s | |
where 1=0; | |
create table T_BOP_DSCR_STD_dbg_trans | |
as select |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- more extended version is here: https://github.com/xtender/xt_scripts/blob/master/tops/top_by_sesstat.sql | |
var c refcursor; | |
col username for a30; | |
col program for a20 trunc; | |
col osuser for a20 trunc; | |
declare | |
v_stat1 sys.ku$_objnumpairlist; | |
v_stat2 sys.ku$_objnumpairlist; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set echo on; | |
create or replace type number_table as table of number; | |
/ | |
create or replace function get_nums(n int) return number_table | |
as | |
res number_table; | |
begin | |
res:=number_table(); | |
res.extend(n); | |
for x in 1..n loop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL Monitoring Report | |
SQL Text | |
------------------------------ | |
create index t1_i1 on t1(secondary) parallel 4 | |
Global Information | |
------------------------------ | |
Status : DONE | |
Instance ID : 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL> create table t | |
2 partition by range(RYEAR,RMONTH) | |
3 ( | |
4 partition p1 values less than (2021,1) | |
5 ,partition p2 values less than (2022,1) | |
6 ,partition p3 values less than (2023,1) | |
7 ,partition p4 values less than (2024,1) | |
8 ,partition pm values less than (maxvalue,maxvalue) | |
9 ) | |
10 as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL> create table tpart (a,b) | |
2 partition by range(a) | |
3 ( | |
4 partition p1 values less than (1), | |
5 partition p2 values less than (2), | |
6 partition p3 values less than (3) | |
7 ) | |
8 as select mod(n,3), n from xmltable('1 to 1000' columns n for ordinality); | |
Table created. |