Oracle export: table doesn't exist - oracle

I am trying to export data in oracle 11g
exp user/password file=dump.dmp tables = (table1)
via sqlplus.
And i get the following error:
About to export specified tables via Conventional Path ...
EXP-00011: USER.TABLE1 does not exist Export terminated
successfully with warnings.
But when i check who is the owner of this table:
SELECT owner, table_name from dba_tables where table_name = 'TABLE1';
I get that the owner of TABLE1 is USER
What should i do to export this table?
UPDATE
Actually, i found a solution. I hope it will help someone else.
Since version 11g Oracle has introduced new feature that is called deferred segment creation. Thus oracle doesn't create table segment if there are now rows in it. So i recreated my table with option 'segment creation immediate'

Actually, i found a solution. I hope it will help someone else. Since version 11g Oracle has introduced new feature that is called deferred segment creation. Thus oracle doesn't create table segment if there are no rows in it. And my table didn't contain any data. So i recreated my table with option 'segment creation immediate'
The solution was found here. There are more options how to fix the problem and an explanation why this thing happens to be in oracle 11g. :)

In addition to the posted answer from Olivia i would like to add some code:
SELECT 'alter table ' || table_name || ' allocate extent;'
from dba_tables where SEGMENT_CREATED = 'NO';
Execute the output and exp again. Your schema will be exported including empty tables.
EDIT:
similar question here, maybe you'll find your solution there.

Change this:
exp user/password file=dump.dmp tables = (table1);
to this:
exp user/password tables = (table1) file=dump.dmp;

You Can Use below query to take table level export from specific user.
exp user/password file=dump.dmp tables = user.table1

Related

Oracle Apex application

We are doing a project on Oracle Apex for university. We have 12 tables and try to build an app for our project. When we try to add a new page for some of our tables (not all of them) we encounter this error error description.
Can someone know how to solve this issue which is really blocking us right now.
We tried everything to solve it. All of our constraints in our tables work. What we don't understand is why we can create sometimes new pages from some tables but for other it does not work.
To me, that (unfortunately) looks like bug as you don't have any impact on Apex' data dictionary tables.
If you connect as a privileged user and check what's exactly being violated, you'll see something like this.
Which table is that constraint related to? Apparently, none:
SQL> select table_name from dba_constraints where owner = 'APEX_200200' and constraint_name = 'WWV_DICTIONARY_CACHE_OBJ_IDX2';
no rows selected
Any luck with (unique) indexes, then? Yes!
SQL> select table_name from dba_indexes where owner = 'APEX_200200' and index_name = 'WWV_DICTIONARY_CACHE_OBJ_IDX2';
TABLE_NAME
------------------------------
WWV_DICTIONARY_CACHE_OBJ
Which columns are used to enforce uniqueness?
SQL> select column_name from dba_ind_columns where index_name = 'WWV_DICTIONARY_CACHE_OBJ_IDX2';
COLUMN_NAME
--------------------------------------------------------------------------------
SECURITY_GROUP_ID
OBJECT_ID
OBJECT_TYPE
SQL>
That's to get you started; you know which table you used for that page so write some more queries and you'll - hopefully - find some move info.
How to "fix" that error? I hope you won't delete or update anything on Apex' dictionary tables! Maybe you'd rather rename that table (to avoid uniqueness violation) and try to use it, with its new name, while creating the page in your application.
If a workspace contains other object types with the same name as a table, APEX data dictionary cache job, ORACLE_APEX_DICTIONARY_CACHE, fails with ORA-00001: UNIQUE CONSTRAINT (APEX_190200.WWV_DICTIONARY_CACHE_OBJ_IDX1)
Workaround: Remove the duplicate object that is not a table. You can list database objects by selecting from sys.dba_objects.
Oracle APEX 19.2 Known Issues

Using oracle seq generator in Informatica Mapping [duplicate]

