I am getting below error in my application.
org.hibernate.util.JDBCExceptionReporter -- ERROR -- ORA-00980: synonym translation is no longer valid
i have checked the synonym,that is valid.
Can anyone please help.
You may have the synonym in VALID status which refers to even non-existing object:
SQL> create synonym t_syn for abrakadabra;
Synonym created.
SQL> select status from user_objects where object_name = 'T_SYN';
STATUS
-------
VALID
SQL> select * from t_syn;
select * from t_syn
*
error in line 1:
ORA-00980: synonym translation is no longer valid
SQL> select status from user_objects where object_name = 'T_SYN';
STATUS
-------
VALID
So first of all you need to check the existance of the object the synonym refers to.
Related
I have a table named "libisatz" in my database, and there is no table, nor view with name "libiSatz" (with capital S instead of s) and I don't find any kind of object in my schema having name "libiSatz". But, surprisingly selecting from "libiSatz" results in the same result as if I had written "libisatz". If I change any other letter in this name from lower case to upper case (e.g. I write "Libisatz", then I get an error. How can this be?.
ADDENDUM
I've checked the ideas of #Jon Heller with the following result:
Both select * from DBA_OBJECTS where OBJECT_NAME like 'libi_atz'; and select * from DBA_OBJECTS where lower(OBJECT_NAME) = 'libisatz'; returns one single row (it is the "libisatz" table)
select * from DBA_OBJECTS where OBJECT_NAME = 'libisatz'; returns one row and select * from DBA_OBJECTS where OBJECT_NAME = 'libiSatz'; returns no row.
Both select * from DBA_SQL_TRANSLATIONS; and select * from DBMS_ADVANCED_REWRITE; results in ORA-00942: table or view does not exist
select * from DBA_REWRITE_EQUIVALENCES; results in no rows selected
select DUMP(OBJECT_NAME) from DBA_OBJECTS where lower(OBJECT_NAME) = 'libisatz'; returns Typ=1 Len=8: 108,105,98,105,115,97,116,122
So it seems that the puzzle is not yet solved.
ADDENDUM 2.
When I try to create a view named "libiSatz" then I get
ORA-00955: name is already used by an existing object
in spite of the results above.
After I renamed "libiSatz" to "oraclepuzzle",
select count(*) from "libisatz"; and "select count(*) from "oraclepuzzle"; works, but select count(*) from "libiSatz"; doesn't.
select * from dba_objects where object_name in ( 'oraclepuzzle', 'libisatz', 'libiSatz'); returns one row with object_name "oraclepuzzle".
Do you have SQL translations, rewrite equivalances, or UTF8 characters?
The SQL translation framework was built to allow applications designed for other database types to seamlessly query Oracle. But instead of translating syntaxes, the feature could also be used to silently change your queries. For example, here is an example of querying a table that does not exist in order to workaround table size limitations. Check the view DBA_SQL_TRANSLATIONS.
Rewrite equivalences can be created by the package DBMS_ADVANCED_REWRITE, and can be used to silently change the results of wrong queries or for some rare performance problems. (In my simple tests I wasn't able to get this query to work for invalid queries, but I bet there is a way to make it work.) Check the view DBA_REWRITE_EQUIVALENCES.
UTF8 characters may be silently swapped out for similar ASCII characters. This probably depends on your database and client character set settings. The below example is pretty obviously not an ASCII "S", but you may have a more subtle problem. Check the source of your values, retype them manually, and use the DUMP function to evaluate the binary of the characters.
SQL> create table "libisatz"(a number);
Table created.
SQL> -- An uppercase "S" does not work
SQL> select * from "libiSatz";
select * from "libiSatz"
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> -- But a "LATIN SMALL LETTER S WITH CARON" works.
SQL> select * from "libiĆĄatz";
no rows selected
Lastly, are you 100% sure that the object doesn't exist on your database? The above examples are possible, but extremely rare. Triple-check DBA_OBJECTS.OBJECT_NAME for the mystery object.
My deafult Oracle object names are case insensitive.
So, when you issue teh command:
CREATE TABLE the_table ..
CREATE TABLE The_Table ..
CREATE TABLE THE_TABLE ..
The underlying object name in all cases is THE_TABLE, but you can access it using any mix of upper/lower case:
SELECT * FROM THE_TABLE
SELECT * FROM tHe_TaBlE
SELECT * FROM the_table
Will all work.
When a table is created with the name wrapped in double-quotes, the name becomes case-sensitive.
So, if you issue:
CREATE TABLE "libiSatz" ..
Then the table name in all SQL statements must match the exact name in the double quotes, i.e.
SELECT * FROM "libiSatz" is OK (Correction following comments)
SELECT * FROM libisatz is NOT OK
SELECT * FROM LibiSatz is NOT OK
When you search for this in USER_OBJECTS or USER_TABLES you will have to match the creation name:
SELECT * FROM USER_OBJECTS WHERE OBJECT_NAME = 'libiSatz';
I am trying to execute this query ;
Grant SELECT on TYPE PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W;
and I get the folowing error:
Error starting at line : 3 in command - Grant SELECT on TYPE
PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W Error report - ORA-00905:
missing keyword
00905. 00000 - "missing keyword"
*Cause:
*Action:
Does anyone know what keyword I am missing ?
Firstly you need to remove TYPE. This will fix your first part of issue.
Try this
Grant SELECT on PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W
Now when you execute the above , you will further get the error:
ORA-02305: only EXECUTE, DEBUG, and UNDER privileges are valid for
types
Which means you cannot grant select on any type. Only EXECUTE, DEBUG, and UNDER privileges are valid for types.
So you can use EXECUTE when you want it to be used in select statement :
Grant EXECUTE on PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W;
EDIT:
Your select statement should be :
SELECT ppz_bts.na_stat_anf( PPZ_C.BTS_BAUTEIL_STATION_INFO ('','IG','12345679') ) FROM dual;
See demo:
CREATE OR REPLACE TYPE myschema.array_t is varray(2) of number ;
---Running in My schema
SQL> select * from table(array_t('1','2'));
COLUMN_VALUE
------------
1
2
--Granted from myschema to otherschema
SQL> grant execute on myschema.array_t to othersschema ;
--Running in otherschema
SQL> select * from table(myschema.array_t('1','2'));
COLUMN_VALUE
------------
1
2
When Oracle receives requests for type information, it verifies that the requestor has EXECUTE privilege on the type before supplying the requested information.
Try this :
Grant EXECUTE on PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W;
Then try doing :
SELECT ppz_bts.na_stat_anf( PPZ_C.bts_bauteil_station_info('','IG','12345679') )
FROM dual;
This is a pretty silly one, but I need help.
I have a table owned by mydbowner. It is named mydbowner.mytable. I tried to make a public synonym by issuing the command:
CREATE OR REPLACE PUBLIC SYNONYM mytable FOR mydbowner.mytable;
When I do this, and I query the table I get:
ORA-01775: looping chain of synonyms
How do I make this synonym without having the problem.
I think Justin is on the right track. What I think it actually means is that mydbowner.mytable doesn't exist.
Here's an example:
SQL> conn mbobak
Enter password:
Connected.
SQL> drop table mytable;
drop table mytable
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> create public synonym mytable for mbobak.mytable;
Synonym created.
SQL> select * from mytable;
select * from mytable
*
ERROR at line 1:
ORA-01775: looping chain of synonyms
I think what's happening is that Oracle tries to resolve mytable, there is no mytable in mbobak schema, so it looks for it in PUBLIC, it finds it, and sees that it points to mbobak.mytable. But, mbobak.mytable doesn't exist, so, it looks for mytable in PUBLIC, and there's the loop.
And in fact, if you create mytable, the error goes away:
SQL> create table mytable as select * from dual;
Table created.
SQL> select * from mytable;
D
-
X
1 row selected.
SQL> drop table mytable;
Table dropped.
SQL> select * from mytable;
select * from mytable
*
ERROR at line 1:
ORA-01775: looping chain of synonyms
Yes, I realize that doesn't really entirely make sense, as, once the public synonym resolved to mbobak.mytable, and that's not found, it seems to me, it should return an error ORA-942 "table or view does not exist", which makes far more sense to me.
But, this does seem to be how it works.
QED
Hope that helps.
The error you're getting implies that mydbowner.mytable is not, in fact a table. What does
SELECT object_type
FROM all_objects
WHERE owner = 'MYDBOWNER'
AND object_name = 'MYTABLE'
return?
Does anybody know the values that are given in the table_privileges? I already found out what "A" means. But I did not find out for what the "S" stands for. I think this isnt documented. It has something to do with update privileges on particular columns.
The thing you are missing is that we can grant UPDATE on a subset of a table's columns.
First of all, let's just grant SELECT on a table. The value of UPDATE_PRIV is 'N', for None:
SQL> grant select on t23 to mr_x;
Grant succeeded.
SQL> select select_priv, update_priv
2 from table_privileges
3 where table_name = 'T23'
4 /
S U
- -
Y N
SQL>
Now, if I grant UPDATE on a single column the value of UPDATE_PRIV is 'S', presumably for Some:
SQL> grant update (col2) on t23 to mr_x
2 /
Grant succeeded.
SQL> select select_priv, update_priv
2 from table_privileges
3 where table_name = 'T23'
4 /
S U
- -
Y S
SQL>
Finally, I grant UPDATE on the whole table the value of UPDATE_PRIV is 'A', for All:
SQL> grant update on t23 to mr_x
2 /
Grant succeeded.
SQL> select select_priv, update_priv
2 from table_privileges
3 where table_name = 'T23'
4 /
S U
- -
Y A
SQL>
I'm sorry but having noticed an answer that #JustinCave gave to this very question back in 2005 I have to post it.
From the SQL Reference documentation on table_privileges
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch2486.htm#1318903
"TABLE_PRIVILEGES contains information on grants on objects for which
the user is the grantor, grantee, or owner, or PUBLIC is the grantee.
This view is included for compatibility with Oracle version 6. Oracle
Corporation recommends that you do not use this view."
Given that Oracle recommends you not use this view, I would strongly
suggest that you use the DBA_TAB_PRIVS view instead. The information
there should be a bit easier to decipher.
I was reading this article:
Managing Oracle Synonyms
Regarding the order of preference, when it come to resolving an object name to the actual object, it says:
Local objects will always be accessed first.
If a local object does not exist, the object with a private synonym will be accessed.
If a private synonym does not exist or the object does not exist, then the public synonym will be used.
I was wondering if the public objects are missing in this order somehow?
E.g. if user BOB queries
select * from FOOBAR
and there is no BOB.FOOBAR in dba_tables/views but PUBLIC.FOOBAR.
Does Oracle resolve it to PUBLIC.FOOBAR or will it check for synonyms first?
Thank you.
In your example, FOOBAR is almost certainly a public synonym. There is no PUBLIC schema but PUBLIC is listed as the owner of a public synonym.
If I create a new public synonym
SQL> create public synonym pub_syn_emp
2 for scott.emp;
Synonym created.
the owner of that synonym ends up being PUBLIC
SQL> ed
Wrote file afiedt.buf
1 select object_name, owner, object_type
2 from dba_objects
3* where object_name = 'PUB_SYN_EMP'
SQL> /
OBJECT_NAME OWNER OBJECT_TYP
-------------------- ---------- ----------
PUB_SYN_EMP PUBLIC SYNONYM
In addition, item #3 does not appear to be correct. If there is a private synonym that points to a non-existent object and a public synonym that points to a valid object, the private synonym still takes precedence. You'll just get an error when Oracle tries to resolve the private synonym to an actual object.
SQL> create synonym syn_emp for scott.no_such_table;
Synonym created.
SQL> create public synonym syn_emp for scott.emp;
Synonym created.
SQL> select * from syn_emp;
select * from syn_emp
*
ERROR at line 1:
ORA-00980: synonym translation is no longer valid
At least up to 10g, PUBLIC is not a real user. You cannot create objects in the "Public schema":
SQL> CREATE TABLE public.foobar (id integer);
CREATE TABLE public.foobar (id integer)
ORA-00903: invalid table name
SQL> CREATE TABLE system.foobar (id integer);
Table created
SQL>
If you run this query:
SELECT object_name
FROM dba_objects
WHERE owner='PUBLIC'
AND object_type IN ('TABLE', 'VIEW');
You can answer the question about pre-defined tables/views in the PUBLIC "schema".