failed in the execution of the ODCIINDEXDELETE routine during deletion of geodata - oracle11g

An error occurs while deleting geographic(mdsys.sdo_geometry) data with geoindex from table.
Oracle 11g.
The error is:
ORA-29876: failed in the execution of the ODCIINDEXDELETE routine
ORA-13209 Internal Error While Reading SDO_INDEX_METADATA
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 720
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 250
Geospatial index is "VALID"
The owner of table is user "B", but deleting data occurs by the user "A".
The user "A" has privileges:
select, insert, delete on mdsys.SDO_GEOM_METADATA_TABLE
select, insert, delete on mdsys.all_sdo_index_metadata
create table, CREATE sequence,UNLIMITED TABLESPACE
select, insert, delete on all tables of user "B"
What other privileges does the user "A" need?
Deleting from tables without geoindex happens correctly.
If grant user "A" all privileges then deleting the geodata occurs correctly.

Related

Insert on constraint-less table, caused ora-02449 unique/primary keys in table referenced by foreign keys

We have an old batch file which does only such statement:
Insert into table_a select * from table_b;
table a is bulk table with no index and constraint
after few years, with increments in record counts, this batch became slow
but suddenly for few days, we got this error every time we try to run the batch:
Ora-00604 error occured at recursive sql level 1 ora-02449 unique/primary keys in table referenced by foreign keys
our only option is to make chunks of data, and insert them part by part, which fixes the batch output, but the problem still exists
we are not dropping and table or object here
can you help us find the cause of problem?
I've checked database level triggers but there is no trigger for insert at database level

Why won't my table I created in one tablespace show up when I query it from another tablespace?

Both tablespaces are in the same DB so in Oracle SQL Developer, if I login to one tablespace tb1 i can see all the tables in tb2. Because of permissions I was unable to create the table tb2.new_table while logged into tb1. So I logged into tb2 and made tb2.new_table and can query it there. When I log back into tb1 I cannot see the newly created tb2.new_table. I'm just wondering why it's not showing up, I did commit after I made the new table.
My confusion comes as when I was logged into tb1 I was able to add a column to a table in tb2. Any ideas?
You can't log in to a tablespace. And you don't refer to a table by its tablespace (a table can exist in multiple tablespaces or in no tablespace). If you are referring to a table tb2.new_table, that implies that tb2 is the name of a schema, not a tablespace. Tablespaces have nothing to do with permissions, they are simply a collection of physical data files. Schemas do impact permissions.
It appears that you created a new table in schema2 but haven't given user1 permission to do anything with that table. Assuming that is the case, as user2 run the commant
grant select on new_table to user1
and then user1 should be able to
select * from user2.new_table
If you want user1 to be able to insert, update, and/or delete data in new_table, you'd need to grant those permissions as well, i.e.
grant insert, update, delete on new_table to user1

ORACLE 11g Know Insert Record Details which Failed to insert

I have started auditing insert records by user on failure to any table in my oracle 11g Database. I have used following command to do the same.
AUDIT INSERT ANY TABLE BY SHENA BY ACCESS WHENEVER NOT SUCCESSFUL;
I would like to know whenever the record insert will fail, Can i know what was the records which failed to insert into table.
Where we can see such information. Or if you know any other way of auditing of the same please suggest. One way which i know is to write a trigger on insert. In that trigger handle insert failure EXCEPTION and save those values to some table.
Use SQL Loader Utility with following control file format.
options(skip=1,rows=65534,errors=65534,readsize=16777216,bindsize=16777216)
load data
infile 'c:\users\shena\desktop\1.txt'
badfile 'C:\Users\shena\Desktop\test.bad'
discardfile 'C:\Users\shena\Desktop\test.dsc'
log 'C:\Users\shena\Desktop\test.log'
append
into table ma_basic_bd
fields terminated by '|' optionally enclosed by '"' trailing nullcols
(fs_perm_sec_id,
"DATE" "to_date(:DATE,'YYYY-MM-DD')",
adjdate "to_date(:adjdate,'YYYY-MM-DD')",
currency,
p_price,
p_price_open,
p_price_high,
p_price_low,
p_volume)
You are requested to use the conventional path loading so that we can get the rejected(rejected because of datatype mismatch and business rule violation) records in .bad file. Conventional path loading is a default option.
Following URL can be used for the detailed knowledge.
https://youtu.be/eovTBGAc2RI
Total 4 videos are there. Very helpful.

ORA-00001: unique constraint (ABC.XY_PK) violated Error

before inserting in the table i am validating if the ID already exists in table.
It does not exists. Even though it through this error. Is there any possibility that the table does not allow to insert may be permission issue.
I have that insert query in a procedure, is there a possibility that due to procedure permission it doesn't allow.
If you check in the first statement/transaction for existences and you run this SP in parallel it is possible that the second (INSERT) statement/transaction fails.
In this case you can use a MERGE statement which either inserts the data or updates on existences in one transaction.

sqlite: dropping a table in a transaction?

I have a simple, single table sqlite3 database file that has exactly one table. There are no keys, foreign or domestic. There are no triggers. I have the following workflow:
If the database file exixts open it.
Start exclusive transaction
Select all rows from the table in order.
Operate on each row.
Delete each operated-on row.
When done, count the number of remaining rows in the table, if 0 then DROP the table then unlink the database file
Commit or Rollback the transaction
The drop-table always fails with the message that the table is locked. I've seen a couple of other posts that suggest that there could be open statement handles or other cruft lying around. Since I am using "sqlite_exec()"s for all of this I do not have any open DB anything except the DB handle itself.
Is drop table not allowed in transactions?
When dropping a table, you get the "table is locked" message when there is still some active cursor on the table, i.e., when you did not finalize a statement (or did not close a query object in whatever language you're using).

Resources