2026-03-12 20:23:15

This commit is contained in:
root
2026-03-12 21:23:47 +01:00
parent eab4b36eca
commit 93039b8489
3332 changed files with 699614 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
SET ECHO ON
-- ALTER SESSION SET "_serial_direct_read"=ALWAYS;
-- ALTER SESSION SET "_cell_storidx_mode"=EVA;
SELECT
/*+ LEADING(c)
NO_SWAP_JOIN_INPUTS(o)
INDEX_RS_ASC(c(cust_email))
FULL(o)
MONITOR
*/
*
FROM
soe.customers c
, soe.orders o
WHERE
o.customer_id = c.customer_id
AND c.cust_email = 'bill.jones@yahoo.com'
--AND c.cust_email = 'anthony.pena@bellsouth.com'
/
SET ECHO OFF

View File

@@ -0,0 +1,24 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
SET ECHO ON
ALTER SESSION SET "_serial_direct_read"=ALWAYS;
ALTER SESSION SET "_cell_storidx_mode"=EVA;
SELECT
/*+ LEADING(c)
NO_SWAP_JOIN_INPUTS(o)
FULL(o)
PARALLEL(2)
MONITOR
*/
*
FROM
soe.customers2 c
, soe.orders2 o
WHERE
o.customer_id = c.customer_id
AND c.cust_email = 'rico@mbtuhkbv.com'
/
SET ECHO OFF

View File

@@ -0,0 +1,28 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
SET ECHO ON
-- ALTER SESSION SET "_serial_direct_read"=ALWAYS;
-- ALTER SESSION SET "_cell_storidx_mode"=EVA;
SELECT
/*+ LEADING(c)
NO_SWAP_JOIN_INPUTS(o)
FULL(c)
FULL(o)
MONITOR
*/
*
FROM
soe.customers c
, soe.orders o
WHERE
o.customer_id = c.customer_id
--AND c.cust_email = 'florencio@ivtboge.com'
AND c.cust_email = 'anthony.pena@bellsouth.com'
/
SET ECHO OFF
-- 11.2.0.4 estrella@socxankh.com

View File

