Oracle not allow to grant on sys.* - oracle

I'm running an installer script. which is granting on sys.aux_stats$, sys.wri$optstat_aux_history, sys.dbms_spm and sys.dbms_xplan. At this point there is an exception throwed: ORA-01031: insufficient privileges For the installer I created a DBA-User (FOODBA) and a DB-User (FOOADM). The DBA is created like this on the oracle machine:
bash-4.1$ sqlplus
...
Enter user-name: sys as sysdba
Enter password:
SQL> CREATE USER FOODBA IDENTIFIED BY Password;
User created.
SQL> GRANT DBA TO FOODBA ;
Grant succeeded.
SQL> GRANT ADMINISTER SQL MANAGEMENT OBJECT TO FOODBA ;
Grant succeeded.
doesn't work at all, do I tried like this:
SQL> GRANT ALL PRIVILEGES TO FOODBA;
Grant succeeded.
Still not working, so I tried to give permission on custom object:
SQL> grant all privileges on sys.aux_stats$ to FOODBA;
Grant succeeded.
And when I run the script with user FOODBA:
grant select, insert, update, delete on sys.aux_stats$ to FOOADM
It's throwing again the insufficient privileges excpetion.
What I'm supposed to do, so that the FOODBA user can create and grant the FOOADM correctly? The install script is 3rd party.

Having an object grant is not sufficient to pass this grant on to another user/role. You will need "with grant option".
grant select, insert, update, delete on sys.aux_stats$ to FOODBA with grant option;

Related

Oracle 19C - Error trying to grant execute on DBMS_LOCK

Updating some scripts from 18 to 19, but getting this
Have also tried just DBMS_LOCK instead of SYS.DBMS_LOCK
SQL> GRANT EXECUTE ON SYS.DBMS_LOCK to myuser;
GRANT EXECUTE ON SYS.DBMS_LOCK to myuser
*
ERROR at line 1:
ORA-04042: procedure, function, package, or package body does not exist
sqlplus "sys/ChangeMe123! AS SYSDBA"
Note - other grants worked
SQL> GRANT ALTER SESSION TO myuser;
Grant succeeded.
SQL> GRANT CREATE PROCEDURE TO myuser;
Grant succeeded.
SQL> GRANT CREATE SEQUENCE TO myuser;
Grant succeeded.
SQL> GRANT CREATE SESSION TO myuser;
Grant succeeded.
SQL> GRANT CREATE MATERIALIZED VIEW TO myuser;
Grant succeeded.
SQL> GRANT CREATE TABLE TO myuser;
Grant succeeded.
SQL> GRANT CREATE TRIGGER TO myuser;
Grant succeeded.
SQL> GRANT CREATE VIEW TO myuser;
Grant succeeded.
SQL> GRANT CREATE ANY SYNONYM TO myuser;
Grant succeeded.
SQL> GRANT DROP ANY SYNONYM TO myuser;
Grant succeeded.
SQL> GRANT SELECT ANY DICTIONARY TO myuser;
Grant succeeded.
SQL> GRANT EXECUTE ON DBMS_LOCK to myuser;
GRANT EXECUTE ON DBMS_LOCK to myuser
DBMS_LOCK.SLEEP was deprecated replaced with DBMS_SESSION.SLEEP but still available in 19c for backwards compatibility.Verify if object exists
SQL> select object_name,object_type,owner from dba_objects
2 where object_name='DBMS_LOCK';
OBJECT_NAME OBJECT_TYPE OWNER
------------------------------ ----------------------- ------------------------------
DBMS_LOCK PACKAGE SYS
DBMS_LOCK PACKAGE BODY SYS
DBMS_LOCK SYNONYM PUBLIC
If above query returns nothing then run the dbmslock script as a sysdba that creates above package
sql>#?/rdbms/admin/dbmslock

Insufficient privileges error in Oracle 10g

I am new to using Oracle database. I worked on it for some weeks. It worked well. But now, I'm having some problem. I am getting this error while trying to connect. I didn't change the password. I am using the default user name and password only.
SQL> connect as sysdba
Enter user-name: SCOTT
Enter password:
ERROR:
ORA-01031: insufficient privileges
Can someone tell the solution for this?
That's because SCOTT isn't granted a SYSDBA role. Have a look at his demonstration.
This is what you have now:
SQL> connect as sysdba
Enter user-name: scott
Enter password:
ERROR:
ORA-01031: insufficient privileges
Warning: You are no longer connected to ORACLE.
SQL>
Connect as a privileged user (SYS) and grant SYSDBA to SCOTT:
SQL> connect as sysdba
Enter user-name: sys
Enter password:
Connected.
SQL>
SQL> grant sysdba to scott;
Grant succeeded.
SQL>
OK; now, back to the initial attempt:
SQL> connect as sysdba
Enter user-name: scott
Enter password:
Connected.
SQL>
Not everyone has SYSDBA privileges, and not everyone should have them. Handle with care, it is a powerful privilege so I'll revoke it from SCOTT:
SQL> connect as sysdba
Enter user-name: sys
Enter password:
Connected.
SQL> revoke sysdba from scott;
Revoke succeeded.
SQL>
Please share more information like OS etc
But have you checked user you are using to connect is part of ORA_DBA group assuming you are on windows

syntax error for command: "GRANT EXECUTE ON USERNAME.PKG.PROCEDURE TO OTHERUSER;"

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;

"insufficient privileges" error creating a new user

I have installed Oracle 11g on my PC. When I try to create a user in SQL*Plus I get an error:
SQL>create user scott identified by scott;
*
ERROR at Line 1:
ORA-01031:insufficient privilages
What am I doing wrong?

Getting error during logon in sqlplus

After successfully create the user, When I logon into this. I get error like below:
User username lacks CREATE SESSION privilege; logon denied
grant create session to USERNAME;
sqlplus> connect / as sysdba
sqlplus> grant connect to username

Resources