O
O
Oleg Aksenov2019-01-31 14:44:35
Oracle
Oleg Aksenov, 2019-01-31 14:44:35

How to export tables but some of the tables are without data?

Good afternoon, I want to export the database dump, I do it completely, but I can’t understand how to copy only the structure from the selected tables, without data, I try to do it using the command (example):
expdp userbase/base parfile=base.par
In the file itself:

SCHEMAS=userbase
DUMPFILE=base.dmp
DIRECTORY=my_dp_dir
LOGFILE=dump.log
JOB_NAME=dump_job
EXCLUDE=TABLE:"='BONUS_20110101'"
EXCLUDE=STATISTICS
QUERY=TRANSACTION:"WHERE 1=0"

As a result, I have the following questions
  1. EXCLUDE is a full table skip?
  2. How can you exclude not the entire table, but only the data, the rows in it?
  3. And among the scripts I met the value "WHERE 1=0", it specifically does what it does, subtracted that checking the state of the table, but why is it used when dumping?

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2019-01-31
@Takun

>EXCLUDE is a complete table skip?
Yes.
> How it is possible to exclude not all table, but only the data, lines in it?
Write a WHERE 1=0
condition > check the state of the table, but why is it used when dumping?
This is not a test. QUERY allows you to limit the selection of rows and tables when exporting. Specifically, this condition says to select from the TRNSACTION table only those rows for which the condition 1=0 is true. Obviously there are no such rows, so no data will be exported.
You can specify multiple QUERY for multiple tables, for example:
SCHEMAS=userbase
DUMPFILE=base.dmp
DIRECTORY=my_dp_dir
LOGFILE=dump.log
JOB_NAME=dump_job
EXCLUDE=TABLE:"='BONUS_20110101'"
EXCLUDE=STATISTICS
QUERY=TRANSACTION:"WHERE 1=0"
QUERY=MY_TABLE:"WHERE 1= 0"
QUERY=MY_ANOTHER_TABLE:"WHERE 1=0"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question