Oracle Database 26ai will be available on generic Linux platforms in January and soon on AIX and Windows
Purpose
Sqltune internal utility procedures and functions that do not access dictionary objects. Some of these utilities are called as part of upgrade and downgrade scripts.
AUTHID
DEFINER
Constants
Name
Data Type
Value
Substitution Patterns
PAT_BEG
VARCHAR2(11)
'$#CDB#$MT1$'
PAT_END
VARCHAR2(11)
$#CDB#$MT2$'
Data Types
-- This record represents a remote context with db link to a remote db.
-- The remote context is required when executing a remote query.
TYPE sqltune_remote_ctx IS RECORD (
db_link_to VARCHAR2(4000) := NULL); -- db link to a remote db
-- global variables for remote contexts
sqlt_rmt_ctx sqltune_remote_ctx;
Dependencies
DBMS_ADDM
DBMS_SQLTUNE_INTERNAL
PRVT_ADVISOR
DBMS_ASSERT
DBMS_SQLTUNE_LIB
PRVT_AWRV_METADATA
DBMS_AUTO_INDEX_INTERNAL
DBMS_SQLTUNE_UTIL1
PRVT_AWR_VIEWER
DBMS_PERF
DBMS_STATS_INTERNAL
PRVT_REPORT_TAGS
DBMS_SMB
DBMS_SWAT_VER_INTERNAL
PRVT_SQLADV_INFRA
DBMS_SQLDIAG
DBMS_SYS_ERROR
PRVT_WORKLOAD
DBMS_SQLHIST
DBMS_XPLAN
SQL_BIND
DBMS_SQLPA
PRVTEMX_DBHOME
SQL_BIND_SET
DBMS_SQLQ_INTERNAL
PRVTEMX_PERF
V$OPTION
DBMS_SQLTUNE
PRVTEMX_RSRCMGR
WRI$_ADV_SQLTUNE
Documented
No
Exceptions
Error Code
Reason
ORA-00900
PRAGMA EXCEPTION_INIT(INVALID_SQL, -900);
ORA-65011
Pluggable database CDB$ROOT$ does not exist
First Available
10.1
Security Model
Owned by SYS with no privileges granted
Access to some subpograms prevented by an Accessible By clause.
Returns TRUE if this is the root container of a CDB or FALSE is returned for PDBs and for non-CDB
dbms_sqltune_util0.cdb_is_root(
con_name OUT VARCHAR2,
con_id OUT NUMBER)
RETURN BOOLEAN;
conn / as sysdba
DECLARE
cname VARCHAR2(30);
cid NUMBER;
BEGIN
IF dbms_sqltune_util0.cdb_is_root(cname, cid) THEN
dbms_output.put_line('ROOT: ' || cname);
dbms_output.put_line('ROOT: ' || TO_CHAR(cid));
ELSIF dbms_sqltune_util0.cdb_is_pdb(cname, cid) THEN
dbms_output.put_line('PDB: ' || cname);
dbms_output.put_line('PDB: ' || TO_CHAR(cid));
ELSE
dbms_output.put_line('No Idea Where I Am');
END IF;
END;
/ ROOT: CDB$ROOT
ROOT: 1
PL/SQL procedure successfully completed.
ALTER SESSION SET CONTAINER = ASRA23AI_PDB1;
DECLARE
cname VARCHAR2(30);
cid NUMBER;
BEGIN
IF dbms_sqltune_util0.cdb_is_root(cname, cid) THEN
dbms_output.put_line('ROOT: ' || cname);
dbms_output.put_line('ROOT: ' || TO_CHAR(cid));
ELSIF dbms_sqltune_util0.cdb_is_pdb(cname, cid) THEN
dbms_output.put_line('PDB: ' || cname);
dbms_output.put_line('PDB: ' || TO_CHAR(cid));
ELSE
dbms_output.put_line('No Idea Where I Am');
END IF;
END;
/
Checks whether a user has select access on an object when Database Vault is enabled
dbms_sqltune_util0.check_dv_access(
user_name IN VARCHAR2 := NULL,
object_owner IN VARCHAR2,
object_name IN VARCHAR2,
object_type IN VARCHAR2 := NULL)
RETURN IN BINARY_INTEGER
ACCESSIBLE BY (PACKAGE SYS.DBMS_SQLTUNE);
Given the value of a bind_data column captured in v$sql and a bind position,
this function returns the value of the bind variable at that position in the SQL statement. Bind position start at 1.
dbms_sqltune_util0.extract_bind(
bind_data IN RAW,
bind_pos IN PLS_INTEGER)
RETURN SQL_BIND;
Given the value of a bind_data column captured in v$sql this function returns the collection (list) of bind values associated to the corresponding SQL statement
dbms_sqltune_util0.extract_binds(bind_data IN RAW) RETURN SQL_BIND_SET PIPELINED;
Given the value of a bind_data column in raw type this function returns the number of bind values contained in the column
dbms_sqltune_util0.get_binds_count(bind_data IN RAW) RETURN PLS_INTEGER;
DECLARE
bdata RAW(2000);
retVal PLS_INTEGER;
x VARCHAR2(30);
y VARCHAR2(40);
z DATE;
sb sys.sql_bind;
BEGIN
SELECT bind_data
INTO bdata
FROM v$sql
WHERE is_bind_sensitive = 'Y'
AND sql_id = '8d7jn99py03a0'
AND child_number = 1;