I have a single instance called sp_admin with several tables. One of them is called 'tenant_api_user'. From sqlplus, I can select * from any of the tables, including tenant_api_user (or select count(*) etc) and the results are fine. However, when I run queries against this one specific table in SQL Developer, it always returns zero records.
When I run the select * from tenant_api_user; from SQL Developer, it returns 0 records instantly - no waiting. That same query from sqlplus returns the only record in the table. When I try to update a record that is visible from sqlplus, SQL Developer says 0 rows updated.
Has anyone experienced this kind of behavior before? It seems to be isolated to just this table. SQL Developer doesn't behave this way with any other table.
If you have entered the data in one session and you have not run a commit statement then you will not be able to see the data in another session until it has been committed.
Related
Forgive me to ask a silly question.
Would a temporary table be dropped automatically in Oracle (12c)?
Yesterday I have executed the following DDL to create a temporary table:
Create global temporary table my_1st_t_table on commit preserve rows as
select
*
from
other_table
where
selected_col = 'T';
After that I have executed following statements:
commit;
select count(*) from my_1st_t_table;
Yesterday, the last select statement returned 2000 rows.
After that I disconnected my VPN and also switched off my client laptop.
Today I rerun the last select statement after restarted my computer and reconnected to the VPN.
It returned 0 rows. So this means the table was still there but just all rows being deleted after my session.
However, may I ask when will my temporary table be dropped?
Thanks in advance!
A temporary table in Oracle is much different than a temp table in other database platforms such as MS SQL Server, and the "temporary" nomenclature invariably leads to confusion.
In Oracle, a temporary table just like other tables, and does not get "dropped". However, the rows in the table only exist within the context of the session that inserted the rows. Once the session is terminated, assuming the session did not delete the rows, Oracle will delete the rows in the table for that session.
So bottom line, the data is temporary, the table structure is permanent, until the table is dropped.
I am using oracle sql developer client on windows to connect to Oracle Database.
One regular day I got an email that my computer using SQL developer, has deleted ~400 rows from table with ~700 rows (not all of them).
Naturally I started investigating how and why this happened.
I examined all of the queries executed from my client (SQL History) and NONE of them (I am 100% sure about this) deletes anything from the table.
Also there are no triggers or any foreign keys related to this.
In the server logs we say the exact queries and they where one for each row, also they where very specific (obviously generated), the only way for this to happen is to manually delete row from the UI of the client. All 400+ queries were executed in the same second.
But to do so you need to go to the table select 400 rows and click delete.
I always use SQL queries to do things and never would have used the client to delete rows (atleast knowingly).
Other thing is if I somehow deleted the rows through the client I would have deleted all of them or one of them not a specific number of rows.
My question did someone had similar experience?
Can anyone guess how could you delete specific rows with some king of shortcut or something like that?
Thanks.
I have a 5TB large database.
I want to audit everything , really everything.
First of all, I tried with AUDIT ALL, but according to Oracle's document AUDIT ALL does NOT audit everything...
I know that this statement must be executed in order to start auditing db:
alter system set audit_trail=db,extended scope=spfile;
But what else should I do to start auditing all the SQL statements that users execute?
You need not to use the AUDIT feature if you only want a view on user queries (SELECT, UPDATE, INSERT) on your database. $AUD contains rather DDL statements, whereas V$SQL contains only DML statements.
A very simple solution is to use another view: V$SQL. You can extract duration and lot of useful info from it.
Useful example:
SELECT * FROM v$sql vv
WHERE lower(vv.SQL_TEXT) like '%delete%'
AND vv.PARSING_SCHEMA_NAME like 'A_SCHEMA%'
ORDER BY vv.LAST_ACTIVE_TIME desc;
V$SQL lists statistics on shared SQL area without the GROUP BY clause and contains one row for each child of the original SQL text entered. Statistics displayed in V$SQL are normally updated at the end of query execution.
Long running queries are updated every 5 seconds. This shows the impact of long running SQLs while they are still working.
Oracle SQL Developer 3.0.03
Why do I not see any results when I run the following query in SQL Developer?
select * from wwv_flow_files;
Yet, if I run the same query in APEX SQL Commands, I see results.
It may be because
WWV_FLOW_FILES is view top of table WWV_FLOW_FILE_OBJECTS$. From
WWV_FLOW_FILES
view you can access files only associated to your workspace.
We have an existing database link in an Oracle database that links to data in a Sql Server database. Now, a 2nd Oracle database needs to use that same data. Due to security setup, the 2nd Oracle database cannot "see" the Sql Server database, but it can see the 1st Oracle database.
If we create a database link in the 2nd Oracle database that points to the 1st Oracle database, will we be able to query data from the Sql Server database in the 2nd Oracle database by going through 2 database links? Would the query syntax look like this:
SELECT * FROM myTable#2ndLink#1stLink
Has anyone done something like this before?
Vincent's solution will work, and another solution is to create a synonym instead of a view.
DB1:
CREATE SYNONYM X FOR MyTable#sqlServerDB
DB2:
(assumes db link to DB1 connects as owner of synonym)
SELECT * from X#DB1
I'm not sure this synthax would work (although it would be interesting to test it I can not do it right now). However, even if it doesn't work, you can still create a view in Database 1 that points to a table in your SQL Server Database. From Database 2, you could then query:
SELECT * FROM myView#db1
That would point to the correct table.