Oracle 11g imp erroneously tries to recreate existing tables with CLOBs?

I have a shell script for loading database dumps from both Datapump and the older exp/imp.
Often when loading dumps, I need to rename the schema owner and tablespace names (which is handled by REMAP_SCHEMA and REMAP_TABLESPACE in Datapump).
However I have a whole bunch of dumps created with exp at this point and not that many Datapump dumps yet. As such the old style dumps are handled by the shell script in this way:
1) A first pass imp is run using INDEXFILE to generate a file with the SQL to create tables and indexes. Options also include FROMUSER and TOUSER.
2) A series of sed command edit the SQL file to change the tablespace names (which are schema owner specific in our case).
3) The editted SQL file is run with sqlplus to create the tables and indexes.
4) A second pass imp is run to load the table rows as well as triggers, stored procedures, views, etc. Options include FROMUSER, TOUSER, COMMIT=Y, IGNORE=Y, BUFFER, STATISTICS=NONE, CONSTRAINTS=N
This shell script has been working great for loading exp dump files into Oracle 9 and Oracle 10 databases, but now that I'm trying to load these dumps into Oracle 11, it fails.
The problem is in step 4, the imp program is trying to create some of the tables that already were created with sqlplus in step 2. The problematic tables all seem to have CLOB columns in them. The table creation fails because it tries to use the tablespace names from the dump file, which do not exist in the destination database. And when the table creation fails, imp then decides not to load the rows for those table.
This seems like a bug in the Oracle 11 imp program. I don't understand why it thinks it needs to recreate tables that already exist when those tables have CLOB columns. Is there something different about CLOB columns in Oracle 11 that I should know about that might be confusing imp into thinking that it needs to create tables when they already exist? Maybe I need to do something to those tables in SQL so that imp does not think it needs to recreate them?
I know that the tables with the CLOBs were created correctly because I was trying to find some way to workaround this. For step 4, I tried using DATA_ONLY=Y, in which case imp does not try to create the tables and just loads the table rows. Of course using DATA_ONLY, I don't get a lot of other things like triggers, view and stored procedures. I started to try to get around that by doing 3 passes with imp, so that I could pick up the missing pieces by using an imp pass with ROWS=N, but strangely that has the same problem of trying to recreate the existing tables.

The only solution I've found so far as a workaround is rather convoluted.
1. I took an export using datapump's expdp of SCHEMA1 (in 10g it will skip the table with the xmltype).
2. I imported the data to my empty schema (SCHEMA2) using impdp. To avoid the error that the type already exists with another OID, I used the TRANSFORM=oid:n parameter e.g.
impdp user/pwd dumpfile=noxmltable.dmp logfile=importallbutxmltable.log remap_schema=SCHEMA1:SCHEMA2 TRANSFORM=oid:n directory=MYDUMPDIR
3. I then manually created my xmltype table in the SCHEMA2 and did a select into to load it (make sure you have the select privileges to do so):
INSERT INTO SCHEMA2.XMLTABLE2 SELECT * FROM SCHEMA1.XMLTABLE1;
4. I am still taking an export with exp of the xmltable as well even though I'm not sure I can do anything with it.
Thanks!
Edited by: stacyz on Jul 28, 2009 9:49 AM

