Issue
The documentation says that
execute immediate 'alter session set container=myPDB'
is disabled from PDBs ( possible from the CDB Root and also Application Container ),
but it says nothing against DBMS_SQL.PARSE. I expected that it would be able to execute PL/SQL, from PDB, in another PDB, over DBMS_SQL.PARSE but have got the the error: ORA-01031: insufficient privileges
So, look like it is also impossible like that. The test is the following
I login in CDB Root as SYSDBA.
I am then able to execute the following:
declare
c1 int;
rowsn integer;
statem varchar2(500);
ctx varchar2(128);
BEGIN
c1 := DBMS_SQL.OPEN_CURSOR;
ctx :='myPDB';
statem :=' declare
var1 varchar2(60);
begin
select user into var1 from dual;
end;';
DBMS_SQL.PARSE(c => c1 ,
statement => statem,
language_flag => DBMS_SQL.NATIVE,
container => ctx);
rowsn:=DBMS_SQL.EXECUTE(c=>c1);
DBMS_SQL.CLOSE_CURSOR(c=>c1);
END;
/
and it works !
but once I switch to the PDB as
alter session set container=myPDB;
I am not any more able to do the following
alter session set container=myPDB;
declare
c1 int;
rowsn integer;
statem varchar2(500);
ctx varchar2(128);
BEGIN
c1 := DBMS_SQL.OPEN_CURSOR;
ctx :='myPDB2';
statem :=' declare
var1 varchar2(60);
begin
select user into var1 from dual;
end;';
DBMS_SQL.PARSE(c => c1 ,
statement => statem,
language_flag => DBMS_SQL.NATIVE,
container => ctx);
rowsn:=DBMS_SQL.EXECUTE(c=>c1);
DBMS_SQL.CLOSE_CURSOR(c=>c1);
END;
/
any possibility to be able to execute PL/SQL from PDB, inside another PDB, over DBMS_SQL.PARSE ?
Solution
PDBs are effectively separate databases, with separate security (users, roles, privileges, etc.). There is no visibility between them. You would have to treat them like independent, stand-alone databases. The only way stand-alone Oracle databases can interact is through database links.
Answered By - pmdba Answer Checked By - Clifford M. (Python.Easybugfix Volunteer)
Post a Comment
Post a Comment