One of our cutomer is running the scripts in oracle sql developer to upgrade his database table structure, procudere & triggers etc. But while running the script, he is getting ORA-00904: Invalid Identifier Error for DBMS_LOB.SUBSTR() and DBMS_LOB.GETLENGTH() in one procedure.
Can somebody tell why is happening so?
There are using Oracle Sql developer Version 3.1.07 Build MAIN-07.42 with Oracle 11g.
I imagine 3 possible reasons:
the user lacks execute privilege on sys.dbms_lob (although the
privilege is granted to PUBLIC by default)
there is no synonym dbms_lob for sys.dbms_lob in the database (although such public synonym should exist)
the schema, on which the customer works, contains some other package with the same name DBMS_LOB
Run this sql with sys to check whether your schema has privilege to execute DBMS_LOB.
select * from dba_tab_privs where table_name='DBMS_LOB';
By default, you should see PUBLIC in the grantees.
If not, you can run sql with sys.
grant execute on sys.DBMS_LOB to public;
or
grant execute on sys.DBMS_LOB to <your_schema_name>
Related
I am unable to create the DB link as it's throwing ORA - 01031 insufficient privileges error.
Let's say I have database DB1 and schema name as s1 and second database as DB2 with schema t1.
I am trying to create the DB link by sysdba user by running below -
alter session set current_schema=s1;
Create database_link dblinkname connect to t1 identified by password using DB2;
But this is giving me error. I tried giving privileges also to s1 but no luck. Any leads. I don't have the schema password for s1 and I can't reset it as it's production environment.
I had the same issue a several years ago.
Assuming, you don't want to create a public database link...
You can do this:
Grant privilege create database link to target schema.
Create a stored procedure in your target schema, which creates database link per execute immediate
Call this procedure
Finally drop this procedure.
I'm new to Oracle and would like to know the way how to get more statistics in the case i'll describe below. I'm using SQL Developer.
First, I execute this:
SET autotrace on;
SELECT NAME
FROM PASSENGER
WHERE ID_PSG IN (
SELECT ID_PSG
FROM PASS_IN_TRIP PIT JOIN TRIP T on T.TRIP_NO = PIT.TRIP_NO
WHERE UPPER(TOWN_FROM) = 'MOSCOW'
)
In Script Output I can see info about the query from PLAN_TABLE table and after that there's the text:
Unable to gather statistics please ensure user has correct access. The
statistic feature requires that the user is granted select on
v_$sesstat, v_$statname and v_$session.
I've tried to find a solution here already, there's a link:
SQL Developer : Unable to gather system statistics : insufficient privileges
So I executed the same commands and the grants were all succeded:
GRANT CREATE session TO PRACTICE;
GRANT GATHER_SYSTEM_STATISTICS TO PRACTICE;
GRANT CONNECT TO PRACTICE;
Then I disconnected, closed SQL dev, opened it, connected again as it was described in the solution from the link, ran
execute dbms_stats.gather_system_stats ('START');
and got this:
PL/SQL procedure successfully completed.
Then I thought everything is fine and tried to execute the code from the very beginning and its Script Output was still the same as before.
Do I have to grant anything else or this statistics can be found in the other place or I just did everything wrong?
That error is about sqlplus autotrace, it's not about gathering system statistics like your linked post seems to be about.
There is a role created specifically for these grants called plustrace https://docs.oracle.com/database/121/SQPUG/ch_eight.htm#SQPUG535
To use this feature, you must create a PLAN_TABLE table in your schema
and then have the PLUSTRACE role granted to you. DBA privileges are
required to grant the PLUSTRACE role. For information on how to grant
a role and how to create the PLAN_TABLE table, see the Oracle Database
SQL Language Reference.
I use following sql to create my trigger
CREATE OR REPLACE TRIGGER INSERT_LOG
AFTER INSERT
ON EXTERNAL_SCHEME.PAYMENT
FOR EACH ROW
BEGIN
INSERT INTO MY_SCHEMA.DM_LOGGER(ID, TECHNOLOGY, WORKFLOW, NAME_EVENT, TIME_EVENT)
VALUES (PAYMENT.id, 'Repository', 'UP', (select repo.name from
pay_repository repo join pay_pmt pay on repo.id = pay_pmt.repository_id
where repo.id = pay.repository_id),(select to_char(SYSDATE, 'hh24:mi:ss') from dual));
END;
When I execute this trigger I get following exception:
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label
I don't get it. I have connection to both schemes and I never want to change something. What is wrong?
the privileges seems to be missing,please execute,
grant create trigger to schemaname;
if it still gives the error then the select privileges might be missing on the tables of other schemas, for that you can run this,
grant select on otherschema.table_name to <schema_name> ;
I was trying to gather system statistics to get the report information.
I tried the same via SQL developer and found some privillage issues and I referred this link for the solution,
GRANT CREATE session TO TEST_DB;
GRANT GATHER_SYSTEM_STATISTICS TO TEST_DB;
GRANT CONNECT TO TEST_DB;
All grant succeeded.But,
execute dbms_stats.gather_system_stats ('START');
gave me the error
ORA-20000: Unable to gather system statistics : insufficient privileges
ORA-06512: at "SYS.DBMS_STATS", line 23190
Finally, I tried with command line and finished the things without any issues,
PL/SQL procedure successfully completed.
why it was showing insufficient privileges issue in SQL developer ?
Role privileges like GATHER_SYSTEM_STATISTICS (as opposed to sys privileges, like CREATE TABLE) don't take effect immediately; they only take effect at the next logon (presumably because Oracle does some kind of caching internally).
So if you'd logged off and on in SQL Developer, it would have worked, as well.
i was running an insert query on a synonym i got ORA-01031 in sql developer, we are accessing almost all tables through synonym only, but only this one in the schema gave ORA-0103 error. Please guide.
Error report: SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label.
did you execute something like:
GRANT select, insert, update, delete on Table to your_synonym_user;
and this line should be executed by the Table owner or the user with that permission.
It looks very much like the permissions you have to either the underlying table, or the synonym are insufficient, or possibly that your password has expired?