-- ============================================================
-- 34_agent_ords_execution_evidence_grant.sql
-- Enable SQL_ID and DBMS_XPLAN evidence for VPD probe requests.
--
-- Run as SYS or a DBA account that can grant SYS.V_$ dynamic-performance
-- views. Typical Autonomous ADMIN accounts cannot delegate these views.
-- The grants are read-only and scoped to the ORDS parsing schema. They do
-- not grant table DML or alter DBMS_RLS enforcement.
-- ============================================================
WHENEVER SQLERROR EXIT SQL.SQLCODE
SET ECHO ON
SET FEEDBACK ON

PROMPT === Granting ORDS cursor-evidence read access ===
GRANT SELECT ON V_$SQL TO CB_ORDS;
GRANT SELECT ON V_$SQL_PLAN TO CB_ORDS;
GRANT SELECT ON V_$SQL_PLAN_STATISTICS_ALL TO CB_ORDS;
GRANT SELECT ON V_$SESSION TO CB_ORDS;
GRANT EXECUTE ON DBMS_XPLAN TO CB_ORDS;

PROMPT === ORDS cursor-evidence grants ready ===
PROMPT SQL_ID evidence will appear after the next /probe call.
EXIT;