I use SQL developer and i made a connection to my database with the system user, after I created a user and made a another connection with that user with all needed privileges.
But when I try to proceed following I get the SQL Error
ORA-00942 table or view does not exist.:
INSERT INTO customer (c_id,name,surname) VALUES ('1','Micheal','Jackson')
Because this post is the top one found on stackoverflow when searching for "ORA-00942: table or view does not exist insert", I want to mention another possible cause of this error (at least in Oracle 12c): a table uses a sequence to set a default value and the user executing the insert query does not have select privilege on the sequence. This was my problem and it took me an unnecessarily long time to figure it out.
To reproduce the problem, execute the following SQL as user1:
create sequence seq_customer_id;
create table customer (
c_id number(10) default seq_customer_id.nextval primary key,
name varchar(100) not null,
surname varchar(100) not null
);
grant select, insert, update, delete on customer to user2;
Then, execute this insert statement as user2:
insert into user1.customer (name,surname) values ('michael','jackson');
The result will be "ORA-00942: table or view does not exist" even though user2 does have insert and select privileges on user1.customer table and is correctly prefixing the table with the schema owner name. To avoid the problem, you must grant select privilege on the sequence:
grant select on seq_customer_id to user2;
Either the user doesn't have privileges needed to see the table, the table doesn't exist or you are running the query in the wrong schema
Does the table exist?
select owner,
object_name
from dba_objects
where object_name = any ('CUSTOMER','customer');
What privileges did you grant?
grant select, insert on customer to user;
Are you running the query against the owner from the first query?
Case sensitive Tables (table names created with double-quotes) can throw this same error as well. See this answer for more information.
Simply wrap the table in double quotes:
INSERT INTO "customer" (c_id,name,surname) VALUES ('1','Micheal','Jackson')
You cannot directly access the table with the name 'customer'. Either it should be 'user1.customer' or create a synonym 'customer' for user2 pointing to 'user1.customer'. hope this helps..
Here is an answer: http://www.dba-oracle.com/concepts/synonyms.htm
An Oracle synonym basically allows you to create a pointer to an object that exists somewhere else. You need Oracle synonyms because when you are logged into Oracle, it looks for all objects you are querying in your schema (account). If they are not there, it will give you an error telling you that they do not exist.
I am using Oracle Database and i had same problem. Eventually i found ORACLE DB is converting all the metadata (table/sp/view/trigger) in upper case.
And i was trying how i wrote table name (myTempTable) in sql whereas it expect how it store table name in databsae (MYTEMPTABLE). Also same applicable on column name.
It is quite common problem with developer whoever used sql and now jumped into ORACLE DB.
in my case when i used asp.net core app i had a mistake in my sql query. If your database contains many schemas, you have to write schema_name before table_name, like:
Select * from SCHEMA_NAME.TABLE_NAME...
i hope it will helpful.

Can I migrate tables without the triggers?

I'd like to migrate all tables, data, and indexes for a given Oracle schema (approx 2000 tables).
I do want to migrate the triggers. I am looking for a way to do this without visiting each table and deselecting its triggers.
The simple answer would be to migrate everything and build a script using something like;
select 'drop trigger ' || trigger_name || ';' from all_triggers where owner = 'MYSCHEMA';
If your database is 11g or above, you can use the expdp utility with include=triggers qualifier.

How to create a temporary table in ORACLE with READ ONLY access

I am using CREATE GLOBAL TEMPORARY TABLE script to create a temporary table in the oracle DB but its showing SQL Error: ORA-01031: insufficient privileges. I Want to create a temp table with Read only access. Plz help me out in this.
What we are trying to achieve is:
We have to create a table in the destination database which is always GreenPlum.
In source database(Oracle) we are getting a select query from the USER for example: "select * from ABC A join DEF D on A.Col1=D.col1" then we are creating TEMP TABLE(In case of Oracle) on top of it for example "CREATE GLOBAL TEMPORARY TABLE table101 AS (select * from ABC A join DEF D on A.Col1=D.col1)".
Then using this TEMP table we get the required information from INFORMATION_SCHEMA for example "select * from ALL_TAB_COLUMNS where table_name='table101' ".By this we will get the column_name,data_type,character_maximum_length etc information. Using this information we can get "create table Statement" using Javascript .
Then we store this Create table statement in a variable & run it in Execute Row script(Step in pentaho data integration tool) which will create the Table in the destination DB.
Problem is that we have read only access in oracle. now what to do.
NOTE: In short, we are creating a table in the destination DB using the select statement from the source DB. Means structure of the table in Dest DB depends on the select query in Source DB.
If the target database is also an oracle database then you should be able to set up a database link there to the source database and use a "CREATE TABLE AS SELECT * FROM +source table+#+database link+;"
Whoops, I just noticed that this is from 2014. Oh well, maybe it well help future inquirers.

How to export empty tables in oracle

I have a big problem When i take a dump of database the empty tables are truncated
How i can export the all tables in oracle 10g
exp SYSTEM/password FILE=expdat.dmp
This might be because of these tables may not be extent allocated. Before taking backup you need to identify all the tables that do not have data. Then alter these tables to allocate extent.
ALTER TABLE <table_name> ALLOCATE EXTENT;
Use the below script to alter all tables they do not have extent allocated.
SELECT 'ALTER TABLE '||table_name||' ALLOCATE EXTENT;' FROM user_tables WHERE segment_created = 'NO';
Copy the output and execute it.
You might consider expdp (data pump) instead. There's a parameter CONTENT=METADATA_ONLY that might get you what you want.
I found another solution here.
Oracle has an option called DEFERRED_SEGMENT_CREATION, default true.
from the docs:
If set to true, then segments for tables and their dependent objects (LOBs, indexes) will not be created until the first row is inserted into the table.
I'll sum up the solution from the above link:
SQL> alter system set DEFERRED_SEGMENT_CREATION=FALSE scope=both;
Run the output of the following statement:
SQL> select 'alter table ' || table_name || ' move;' from user_tables where num_rows=0;
This made my exp export empty tables as well.

Resources