@@ -0,0 +1,62 @@
CellCLI> ALTER CELL SHUTDOWN SERVICES CELLSRV;
Stopping CELLSRV services...
The SHUTDOWN of CELLSRV services was successful.
CellCLI>
CellCLI>
CellCLI> CALIBRATE;
Calibration will take a few minutes...
Aggregate random read throughput across all hard disk LUNs: 1103 MBPS
Aggregate random read throughput across all flash disk LUNs: 3964.55 MBPS
Aggregate random read IOs per second (IOPS) across all hard disk LUNs: 1716
Aggregate random read IOs per second (IOPS) across all flash disk LUNs: 98216
Controller read throughput: 1259.65 MBPS
Calibrating hard disks (read only) ...
LUN 0_0 on drive [16:0 ] random read throughput: 94.26 MBPS, and 145 IOPS
LUN 0_1 on drive [16:1 ] random read throughput: 100.10 MBPS, and 142 IOPS
LUN 0_10 on drive [16:10 ] random read throughput: 99.80 MBPS, and 155 IOPS
LUN 0_11 on drive [16:11 ] random read throughput: 96.93 MBPS, and 149 IOPS
LUN 0_2 on drive [16:2 ] random read throughput: 99.18 MBPS, and 146 IOPS
LUN 0_3 on drive [16:3 ] random read throughput: 100.45 MBPS, and 149 IOPS
LUN 0_4 on drive [16:4 ] random read throughput: 98.50 MBPS, and 148 IOPS
LUN 0_5 on drive [16:5 ] random read throughput: 98.20 MBPS, and 147 IOPS
LUN 0_6 on drive [16:6 ] random read throughput: 99.69 MBPS, and 147 IOPS
LUN 0_7 on drive [16:7 ] random read throughput: 102.36 MBPS, and 145 IOPS
LUN 0_8 on drive [16:8 ] random read throughput: 97.97 MBPS, and 147 IOPS
LUN 0_9 on drive [16:9 ] random read throughput: 99.56 MBPS, and 140 IOPS
Calibrating flash disks (read only, note that writes will be significantly slower) ...
LUN 1_0 on drive [FLASH_1_0] random read throughput: 266.07 MBPS, and 18278 IOPS
LUN 1_1 on drive [FLASH_1_1] random read throughput: 262.56 MBPS, and 18235 IOPS
LUN 1_2 on drive [FLASH_1_2] random read throughput: 260.15 MBPS, and 18227 IOPS
LUN 1_3 on drive [FLASH_1_3] random read throughput: 69.84 MBPS, and 17997 IOPS
LUN 2_0 on drive [FLASH_2_0] random read throughput: 186.16 MBPS, and 18737 IOPS
LUN 2_1 on drive [FLASH_2_1] random read throughput: 181.72 MBPS, and 18360 IOPS
LUN 2_2 on drive [FLASH_2_2] random read throughput: 265.29 MBPS, and 19061 IOPS
LUN 2_3 on drive [FLASH_2_3] random read throughput: 265.49 MBPS, and 19221 IOPS
LUN 4_0 on drive [FLASH_4_0] random read throughput: 264.22 MBPS, and 18885 IOPS
LUN 4_1 on drive [FLASH_4_1] random read throughput: 261.84 MBPS, and 18654 IOPS
LUN 4_2 on drive [FLASH_4_2] random read throughput: 264.88 MBPS, and 18800 IOPS
LUN 4_3 on drive [FLASH_4_3] random read throughput: 263.07 MBPS, and 18798 IOPS
LUN 5_0 on drive [FLASH_5_0] random read throughput: 264.07 MBPS, and 19350 IOPS
LUN 5_1 on drive [FLASH_5_1] random read throughput: 261.01 MBPS, and 19313 IOPS
LUN 5_2 on drive [FLASH_5_2] random read throughput: 261.74 MBPS, and 19395 IOPS
LUN 5_3 on drive [FLASH_5_3] random read throughput: 262.30 MBPS, and 19361 IOPS
Found some bad LUNs, running tests sequentially to identify the bad LUNs...
LUN 1_3 on drive [FLASH_1_3] random read throughput: 262.25 MBPS, and 20076 IOPS
LUN 2_0 on drive [FLASH_2_0] random read throughput: 265.61 MBPS, and 20085 IOPS
LUN 2_1 on drive [FLASH_2_1] random read throughput: 262.68 MBPS, and 20174 IOPS
CALIBRATE results are within an acceptable range.
CALIBRATE stress test is now running...
Calibration has finished.
CellCLI>
CellCLI> ALTER CELL STARTUP SERVICES CELLSRV;
Starting CELLSRV services...
The STARTUP of CELLSRV services was successful.

View File

@@ -0,0 +1,34 @@
SQL> @asm/asm_imbalance
Percent Minimum
Percent Disk Size Percent Disk Diskgroup
Diskgroup Imbalance Variance Free Count Redundancy
------------------------------ --------- --------- ------- ----- ----------
DATA 8.2 .0 90.9 32 NORMAL
DBFS_DG 10.9 .0 48.8 28 NORMAL
RECO .5 .0 91.7 33 NORMAL
SQL>
metalink script:
SYS:+ASM1>@asm_imbalance
Columns Described in Script Percent Minimum
Percent Disk Size Percent Disk Diskgroup
Diskgroup Name Imbalance Varience Free Count Redundancy
------------------------------ --------- --------- ------- ----- ----------
DATA 8.2 .0 90.9 32 NORMAL
RECO .5 .0 91.7 33 NORMAL
DBFS_DG 10.9 .0 48.8 28 NORMAL
Columns Described in Script Partner Partner Inactive
Count Space % Failgroup Partnership
Diskgroup Name Imbalance Imbalance Count Count
------------------------------ --------- --------- --------- -----------
DATA 1 12.5 3 0
DBFS_DG 1 12.5 3 0
RECO 0 .0 3 0