Similar Messages

  • Rename the existing table with date suffix

    Hi,
    I'm trying to rename a table with date suffix at the end of the table name, and drop the date suffix table which is greater than 7 days. for that I have the below sql, I have not included the drop syntax in this.
    I'm not able to rename with the date suffix in the below sql, syntax error at '+'  
    DECLARE
    @TPartitionDate date
    IF EXISTS (SELECT * FROM sysobjects WHERE Name = 'IIS_4')
    BEGIN
    SELECT
    @TPartitionDate = MAX(PartitionDate)
    FROM PartitionLog (NOLOCK)
    EXEC sp_rename 'IIS_4','IIS_4_'+ @TPartitionDate
    END

    create table Test(sno int)
    DECLARE
    @TPartitionDate date = getdate()
    declare @a varchar(200)
    IF EXISTS (SELECT * FROM sysobjects WHERE Name = 'Test')
    BEGIN
    select @a='TEST_'+ cast(@TPartitionDate as varchar(10))
    EXEC sp_rename 'TEST',@a
    END
    drop table [test_2015-04-23]
    Hope it Helps!!

  • How to create a table from an existing table with new column

    Hi !
    Please help me.
    I want to create a table from an existing table with data and add two new column to the new table.
    What will be the syntax?

    craete table new_table as select a.*, 'somevalue' new_col1, 'somevalue'
    new_col2 from old_table a;Also there is a pitfall - newly created table will accept column type and precision from the select statement, so further you can be needed to modify columns
    if you want to have VARCHAR2 instead of CHAR for example:
    SQL> create table new_dept as select dept.*, 'New data' new_col from dept;
    Table created.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            CHAR(8)
    SQL> alter table new_dept modify (new_col varchar2(8));
    Table altered.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            VARCHAR2(8)Rgds.
    Didn't see michael's post - it reflects the fix for this problem using CAST.
    Message was edited by:
    dnikiforov

  • Troubles when trying to transfer a table with hierarchical column to a tree

    In WD for ABAP, I encounter many troubles when trying to transfer a table with hierarchical column to an actual tree. In my UI, the tree is in the left pane and the detail for a node is in the right.
    1. With hierarchical table, I can bind the dataSource of the table directly to the context node in View which is mapped to a context node in component controller which is a DDIC structure. But with a tree, is it possible to map the dataSource of the tree or node in tree to context node in component controller?
    2. With hierarchical table, when lead selection changed, the detail info in the right pane will change automatically. But with a tree, it seems to have to be implemented via action by myself.
    Can anyone give some suggestions to overcome these troubles?

    Wei,
    <i>With tree table, the dataSource of the table is just bound to the context node ORG_UNIT</i>
    Hmmm... You said, that this node resides in component controller, not in view controller. Or does it?
    Any recursive node that can be displayed with tree table can be displayed with tree as well. Period.
    1. Create tree and bind data source to the same node as table data source.
    2. Create tree node type and bind it to the same node again.
    3. Create one additional calculated attribute in forementioned node (type boolean) that inverts/negates attribute for table column "hasChildren" to tree node "isLeaf".
    4. That's all.
    VS

  • Partitioning an Existing Table with data

    Hi All,
    I am few tables with data, I need to Partition the table without affecting existing table values is it possible?.
    if yes then Please suggest me some ideas to archive that..
    Thanks & Regards
    Sami

    Hi All,
    I Need to partition for existing table with 1 million records
    1. First partition should be created for 6 months
    2.Second partition should created for 1 year.
    3.So as of now we have 6 months Data in production + another 6 months data in First partition + another 1 year data in Second partition.
    4.More than 2 year’s data’s should be moved other partition or archived.
    kindly provide your valuabe suggestion.
    Thanks & Regards
    Sami

  • How add primary key constraint to already existing table with data

    I want apply primary key constraint to already existing table with data
    is there any command or way to do

    Alternatively, assuming you want to ensure uniqueness in your primary key column you can do this:
    alter table <table name> add constraint <cons name> primary key (col1,col2) exceptions into <exception_table>
    If the altter table statement fails this will populate the EXCEPTIONS table with the rows that contain duplicate values for (col1,col2).
    You will need to run (or get a DBA to run) a script called UTLEXCPT.SQL (which will be in the $ORACLE_HOME/rdbms/admin directory) if you don't already have an EXCEPTIONS table.
    Cheers, APC

  • Can Oracle 11g RAC and 10g RAC co-exists on same host

    Can somebody tell me if it is possible to have Oracle 11g and 10g RAC installed and configured on same host.
    Thanks,
    -Zubair

    user10948684 wrote:
    Can somebody tell me if it is possible to have Oracle 11g and 10g RAC installed and configured on same host.
    Thanks,
    -ZubairYou have to use 11G Clusterware , if you want to use 11g Database and you can use 10g Database as well.
    (You can not use 10g Clusterware and 11g Clusterware on the same host...)
    But you can use 10g Database and 11g Database on the same host, But you have to use 11G Clusterware.

  • Oracle 11g and PRO*C :  pre-compile errors only with 11g !

    Hi !
    I didn't find a forum specific to pro*c, so here i am.
    I've downloaded Oracle 11g and recompiled our applications using pro*c
    We currently precompiling without any problem our sources against Oracle 7, 8, 9, 10.
    With Oracle 11g, it doesn't work !
    every EXEC SQL followed by a command works.
    every EXEC SQL followed by a query generates the same error.
    Example :
    char *oracle_date_courante()
         static char buf[SIZE_ORADATE+1];
         EXEC SQL SELECT sysdate into :buf from DUAL;
         if(ORA_SQLERROR())
              oracle_error("sélection date courante");
              buf[0]=0;
         return buf;
    PRO*C output :
    Erreur Ó la ligne 105, colonne 2 dans le fichier src\oracle.pc
    EXEC SQL
    .1
    PLS-S-00000, SQL Statement ignored
    erreur sÚmantique Ó la ligne 105, colonne 2, fichier src\oracle.pc:
    EXEC SQL
    .1
    PCC-S-02346, PL/SQL a trouvÚ des erreurs sÚmantiques
    So, we investigated... And found that thoses errors come when we use the option sqlcheck=semantics.
    If we use an inferiour check level, it works but because we use PL/SQL keywords, pro*c prints errors and wants us to provide the 'semantics' sqlcheck level !
    So, it's a vicious circle !
    Any ideas ?
    Thanks...
    Vincent

    Adding the option common_parser=yes removes the errors !
    But brings errors linked to the PL/SQL parser such like
    CSF-S-00000, ORA-06544: PL/SQL : erreur interne, arguments : [55916], [], [], []
    1>, [], [], [], []
    1>ORA-06553: PLS-801: erreur interne [55916]
    Really vicious..and still not precompiling !
    By the way : Server is 10.2.0.1... and i guess thoses errors are normal since the common parser is not available in this version...
    So bye bye option common_parser and i'm back to my orignals errors.
    Message was edited by:
    Vicenzo

  • Oracle 11g sql to find difference from two table data

    I have two tables ACTUAL AND ESTIMATE having unique column(sal_id, gal_id) and amount, tax, date columns.
    ACTUAL table
    actual_id, sal_id, gal_id, process_flag, amount, tax     date
    A1 101 201 Y 10 1 27-Aug-12
    A2 102 202 Y 20 2 27-Aug-12
    A3 102 202 N 30 3 29-Aug-12
    A4 302 402 N 40 3 30-Aug-12
    ESTIMATE table
    estimate_id, sal_id, gal_id, process_flag, amount, tax  date
    E1 301 401 Y 5 1 19-Aug-12
    E2 302 402 Y 45 4 20-Aug-12
    E3 302 402 Y 50 5 25-Aug-12
    E4 301 403 Y 10 2 27-Aug-12
    E5 301 403 N 15 3 28-Aug-12
    E6 101 201 Y 12 3 29-Aug-12
    Now My FINAL table, 1) Should have record for unprocessed (process_flag='N') from ACTUAL/ESTIMATE table for difference in amount and tax for (sal_id + gal_id) combination. If more than one processed record there, then max (date) should be consider.
    FINAL table
    actual_id, estimate_id, sal_id, gal_id, amount, tax
    A3 null 102 202 10 1 (A3-A2 actual-actual)
    A4 null 302 402 -10 -2 (A4-E3 actual-estimate with max date)
    null E5 301 403 5 1 (E5-E4 estimate-estimate)
    null E6 101 201 2 2 (E6-A1 estimate-actual)
    So basically I need a query for (A-A) U (B-B) U (A-B) U (B-A).
    I am using Oracle 11g Please help me.
    Edited by: Suresh on Aug 31, 2012 7:38 PM
    Edited by: Suresh on Aug 31, 2012 7:38 PM
    Edited by: Suresh on Aug 31, 2012 10:53 PM

    You need to provide better explanation here.A-A is always null.
    You might be looking for something like this..
    Untested version and also i cannot read your mind
    select actual_id, sal_id, gal_id, process_flag,ld_amount,ld_tax,e_date
    from(
    select actual_id, sal_id, gal_id, process_flag,e_date, amount-lead(amount) over(partition by sal_id, gal_id order by e_date desc) ld_amount,
    tax-lead(tax) over(partition by sal_id, gal_id order by e_date desc) ld_tax,
    rank()  over(partition by sal_id, gal_id order by e_date desc)rnk
    from
    (select * from actual a union
    select * from estmt e)
    ) where rnk=1

  • Creating Partitions in Existing tables with Data

    Hello everyone,
    I want to know what the best way of creating partitions, in tables having data, is .. ???
    thanks
    Rossy Rocs

    There are two ways :
    1a Create a new Partitioned Table
    1b Copy data from the existing table to the new table
    1c Create Indexes
    1d Rename old table
    1e Rename new table
    OR
    2 Use DBMS_REDEFINITION
    See
    http://www.oracle-base.com/articles/misc/PartitioningAnExistingTable.php
    Hemant K Chitale

  • Recreating a table with child table dependencies

    Hi.
    I have two tables P (Parent) and C (child), with foreign key dependencies. How can I recreate the P table without losing the child dependencies?
    Thanks in Advance.

    934086 wrote:
    Well I got this as an interview question. So what I guess what it means is to recreate the table for administrative purposes (maintenance/defragmentation etc) and later recreate the dependencies in to the C table.If this is a good interviewer, they will be expecting you to ask some questions to find out the restrictions on what you're allowed to do.
    Obviously you could extract any dependency information from the data dictionary, so it won't be "lost". Then you could switch the database into restricted mode and/or shut down the listener. Drop any RI constraints, recreate table, recreate constraints, restart listener, take database out of restricted mode. However, this might be a catastrophic strategy from the perspective of the business - so if you try to answer the question without first asking questions (or at least starting with "there are various methods, depending on the restrictions you need to impose from a business perspective, for example ...)
    Regards
    Jonathan Lewis

  • Create another table from existing table with distinct elements

    I have a table applying select clause on which gives following result.
    SQL> select *
    2 from BRANCH_MSTR;
    BRANCH_NO NAME
    B1 Vile Parle(HO)
    B2 Andheri
    B3 Churchgate
    B4 Sion
    B5 Borivali
    B6 Matunga
    B1 C.S.Pur
    B1 Shahidnagar
    B1 Shahidnagar
    I want to create another table ACCT_DTLS from this table which has only one column BRANCH_NO, but has only distinct elements.
    I tried this,
    SQL> create table ACCT_DTLS
    2 (BRANCH_NO)
    3 as
    4 select BRANCH_NO
    5 from BRANCH_MSTR;
    Table created.
    SQL> select 8
    2
    SQL> select *
    2 from ACCT_DTLS;
    BRANCH_NO
    B1
    B2
    B3
    B4
    B5
    B6
    B1
    B1
    B1
    9 rows selected.
    But its not working.

    HI Asit,
    try like this
    sql>create table table-name as (select distinct column-name from another-table);example
    SQL> create table temp_emp2 as (select distinct deptno from scott.emp);
    Table created.
    SQL> select * from temp_emp2;
        DEPTNO
            30
            20
            10

  • Oracle 11g client for Windows 8 - 64bit exists impromptu without error msg

    HI all.
    I just got a new laptop and its running Windows 8 Pro 64 bit os. I downloaded Oracle Client 11g 64bit from the oracle website. After clicking the setup.exe installer a msg box pops up saying '[INS -13003] Environment does not meet the requirement' with no further information. Yet i go ahead and continue becos i was told it was a general error and should be ignored.
    After that, the GUI comes up. I select Administrator (or any) installation type, the language, specify my installation location but on performing prerequisite check, it exists without error. Any help?

    The 12c client install is documented at Contents
    - it is a pretty straightforward process once you have downloaded the software. Did you try to install the full client or the Instant Client ?
    11.2.0.1 install may or may not complete correctly - if it does, there is no guarantee that it will function as expected
    HTH
    Srini

  • Oracle 11g INSTANT CLIENT for Mac OS 10.8 with SQLLDR and WRAP

    To Oracle please upgrade INSTANT Client 11g and/or 12c (future) and include two additional utilities I always use SQLLDR and WRAP. Currently I have to open a Linux VM to wrap and use SQL*Loader. I would prefer to do it all in the terminal window.
    Actually I would like to see sqlldr and wrap utilities included with all instant clients (Linux, Windows, Mac OS, etc)

    Can you see the difference? (btw i am sure, genezi -v as sidadm worked with 11.2.0.1)
    sidadm > /oracle/client/10x_64/instantclient_10204/genezi -v
    Client Shared Library 64-bit - 10.2.0.4.0
    System name:    HP-UX
    Release:        B.11.31
    Version:        U
    Machine:        ia64
    sidadm > genezi -v
    Client Shared Library 64-bit - 11.2.0.2.0
    System name:    HP-UX
    Release:        B.11.31
    Version:        U
    Machine:        ia64
    Or
    sidadm > strings /oracle/client/10x_64/instantclient_10204/libclntsh.so | grep 'Release'
    Oracle Database 10g Release 2 Patch Set 3                            10.2.0.4.0
    Or check in SAPGui -> Menu -> Status
    Cheers Michael
    PS: the cause for the behavior is, that there is always a client library in the $ORACLE_HOME directory too. And you have to be careful which one you (genezi) picks...

  • Hello all trying to update a table with utl input file

    Hi all
    please kindly help me with the below :
    i have a table having 100 rows ,where i have to update the vxxx_DESC column from teh input file ,when the xxx_CODE is equal to vxxx_CODE from teh input file which is 3 didgit numeric format like the below :
    exmp csv nput fie: where i have some duplicate records in it.
    238,FKP
    208,DKK
    242,FJD
    978,EUR
    978,EUR
    978,EUR
    953,XPF
    978,EUR
    950,XAF
    from the below script, in the log file its writing for me like -
    Total Records present in Input file : 275
    Total Records updated sucessfully in table : 186
    But the update count is wrong whihc is more than the existing records. how do i get the exact update count avoiding the duplicates from the input file.
    Please kindly help.
    DECLARE
    finfile UTL_FILE.file_type;
    flogfile UTL_FILE.file_type;
    vglobal_name VARCHAR2 (300) := NULL;
    vlogfile_PATH VARCHAR2 (500) := NULL;
    vINFILE_PATH VARCHAR2(100) := NULL;
    vinfile_name VARCHAR2 (400) := 'INPUTFILE.csv';
    vlogfile_name VARCHAR2 (500) := 'INPUTFILE.log';
    vxxx_CODE CUN_CODE.xxx_CODE%TYPE :=NULL;
    vxxx_DESC CUN_CODE.xxx_DESC%TYPE :=NULL;
    vinput_rec VARCHAR2 (500) := NULL;
    ntotal_rec NUMBER (20) := 0;
    nUPD_rec NUMBER (20) := 0;
    BEGIN
    DBMS_OUTPUT.ENABLE (50000);
    IF INSTR(vGlobal_name,'RAMAN') > 0
    THEN
    vLOGFILE_PATH := '/home/log/';
    vINFILE_PATH := '/home/rpts/';
    ELSE
    DBMS_OUTPUT.PUT_LINE('Incorrect DB instance, so exiting from: ' || vGlobal_name);
    RETURN;
    END IF;
    BEGIN
    flogfile := UTL_FILE.fopen (vlogfile_PATH, vlogfile_name, 'W');
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ( 'ERROR WHILE OPENENING LOG FILE : '
    || SUBSTR (SQLERRM, 1, 200)
    END;
    BEGIN
    finfile := UTL_FILE.fopen (vINFILE_PATH ,vinfile_name, 'R');
    LOOP
    vxxx_CODE :=null;
    vxxx_DESC :=null;
    BEGIN
    UTL_FILE.get_line (finfile, vinput_rec);
    vinput_rec:=TRIM(vinput_rec);
    ntotal_rec := ntotal_rec + 1;
    vxxx_CODE := SUBSTR(vinput_rec,1,INSTR(vinput_rec,',',1,1)-1);
    vxxx_DESC := SUBSTR(vinput_rec, INSTR(vinput_rec,',',1,1)+1);
    BEGIN
    UPDATE CUN_CODE
    SET xxx_CODE= vxxx_CODE
    WHERE xxx_DESC= vxxx_DESC ;
    nUPD_rec := nUPD_rec+SQL%ROWCOUNT;
    EXCEPTION
    WHEN OTHERS
    THEN
    UTL_FILE.put_line
    (flogfile,
    'ERROR FOR WHILE UPDATING : '
    || vxxx_CODE
    || SUBSTR (SQLERRM, 1, 250)
    END;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    UTL_FILE.put_line
    (flogfile,
    'No more records in the input file.So Exiting the update :'
    EXIT;
    WHEN OTHERS
    THEN
    UTL_FILE.put_line
    (flogfile,
    'ERROR WHILE READING FROM INFILE. '
    || SUBSTR (SQLERRM, 1, 250)
    EXIT;
    END;
    END LOOP;
    UTL_FILE.put_line (flogfile,
    'Total Records present in Input file : ' || ntotal_rec
    UTL_FILE.put_line (flogfile,
    'Total Records updated sucessfully in table : ' || nUPD_rec
    DBMS_OUTPUT.PUT_LINE('Total Records updated in table : ' || nUPD_rec);
    DBMS_OUTPUT.PUT_LINE('Total Records present in Input file : ' || ntotal_rec);
    EXCEPTION
    WHEN OTHERS
    THEN
    UTL_FILE.put_line (flogfile,
    'ERROR WHILE OPENING INFILE '
    || vinfile_name
    END;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ( 'ERROR WHILE GETTING GLOBAL NAME'
    || SUBSTR (SQLERRM, 1, 250)
    END;
    <<skip_loop>>
    IF UTL_FILE.is_open (finfile)
    THEN
    UTL_FILE.fclose (finfile);
    END IF;
    IF UTL_FILE.is_open (flogfile)
    THEN
    UTL_FILE.fclose (flogfile);
    END IF;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ( 'ERROR WHILE ACCESSING DB '
    || SUBSTR (SQLERRM, 1, 250)
    END;
    /

    975482 wrote:
    i have a table having 100 rows ,where i have to update the vxxx_DESC column from teh input file ,when the xxx_CODE is equal to vxxx_CODE from teh input file which is 3 didgit numeric format Looks like your code does exactly the opposite :
    UPDATE CUN_CODE
    SET xxx_CODE= vxxx_CODE
    WHERE xxx_DESC= vxxx_DESC ;Additional suggestions :
    1) create a directory object pointing to the location of your input file
    2) create an external table to read the file
    3) use a single UPDATE or MERGE statement to do the job, instead of this mess

Maybe you are looking for

  • Hard drive restore- issue

    I had to restore my hard drive (mac) and reloaded from a Backup (yeah!) but Adobe requires that I Uninstall(done), run a Cleanup (done) and reinstall from a new downloaded DMG file.  (why can't this be easier?) Upon trying to start the install I get

  • How do i send photo's?

    Hi, This is my 1st Blackberry and i'm really pleased with it, but i can't seem to be able to send photo's, can anyone help please. Thanks. Solved! Go to Solution.

  • HT4191 iPad Mini Sync issues?

    Hi, I have just got an iPad Mini (32gb) 6.0.2 & I would like to sync this with my iPhone 4s (16gb) 6.0.1. Having tried 'sync over Wi-Fi', etc nothing seems to work & all I have been able to sync is my photo stream. Please could somebody offer some he

  • Reg:User Exit For Invoice

    Hi All, I have an requirement that when during creation of invoice i have to update some data's to ztables and during deletion of invoice i have to update some data's. Is it possible? Is there any user exit for this scenario? Kindly give your idea's

  • OWB10gR2

    Hello, I was trying to upgrade Source locations to Control Center. It was giving version control problem. My source is Oracle 9.2. Why it is not upgrading into control center? Source can be any type or any version. Why it is giving error saying that