1 PACKAGE dbms_sqltune_util2 AUTHID CURRENT_USER AS
2
3 ------------------------------ resolve_username -----------------------------
4 -- NAME:
5 -- resolve_username
6 --
7 -- DESCRIPTION:
8 -- When passed a NULL name, this function returns the current schema
9 -- owner. Otherwise, it returns the name passed in, after validating
10 -- it.
11 --
12 -- PARAMETERS:
13 -- user_name (IN) - the name of the user to resolve
14 -- validate (IN) - true/false validate user name if one is given
15 -- con_id (IN) - id of container in which to resolve user_name
16 --
17 -- RETURN:
18 -- VOID
19 -----------------------------------------------------------------------------
20 FUNCTION resolve_username(user_name IN VARCHAR2,
21 validate IN BOOLEAN := TRUE,
22 con_id IN NUMBER := NULL)
23 RETURN VARCHAR2;
24
25 -------------------------------- validate_snapshot --------------------------
26 -- NAME:
27 -- validate_snapshot
28 --
29 -- DESCRIPTION:
30 -- This function checks whether a snapshot id interval is valid.
31 -- It raises an error if passed an invalid interval.
32 --
33 -- PARAMETERS:
34 -- begin_snap (IN) - begin snapshot id
35 -- end_snap (IN) - end snapshot id
36 -- incl_bid (IN) - TRUE: fully-inclusive [begin_snap, end_snap]
37 -- FALSE: half-inclusive (begin_snap, end_snap]
38 --
39 -- RETURN:
40 -- VOID
41 -----------------------------------------------------------------------------
42 PROCEDURE validate_snapshot(
43 begin_snap IN NUMBER,
44 end_snap IN NUMBER,
45 incl_bid IN BOOLEAN := FALSE);
46
47 --------------------------- sql_binds_ntab_to_varray ------------------------
48 -- NAME:
49 -- sql_binds_ntab_to_varray
50 --
51 -- DESCRIPTION:
52 -- This function converts the sql binds data from the nested table stored
53 -- in the staging table on an unpack/pack to the varray type used in the
54 -- SQLSET_ROW. It is called by the unpack_stgtab_sqlset function since it
55 -- needs to pass binds as a VARRAY to the load_sqlset function
56 --
57 -- PARAMETERS:
58 -- binds_nt (IN) - list of binds for a single statement, in the
59 -- sql_binds nested table type
60 --
61 -- RETURN:
62 -- Corresponding varray type (sql_binds_varray) to the input, which is
63 -- an ordered list of bind values, of type ANYDATA.
64 -- If given null as input this function returns null.
65 --
66 -----------------------------------------------------------------------------
67 FUNCTION sql_binds_ntab_to_varray(binds_ntab IN SQL_BIND_SET)
68 RETURN SQL_BINDS;
69
70 ------------------------- sql_binds_varray_to_ntab -------------------------
71 -- NAME:
72 -- sql_binds_varray_to_ntab
73 --
74 -- DESCRIPTION:
75 -- This function converts the sql binds data from a VARRAY as it exists
76 -- in SQLSET_ROW into a nested table that can be stored in the staging
77 -- table.
78 -- It is called by pack_stgtab_sqlset as it inserts into the staging
79 -- table from the output of a call to select_sqlset.
80 --
81 -- PARAMETERS:
82 -- binds_varray (IN) - list of binds for a single statement, in the
83 -- sql_binds VARRAY type
84 --
85 -- RETURN:
86 -- Corresponding nested table type (sql_bind_set) to the input, which is
87 -- a list of (position, value) pairs for the information in STMT_BINDS.
88 -- If given null as input this function returns null.
89 --
90 -----------------------------------------------------------------------------
91 FUNCTION sql_binds_varray_to_ntab(binds_varray IN SQL_BINDS)
92 RETURN SQL_BIND_SET;
93
94 ----------------------------------- check_priv ------------------------------
95 -- NAME:
96 -- check_priv
97 --
98 -- DESCRIPTION:
99 -- This function does a callout into the kernel to check for the given
100 -- system privilege. It returns TRUE or FALSE based on whether the
101 -- current user has the privilege enabled. This replaces the old-style
102 -- privilege detection through SQL with the added benefit that it allows
103 -- auditing of the privilege. This function is just a wrapper around
104 -- kzpcap. This is used for the ADVISOR, ADMINISTER SQL TUNING SET,
105 -- and ADMINISTER ANY SQL TUNING SET privileges.
106 --
107 -- NOTE that this function should only be used when checking privileges
108 -- from an INVOKER rights package. In the callout function we do not
109 -- switch the user prior to calling kzpcap, so we rely on the proper
110 -- security context already being in effect prior to calling this
111 -- function. If you call it after switching into a DEFINER rights
112 -- package, it will end up checking if SYS has the priv, not the user.
113 -- If you have any questions about its proper use, please consult the
114 -- file owner.
115 --
116 -- PARAMETERS:
117 -- priv (IN) - privilege name
118 --
119 -- RETURN:
120 -- TRUE if priv is enabled, FALSE otherwise
121 --
122 -----------------------------------------------------------------------------
123 FUNCTION check_priv(priv IN VARCHAR2)
124 RETURN BOOLEAN;
125
126 ------------------------------- resolve_exec_name ---------------------------
127 -- NAME:
128 -- resolve_exec_name
129 --
130 -- DESCRIPTION:
131 -- This function validates the execution name of a SPA task to ensure
132 -- it was a Compare Performance (type id 5) while if NULL was supplied,
133 -- it returns the name of the most recent compare execution for the
134 -- given SPA task
135 --
136 --
137 -- PARAMETERS:
138 -- task_name (IN) - name of the SPA task whose execution we
139 -- are examining
140 -- compare_exec_name (IN/OUT) - execution name
141 --
142 -- RETURN:
143 -- TRUE if exec_name was valid or we found a valid compare execution
144 -- name of the given SPA task, FALSE otherwise
145 --
146 -----------------------------------------------------------------------------
147 FUNCTION resolve_exec_name(
148 task_name IN VARCHAR2,
149 task_owner IN VARCHAR2,
150 exec_name IN OUT VARCHAR2)
151 RETURN NUMBER;
152
153 ------------------------------ get_timing_info ------------------------------
154 -- NAME:
155 -- get_timing_info
156 --
157 -- DESCRIPTION:
158 -- This function allows one to get elapsed and CPU timing information
159 -- for a section of PL/SQL code
160 --
161 -- PARAMETERS:
162 -- phase (IN) - When called: 0 for start, 1 for end
163 -- elapsed_time (IN/OUT) - When "phase" is 0, OUT parameter storing
164 -- current timestamp. When "phase" is 1, used
165 -- both as IN/OUT to return elpased time.
166 -- cpu_time (IN/OUT) - When "phase" is 0, OUT parameter storing
167 -- current cpu time. When "phase" is 1, used
168 -- both as IN/OUT to return cpu time.
169 --
170 -- DESCRIPTION
171 -- Use this procedure to measure the elapsed/cpu time of a region of
172 -- code:
173 -- get_timing_info(0, elapsed, cpu_time);
174 -- ...
175 -- get_timing_info(1, elapsed, cpu_time);
176 --
177 -- RETURN:
178 -- None
179 --
180 ----------------------------------------------------------------------------
181 PROCEDURE get_timing_info(
182 phase IN BINARY_INTEGER,
183 elapsed IN OUT NUMBER,
184 cpu IN OUT NUMBER);
185
186 END dbms_sqltune_util2;