View File

@@ -0,0 +1,76 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
--CREATE BIGFILE TABLESPACE tanel_demo_auto DATAFILE SIZE 100M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO;
--CREATE BIGFILE TABLESPACE tanel_demo_small DATAFILE SIZE 100M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K SEGMENT SPACE MANAGEMENT AUTO;
--CREATE BIGFILE TABLESPACE tanel_demo_medium DATAFILE SIZE 100M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL UNIFORM SIZE 8M SEGMENT SPACE MANAGEMENT AUTO;
--CREATE BIGFILE TABLESPACE tanel_demo_large DATAFILE SIZE 100M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64M SEGMENT SPACE MANAGEMENT AUTO;
ALTER SESSION SET parallel_force_local = TRUE;
DROP TABLE t_fc_insert PURGE;
ALTER TABLESPACE tanel_demo_auto RESIZE 100M;
CREATE TABLE t_fc_insert TABLESPACE tanel_demo_auto STORAGE (CELL_FLASH_CACHE KEEP) AS
SELECT * FROM tanel.sales
WHERE 1=0;
ALTER SESSION ENABLE PARALLEL DML; -- otherwise the INSERT part will be serial, done by QC
VAR snapper REFCURSOR
VAR begin_snap_id NUMBER
VAR end_snap_id NUMBER
EXEC :begin_snap_id := exasnap.begin_snap;
@snapper4 all,begin 1 1 &mysid
INSERT /*+ APPEND MONITOR PARALLEL(8) */ INTO t_fc_insert SELECT * FROM tanel.sales;
COMMIT;
@snapper4 all,end 1 1 &mysid
EXEC :end_snap_id := exasnap.end_snap;
@xp &mysid
SELECT * FROM TABLE(exasnap.display_snap(:begin_snap_id, :end_snap_id, '%'));
-- different caching options
DROP TABLE t_cached PURGE;
DROP TABLE t_default_cached PURGE;
DROP TABLE t_not_cached PURGE;
DROP TABLE t_small_extents;
CREATE TABLE t_cached NOPARALLEL TABLESPACE tanel_demo_auto STORAGE (cell_flash_cache KEEP) AS SELECT * FROM sales;
CREATE TABLE t_default_cached NOPARALLEL TABLESPACE tanel_demo_auto STORAGE (cell_flash_cache DEFAULT) AS SELECT * FROM sales;
CREATE TABLE t_not_cached PARALLEL 16 TABLESPACE tanel_demo_auto STORAGE (cell_flash_cache NONE) AS SELECT * FROM sales;
CREATE TABLE t_small_extents PARALLEL 16 TABLESPACE tanel_demo_small STORAGE (CELL_FLASH_CACHE DEFAULT) AS SELECT * FROM sales;
-- cell commands
-- iostat -xm 5 | egrep -v "sd.[0-9]|^md"
-- lsscsi
-- DESCRIBE FLASHCACHECONTENT
-- cachedKeepSize
-- cachedSize
-- dbID
-- dbUniqueName
-- hitCount
-- hoursToExpiration
-- missCount
-- objectNumber
-- tableSpaceNumber
-- LIST FLASHCACHECONTENT ATTRIBUTES ALL;
-- dcli -l root -g ~/x2cells "cellcli -e 'LIST FLASHCACHECONTENT ATTRIBUTES cachedKeepSize,cachedSize,dbID,dbUniqueName,hitCount,missCount,objectNumber,tableSpaceNumber'" | sed 's/:/ /' > fc.xls
-- cachedKeepSize: 0
-- cachedSize: 1048576
-- dbID: 1538629110
-- dbUniqueName: DEMO
-- hitCount: 103840
-- missCount: 4
-- objectNumber: 4294967294
-- tableSpaceNumber: 0

