Loading XMLTYPE data with IMPDP - oracle

I am trying to take a schema from an existing database and place it in a new database.
I've created dependant tablespaces for the data and everything seems to work ok except any tables with XMLTYPE columns error and fail with the error message below. The XMLTYPE are unvalidated CLOBs
KUP-11007: conversion error loading table "SCHEMA"."TABLE_NAME"
ORA-01400: cannot insert NULL into (XML_COLUMN)
KUP-11009: data for row: XML_COLUMN : 0X''
Some investigation seemed to indicate that using TABLES=TABLE_NAME instead of SCHEMA=SCHEMA would help but I have had no such luck.
Note that there are no constraints on this column and that some data could indeed be null (though after the import I get 0 of my several million records)
The command I am using to initiate the datapump is:
impdp TABLES=SCHEMA.TABLE_NAME DIRECTORY=DATA_PUMP_DIR DUMPFILE=oracledpexport.dmp LOGFILE=LOGFILE.LOG TABLE_EXISTS_ACTION=REPLACE

We have been facing some problems during ORACLE import process.
The IMPDP process was not able to import tables containing XML data types.
The reason for this is due to a bug in ORACLE 11g R1 version.
The work around for this is to use EXP process to create a dump instead of EXPDP.
For a permanent fix, we have to explicitly save XML Type columns as CLOB
Also, Oracle has confirmed that this issue has been fixed in ORACLE 11gR2 version.

Related

Export Oracle database to SQL with CLI tools

The goal is to export an existing test Oracle database to SQL so that it can be run in a test pipeline using a Docker images's /container-entrypoint-initdb.d bootstrap. Currently we mount an oradata export, but it's opaque what the actual data is, hence the desire to use SQL so that it can be maintained via git.
I'm aware you can use the GUI Oracle SQL Developer Export Wizard to export a database to SQL.
Though how to do it via command line tools? I've tried many things like:
impdp test/test#XEPDB1 dumpfile=export.dmp directory=DUMP_DIR sqlfile=ddl.sql
And the best I can achieve is exporting the schema, however it is missing the actual data, e.g.
INSERT INTO currencies_countries (currency_id, country_id) VALUES ('EUR', 'CYP');
You have the exp which exports to a dump file that can be imported into another Oracle DB using imp. More recent are the xpdp and impdp.
See: https://oracle-base.com/articles/10g/oracle-data-pump-10g for instance.
What do you mean by "export to SQL"?
The sqldeveloper client tool has the possibility of exporting a table as SQL inserts, for instance. But to export that table by table would be quite an effort. Moreover, if you have millions of rows, those row by row inserts won't perform well.
Better write to tab-separated text files, which, in case of need may be imported into an Oracle DB using sqlldr, or may somehow be imported to some other kind database. Still, tab-separated files won't work well for tables having CLOB, XMLTYPE or some object-type columns.
You could write to a text file by spooling sqlplus output to a file having set linesize ling enough to fit the columns length, set pagesize 0 (no pages).
Or you could write to a file in an Oracle directory via a pl/sql program in which you use utl_file.

Table importation fails with error code ORA-31693

I've been receiving backups from an Oracle database into my Oracle database for 2 years now. My company is running version 10.2.0.1.0 and we are receiving the exports from version 12.1.0.2.0. They are using expdp and I'm using impdp. I added a new column into my database, using this script
ALTER TABLE CONTAINERS
ADD ("SHELL" NUMBER(14, 6) DEFAULT 0 );
After running the above on both databases now when they send an export to me the table in question will not import. I receive the following error.
ORA-31693: Table data object "PAS"."CONTAINERS" failed to load/unload and is being skipped due to error:
ORA-02354: error in exporting/importing data
ORA-02373: Error parsing insert statement for table "PAS"."CONTAINERS".
ORA-00904: "SYS_NC00067$": invalid identifier
This error has been going on for a about two weeks, I have tried to resolve the problem multiple ways, this is my last resort as it were.
Any help is greatly appreciated.
Did you try to track down SYS_NC00067? It looks like a system-assigned column name. This sometimes happens when you add a function-based index. Did you create a function-based index on Shell?

Date datatype in SQL Server gets changed to nvarchar datatype in informatica

I am importing a SQL Server table into Informatica as a source. One of the column's datatype in the SQL Server table is DATE.
When I import it, its showing up as nvarchar in Informatica.
Can someone help me understand this?
Can you please provide more details? Here's a quick test I've done:
I've created a sample table on SQL Server 11 with date, datetime and smalldatetime columns:
Imported it as Source to Informatica 9.5.1:
As you can see, all looks pretty good. Let me know what can I do to replicate the issue. Or simply alter the imported source to reflect the table structure.
I have a table (in SQL Server DB ) with columns defined as 'date'. When I imported, they converted to 'nvarchar (10)'. however, I have another column defined as 'datetime', which imported as datetime properly.
Looks there is an issue with 'date' defined column.
This can also be because of a particular driver you are using to import the table. I haven't tried it any time with SQL Server however have seen this issue with Oracle table imports.
To solve this problem I have to import the table through "DataDirect 7.1 SQL Server Wire Protocol"

import a oracle dumpfile

I have an oracle dump file which I assume has been created using the exp command and not the expdp
The dump file is about 4 GB and I would like to import it into my Oracle 11.2 database.
The dump file which was created has the tablespace as "spaceA" but my tablespace is "spaceB"
So I would need to remap the tablespace as well.
I did use impdp commands before and it used to work perfectly fine but guess as I understand
impdp could only be used on dump file if it was exported using expdp..
Since I am not very familiar with the process of exporting/importing, I would like to get help with this
If the tablespace is not hardcoded in the dmp file create table statements then you should be able to import without a problem. So my suggestion would be to first try something like the following (for more details: http://docs.oracle.com/cd/E11882_01/server.112/e10701/original_import.htm)
imp user/password#instance file=FILE.dmp log=LOG.log fromuser=DMPSCHEMA touser=NEWSCHEMA
If you get IMP-00017 errors. Then you have to take the longer route. You need to first create the tables and then import with ignore=y.
To first create the tables you need the DDL statements, which you can obtain by running:
imp user/password#instance file=FILE.dmp log=LOG.log full=y indexfile=INDEXFILE.log
The INDEXFILE.log will contain all the create table statements. Find and replace "spaceA" with "spaceB", create the tables, and then run the import with the ignore=y parameter which will ignore table creation errors (since tables already exist) and load data:
imp user/password#instance file=FILE.dmp log=LOG.log fromuser=DMPSCHEMA touser=NEWSCHEMA ignore=y

ORACLE import/export CLOB data

I am trying to import an excel file into an oracle table via sql developer. One of the oracle columns is of type CLOB, and during the verification step of the import wizard, i get the following message in the information column: "Data Types CLOB, not supported for import." The data fields i am attempting to import for the CLOB column is empty. Does anybody have any idea what might be wrong? Thanks.
If it is not possible, How can I import/export CLOB data in Oracle?
You just need to use a more recent copy of SQL Developer. We support importing into a CLOB field now from Excel.
And then when it's over, checking the data...

Resources