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.
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.
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
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've recently installed Oracle 11g on an Ubuntu 12.04 machine.
I can't create a user; the following is the error I got
SQL> create user rachid identified by rachid;
create user rachid identified by rachid
*
ERROR at line 1:
ORA-01109: database not open
The instance is started :
SQL> select status from v$instance;
STATUS
------------------------------------
STARTED
Do you have any solution to overcome this issue ?
You can try to open it using
ALTER DATABASE OPEN
or you can try to shut it and start again and then try to create the user:
$ sqlplus sys/Change12345#orc01 as sysdba
SQL> shut immediate
SQL> startup
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;