View File

@@ -0,0 +1,15 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
CREATE OR REPLACE FUNCTION get_cust_name (id IN NUMBER) RETURN VARCHAR2
AUTHID CURRENT_USER
AS
n VARCHAR2(1000);
BEGIN
SELECT /*+ FULL(c) */ cust_first_name||' '||cust_last_name INTO n
FROM soe.customers c
WHERE customer_id = id;
RETURN n;
END;
/

View File

@@ -0,0 +1,68 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
CREATE TABLE sales_part
PARTITION BY RANGE (time_id) (
PARTITION Y1998 VALUES LESS THAN (DATE'1999-01-01')
, PARTITION Y1999 VALUES LESS THAN (DATE'2000-01-01')
, PARTITION Y2000 VALUES LESS THAN (DATE'2001-01-01')
, PARTITION Y2001 VALUES LESS THAN (MAXVALUE)
)
TABLESPACE tanel_large
PARALLEL 32
AS SELECT * FROM sales_100g
/
ALTER TABLE sales_part NOPARALLEL;
EXEC DBMS_STATS.GATHER_TABLE_STATS(user, 'SALES_PART', degree=>16);
CREATE TABLE sales_part_query_high
PARTITION BY RANGE (time_id) (
PARTITION Y1998 VALUES LESS THAN (DATE'1999-01-01')
, PARTITION Y1999 VALUES LESS THAN (DATE'2000-01-01')
, PARTITION Y2000 VALUES LESS THAN (DATE'2001-01-01')
, PARTITION Y2001 VALUES LESS THAN (MAXVALUE)
)
TABLESPACE tanel_large
COMPRESS FOR QUERY HIGH
PARALLEL 32
AS SELECT * FROM sales_100g
/
ALTER TABLE sales_part_query_high NOPARALLEL;
EXEC DBMS_STATS.GATHER_TABLE_STATS(user, 'SALES_PART_QUERY_HIGH', degree=>16);
alter session set "_fix_control"='6941515:ON';
CREATE TABLE sales_part_fix_6941515
PARTITION BY RANGE (time_id) (
PARTITION Y1998 VALUES LESS THAN (DATE'1999-01-01')
, PARTITION Y1999 VALUES LESS THAN (DATE'2000-01-01')
, PARTITION Y2000 VALUES LESS THAN (DATE'2001-01-01')
, PARTITION Y2001 VALUES LESS THAN (MAXVALUE)
)
TABLESPACE tanel_large
PARALLEL 32
AS SELECT * FROM sales_100g
/
ALTER TABLE sales_part_fix_6941515 NOPARALLEL;
CREATE TABLE sales_part_query_high_fix
PARTITION BY RANGE (time_id) (
PARTITION Y1998 VALUES LESS THAN (DATE'1999-01-01')
, PARTITION Y1999 VALUES LESS THAN (DATE'2000-01-01')
, PARTITION Y2000 VALUES LESS THAN (DATE'2001-01-01')
, PARTITION Y2001 VALUES LESS THAN (MAXVALUE)
)
TABLESPACE tanel_large
COMPRESS FOR QUERY HIGH
PARALLEL 32
AS SELECT * FROM sales_100g
/
ALTER TABLE sales_part_query_high_fix NOPARALLEL;
EXEC DBMS_STATS.GATHER_TABLE_STATS(user, 'SALES_PART_QUERY_HIGH_FIX', degree=>16);

View File

