In my DB I set up 2 schemas, schemaA and schemaB.
In schemaA I create a job (jobA) and a procedure (procA) to set arguments and enable the job. I test the flow in schemaA and it's working correctly.
In schemaB I need to call schemaA.procA in order to run the job. I grant to schemaB the privileges needed to execute schemaA.procA but the error ORA-27486: insufficient privileges is raised.
Debugging procA I locate the exception at the beginning of dbms_scheduler instructions (DBMS_SCHEDULER.PURGE_LOG(job_name=>jobName);).
EDIT: Add informations as requested in the comment
VERSION : Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
GRANT : system # mydatabase
grant CREATE ANY JOB, CREATE EXTERNAL JOB , CREATE JOB to schemaA;
PROCEDURE : schemaA # mydatabase
procedure procA ...
...
DBMS_SCHEDULER.PURGE_LOG(...);
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE(...);
DBMS_SCHEDULER.SET_ATTRIBUTE(...);
DBMS_SCHEDULER.ENABLE(...);
...
end procA;
GRANT : schemaA # mydatabase
grant execute on procA to schemaB
In procA there are others operations that are correctly executed until PURGE_LOG that raise the exception
Inspetting others users I found that I miss one system privilege :
MANAGE SCHEDULER
Granting it from sys the procA run successfully both from schemaA and SchemaB
Related
I am new to Oracle. I had created a local Oracle database but I needed to drop it, so I dropped it using below commands.
sqlplus / as sysdba
SQL> shutdown immediate;
SQL> startup mount exclusive restrict
SQL> drop database;
Now I need to recreate local Oracle db so I tried below commands but I am getting errors now.
sqlplus / as sysdba
SQL> shutdown abort
SQL> startup
Getting errors on above command execution:
Also tried creating tablespace but getting below error:
Please help me.
I use Oracle Database 11g and I have a fairly simple code:
set serveroutput on format wrapped;
declare
result_ clob;
begin
result_ := dbms_random.string('P', 10);
dbms_output.put_line(result_);
end;
When I try to run it gives me an error saying:
identifier 'DBMS_RANDOM' must be declared
Why dbms_random is not recognized as a valid identifier? Do I have to import it?
Probably this is a permissions problem. EXECUTE on DBMS_RANDOM is not granted by default, so you need a DBA user to grant you the EXECUTE privilege.
grant execute on dbms_random to << your_username >>;
There is an outside chance the package is not installed, although installation is the default. Again, you need a DBA user to check, and if need be run the installation script.
I want to grant execute permission to user B so that it can execute a packaged procedure belonging to user A.
procedure name = PKGNAME.PROCEDURENAME
user = USERA
I am trying below command:
GRANT EXECUTE ON USERA.PKGNAME.PROCEDURENAME TO USERB;
But it gives me error:
ERROR at line 1:
ORA-00905: missing keyword
is there a syntax problem ? I used this link :
Granting Rights on Stored Procedure to another user of Oracle
you can't grant permissions on a procedure which is within a package, either grant permissions to the entire package or move the procedure outside of the package so it's a stand alone one and then grant permission
so either
GRANT EXECUTE ON USERA.PKGNAME TO USERB;
or
GRANT EXECUTE ON USERA.PROCEDURENAME TO USERB;
I was following this tutorial:
http://sysadminnotebook.blogspot.com/2012/10/installing-oracle-11g-r2-express.html
and I sucessfully installed and started oracle database. Now I wanted to connect to that DB from bash, so I found that command:
sqlplus sys as sysdba
It asks for password, which in my case is oracle, and after I supply it, I get:
ORA-01031: insufficient privileges
What should I do?
EDIT:
I needed to add group dba and add myself to that group. However I've got other problem now. I wanted to create user, so I did:
CREATE USER myuser IDENTIFIED BY password
default tablespace users
temporary tablespace temp;
And I got: ORA-01034: ORACLE not available.
I tried: STARTUP But I got:
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/xe/dbs/initXE.ora'
I have '/u01/app/oracle/product/11.2.0/xe/dbs/init.ora' file but not initXE.ora
Is the o/s user a member of the dba group?
If this is a new installed Oracle and you do not have initXE.ora parameter file here /u01/app/oracle/product/11.2.0/xe/dbs/, that means you need to create XE DB first. To do that run /u01/app/oracle/product/11.2.0/xe/bin/createdb.sh script first.
I have problem with using dbms_crypto.hash() function in Oracle.
I connected to database server using sqlplus as "sys/passwd as sysdba",
then I installed dbms_crypto package:
#/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/dbmsobtk.sql
#/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/prvtobtk.plb
Grant execute on dbms_crypto to public;
Grant execute on dbms_sqlhash to public;
Grant execute on dbms_obfuscation_toolkit to public;
Grant execute on dbms_obfuscation_toolkit_ffi to public;
Grant execute on dbms_crypto_ffi to public;
Everything looks good, so I tested hash() function:
SQL> select dbms_crypto.hash(utl_raw.cast_to_raw('zorg'), 3) from dual;
DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW('ZORG'),3)
--------------------------------------------------------------------------------
60C440F9954CA4744204CDA9CC93567059C1EC82
I disconnected and connected to that database as regular user, but then I got error:
SQL> select dbms_crypto.hash(utl_raw.cast_to_raw('zorg'), 3) from dual;
select dbms_crypto.hash(utl_raw.cast_to_raw('zorg'), 3) from dual
*
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06512: at "MN.DBMS_CRYPTO_FFI", line 131
ORA-06512: at "MN.DBMS_CRYPTO", line 72
Why I cannot use this function as regular user? How to allow other users to use it?
I work with:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
Problem solved. I created package as wrong user. Proper way:
connect using:
sqlplus / as sysdba
Install packages:
#/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/dbmsobtk.sql
#/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/prvtobtk.plb
Connect as regular user and use functions from dbms_crypto package.