?
Solved

Oracle Export Utility, with where conditions to export only a part of the table data

Posted on 2008-10-23
9
Medium Priority
?
1,458 Views
Last Modified: 2013-12-18
The Oracle User called QUIZ contains the table called CITY has over 2 million records.
This table has 20 columns, no importance for their names.
Please suppose that 3 columns of 20 are the following:

a) DAYS of type DATE;
b) SUN of type NUMBER;
c) RAIN of type VARCHAR2(50).

We would like to create a PARTIAL COPY of this table in another Oracle user called HISTORICAL, fetching only the records with:

a) DAYS >= to_date('01/01/2007','DD/MM/YYYY');
b) SUN >= 3;
c) RAIN beginning with the string 'SHARK'

I think it's too heavy to open a cursor on the source table, inserting record for record if satisfying the three conditions, so I would like to use the export utility with a file containing the conditions.

Could you please help me?
0
Comment
Question by:hc2342uhxx3vw36x96hq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 2

Assisted Solution

by:stanimirp
stanimirp earned 80 total points
ID: 22784305
0
 
LVL 1

Author Comment

by:hc2342uhxx3vw36x96hq
ID: 22784413
Sorry, I need the answer to MY question, not a link to general definition of export utility.
0
 
LVL 27

Assisted Solution

by:sujith80
sujith80 earned 1000 total points
ID: 22784650
I think you can simple do a INSERT INTO ... SELECT
HISTORICAL should have read access to CITY table of QUIZ.

insert /*+ APPEND */ into HISTORICAL.CITY
select * from QUIZ.CITY
where DAYS >= to_date('01/01/2007','DD/MM/YYYY') and SUN >= 3 and RAIN like 'SHARK%';

If you MUST go for sql loader here is the command.
exp username/pwd tables=CITY file=dump_file_name.dmp QUERY='where DAYS >= to_date(''01/01/2007'',''DD/MM/YYYY'') and SUN >= 3 and RAIN like ''SHARK%'''
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 1

Author Comment

by:hc2342uhxx3vw36x96hq
ID: 22784848
sujith80, with your exp command, can I import the table CITY into a different tablespace owned by the HISTORICAL Oracle user?

0
 
LVL 27

Assisted Solution

by:sujith80
sujith80 earned 1000 total points
ID: 22784959
>>  into a different tablespace
Yes, create the table in a differnt tablespace before the import and run the import with ignore=Y
0
 
LVL 1

Author Comment

by:hc2342uhxx3vw36x96hq
ID: 22785175
C:\>exp user/password@SID

Export: Release 10.2.0.3.0 - Production on Thu Oct 23 14:05:46 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


EXP-00056: ORACLE error 6550 encountered
ORA-06550: line 1, column 41:
PLS-00302: component 'SET_NO_OUTLINES' must be declared
ORA-06550: line 1, column 15:
PL/SQL: Statement ignored
EXP-00000: Export terminated unsuccessfully

0
 
LVL 27

Assisted Solution

by:sujith80
sujith80 earned 1000 total points
ID: 22787805
Contact your dba
0
 
LVL 2

Accepted Solution

by:
barfi earned 920 total points
ID: 22787827
If you are trying to IMPORT object owned by a user into different tablespace- try  using DataPump in10g. This works great without creating any thing. There is a parameter called REMAP_TABLESPACE- USING THIS PARAMETER you can create the objects that belong to a tablespace in the source to another in the target. Syntax is:
Remap_Tablespace=source_tablespace:target_tablespace
 So for example if you need to import objects owned by user1 and are stored in user1_tblspace with data pump you ca import these objects to the different tablespace user1_tblspace. Here is the command:
Syntax:
impdp directory+mydumpdir dumpfile=abc.dmp
remap_schema=user1:user2
above command will create all the objects owned by user1 in user2 schema
but in your case do this:
remap_tablespace=user1tblspace:user2_tablespace
This works if you try to do it thru GUI (OEM) but you have to set directory and authenticate it (read-write privliges). It is one time work but I bet you will not go back to old exp/emp utilities once you use the DATAPUMP in 10g.
Hope it helps...
here is the simple link for all the parameters also:
http://www.oracle-base.com/articles/10g/OracleDataPump10g.php

0
 
LVL 1

Author Closing Comment

by:hc2342uhxx3vw36x96hq
ID: 31509120
Thank you!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question