@@ -0,0 +1,44 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
CREATE TABLE row_filtering_test (id NUMBER, c CHAR(1000), vc VARCHAR2(1000));
INSERT /*+ APPEND */ INTO row_filtering_test
SELECT rownum, TO_CHAR(rownum), TO_CHAR(rownum)
FROM
(SELECT 1 FROM dual CONNECT BY LEVEL <= 1000)
, (SELECT 1 FROM dual CONNECT BY LEVEL <= 1000)
/
-- CREATE TABLE row_filtering_test AS
-- SELECT rownum r, LPAD('x',1000,'x') c1
-- FROM
-- (SELECT 1 FROM dual CONNECT BY LEVEL <= 1000)
-- , (SELECT 1 FROM dual CONNECT BY LEVEL <= 1000)
-- /
--
@gts row_filtering_test
ALTER SESSION SET "_serial_direct_read"=ALWAYS;
--VAR snapper REFCURSOR
--@snapper4 stats,begin 1 1 &mysid
SELECT /*+ MONITOR */ COUNT(*) FROM row_filtering_test WHERE id <= 500000;
SELECT /*+ MONITOR */ COUNT(*) FROM row_filtering_test WHERE id <= (SELECT 500000 FROM dual);
--@snapper4 stats,end 1 1 &mysid
@xp &mysid
CREATE TABLE row_filtering_helper (v NUMBER);
INSERT INTO row_filtering_helper VALUES (500000);
COMMIT;
SELECT /*+ MONITOR */ COUNT(*) FROM row_filtering_test WHERE r <= (SELECT v FROM row_filtering_helper);
SELECT /*+ MONITOR */ COUNT(*) FROM row_filtering_test WHERE id <= 500000 AND c = vc;

View File

@@ -0,0 +1,28 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
SELECT /*+ MONITOR FULL(o) FULL(oi) FULL(c) NO_PARALLEL PX_JOIN_FILTER(oi) t2 */
c.customer_id
, c.cust_first_name ||' '||c.cust_last_name
, c.credit_limit
, MAX(oi.unit_price * oi.quantity) avg_order_total
FROM
soe.orders o
, soe.order_items oi
, soe.customers c
WHERE
-- join conditions
c.customer_id = o.customer_id
AND o.order_id = oi.order_id
-- constant filter conditions
AND c.nls_territory LIKE 'aaaa%'
AND o.order_mode = 'online'
AND o.order_status = 5
GROUP BY
c.customer_id
, c.cust_first_name ||' '||c.cust_last_name
, c.credit_limit
HAVING
MAX(oi.unit_price * oi.quantity) > c.credit_limit * 3
/

View File

@@ -0,0 +1,24 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
-- the small_orders table below is a table with one order only (for demo purposes,
-- so that scanning the large orders_table wouldn't affect measurements). The idea
-- is to demonstrate that even without any direct filter predicates against the "fact"
-- table ORDER_ITEMS, the bloom filter min/max values can also be used for avoiding IO
-- with storage indexes.
--
-- You can create your SMALL_ORDERS table (from SwingBench Order Entry SOE schema):
-- CREATE TABLE soe.small_orders AS SELECT * FROM soe.orders WHERE rownum = 1;
--
SELECT /*+ MONITOR LEADING(o) FULL(o) FULL(oi) PARALLEL(4) PX_JOIN_FILTER(oi) */
o.*
, oi.*
FROM
soe.small_orders o -- one row only
, soe.order_items oi
WHERE
-- join conditions
o.order_id = oi.order_id
/

View File

@@ -0,0 +1,28 @@
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
SELECT /*+ MONITOR LEADING(c,o,oi) FULL(c) INDEX(o) */
c.customer_id
, c.cust_first_name ||' '||c.cust_last_name
, c.credit_limit
, MAX(oi.unit_price * oi.quantity) avg_order_total
FROM
soe.orders o
, soe.order_items oi
, soe.customers c
WHERE
-- join conditions
c.customer_id = o.customer_id
AND o.order_id = oi.order_id
-- constant filter conditions
AND c.nls_territory LIKE 'a%'
AND o.order_mode = 'online'
AND o.order_status = 5
GROUP BY
c.customer_id
, c.cust_first_name ||' '||c.cust_last_name
, c.credit_limit
HAVING
MAX(oi.unit_price * oi.quantity) > c.credit_limit * 2
/