I tried to import (TABLES, PROCEDURE, FUNCTION etc) from a dump file. I did a mistake by
executing KILL -9 <PROCESS_ID> while import was still going on.
So, I started to import again. Now, I did another mistake by NOT mentioning
TABLE_EXISTS_ACTION=TRUNCATE . So, tables have been imported with duplicate records.
I want to get rid of duplicate data. There are more than 500 tables involved.
I am planning to import again by first truncating the table and then importing data only.
Below is the import command I have come up with. Will this command import ONLY table data(records) by first
truncating the table and then insert only the data?
impdp DIRECTORY=MY_DIRECTORY dumpfile=EXP_MY_DUMP.dmp INCLUDE=TABLE_DATA TABLE_EXISTS_ACTION=TRUNCATE
I could try executing myself and find out if that works. But, I have already tried twice and failed.
Also, I don't want to again import INDEX, SEQUENCES etc. Just table records.
Remove INCLUDE=TABLE_DATA. That will not execute create table.. that should work.
Related
Oracle Import missing tables
I am using this command to import tables.
imp FILE=D:\swr\SWR_18_08_2019.dmp FROMUSER=SWR TOUSER=SWR
I expect the output of all tables need to import.
Any help would be appreciated.
What happens if you modify the command to
imp swr file=D:\swr\SWR_18_08_2019.dmp log=swr_imp.log ignore=y
In other words:
specify username which will own data you import (swr)
include log file (to see what's going on)
use ignore parameter which will skip CREATE TABLE statements if tables already exist and will load only data
fromuser/touser seems to be unnecessary
Then run it and see what happens. If it still doesn't work, please, post an excerpt from the log file so that we'd see the result.
I am trying to use imp to Import a table from user abdou2 to user abdou1.
I exported my table from abdou2 inside a file dump using:
exp abdou2/root file=CLIENTS.dmp tables=CLIENTS
Then, I created in abdou1 an exact same Table but empty using:
CREATE TABLE imp_CLIENTS AS SELECT * FROM abdou2.CLIENTS WHERE 1=2;
And I want to directly by using imp import abdou2.CLIENTS to abdou1.imp_CLIENTS. Both instructions mentioned above worked. Is it possible to do? Thank you
A better working solution was to, indeed, use expdp/impdp.
I want to import a DB using impdp. I would like to import the INDEX NAMES and after that, rebuild it manually.
I used the option
EXCLUDE=index
but then I can't find the index in the table all_indexes
Is there a way to import the index without build them, and build them manually afterwards ?
Import all tables and data with following parameters
SQLFILE=create_index.sql include=index
This parameter doesn't create any index but create a sql file with all create index sql statements. Using this file you can create index manually after finishing table and data import.
you can also export/ import only metadata, this will import only table & index structures.
CONTENT=metadata_only
Let me give an example: I exported 1TB of data yesterday. Today, the database got another 1GB of data. If I try to import the data again today, Sqoop will import 1TB+1GB of data, then I am merging it. So it's a headache. I want to import only new data and append it to the old data. In this way, on a daily basis, I'll pull the RDBMS data into HDFS.
You can use sqoop Incremental Imports:
Sqoop provides an incremental import mode which can be used to retrieve only rows newer than some previously-imported set of rows.
Incremental import arguments:
--check-column (col) Specifies the column to be examined when determining which rows to import.
--incremental (mode) Specifies how Sqoop determines which rows are new. Legal values for mode include append and last modified.
--last-value (value) Specifies the maximum value of the check column from the previous import.
Reference: https://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html#_incremental_imports
For Incremental Import: You would need to specify a value in a check column against a reference value for the most recent import. For example, if the –incremental append argument was specified, along with –check-column id and –last-value 100, all rows with id > 100 will be imported. If an incremental import is run from the command line, the value which should be specified as –last-value in a subsequent incremental import will be printed to the screen for your reference. If an incremental import is run from a saved job, this value will be retained in the saved job. Subsequent runs of sqoop job –exec some Incremental Job will continue to import only newer rows than those previously imported.
For importing all the tables at one go, you would need to use sqoop-import-all-tables command, but this command must satisfy the below criteria to work
Each table must have a single-column primary key.
You must intend to import all columns of each table.
You must not intend to use non-default splitting column, nor impose any conditions via a WHERE clause.
Reference: https://hortonworks.com/community/forums/topic/sqoop-incremental-import/
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