-
Notifications
You must be signed in to change notification settings - Fork 0
/
CREATE_SQLSET.sql
63 lines (50 loc) · 1.24 KB
/
CREATE_SQLSET.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
SET SERVEROUT ON
SET PAGESIZE 1000
SET LONG 2000000
SET LINESIZE 400
BEGIN
DBMS_SQLTUNE.CREATE_SQLSET(sqlset_name => 'STS_2dtrsuzsp4c7z');
END;
/
DECLARE
cur sys_refcursor;
BEGIN
open cur for
select value(p) from table(dbms_sqltune.select_workload_repository(
begin_snap => 63804,
end_snap => 63811,
basic_filter => 'sql_id IN (''2dtrsuzsp4c7z'') AND plan_hash_value = ''736138582''')) p;
dbms_sqltune.load_sqlset('STS_2dtrsuzsp4c7z', cur);
close cur;
END;
/
/*
select value(p) from table(dbms_sqltune.select_workload_repository(
begin_snap => 63804,
end_snap => 12301,
basic_filter => 'sql_id IN (''2dtrsuzsp4c7z'') AND plan_hash_value = ''736138582''')) p;
*/
SELECT *
--INTO stmt_count
FROM dba_sqlset
WHERE name = 'STS_2dtrsuzsp4c7z';
DECLARE
my_plans PLS_INTEGER;
BEGIN
my_plans := DBMS_SPM.LOAD_PLANS_FROM_SQLSET(
sqlset_name => 'STS_2dtrsuzsp4c7z',
fixed => 'YES');
END;
/
declare
my_int pls_integer;
begin
my_int := dbms_spm.load_plans_from_sqlset (
sqlset_name => 'STS_2dtrsuzsp4c7z',
basic_filter => 'plan_hash_value=''736138582''',
sqlset_owner => 'DBACSI',
fixed => 'YES',
enabled => 'YES');
DBMS_OUTPUT.PUT_line(my_int);
end;
/