blog Oracle blog in Spanish

Oracle Data Pump: Practical Export and Import Techniques Using ` EXCLUDE ` and `QUERY`

En esta entrada vamos a ver varios casos con export que pueden ser de gran utilidad.

En muchas ocasiones, nos encontramos con la necesidad de excluir objetos en nuestro export o filtrar datos específicos en nuestro expd, usamos los parámetros EXCLUDE (omitir objetos) o QUERY (filtrar los registros a exportar).

Vamos a utilizar el esquema de ejemplo Oracle (HR) para realizar esta práctica.

Recordamos las tablas del esquema:

1 – EXCLUDE A SPECIFIC TABLE

Let's export the schema, and let's exclude one table—for example, REGIONS.

expdp system/**** directory=export schemas=HR EXCLUDE=TABLE:»IN(‘REGIONS’)» dumpfile=export_exclude_table.dmp logfile=export_exclude_table.log metrics=y logtime=all

Nota: importante que no haya espacios entre en las sentencias exclude con el resto de sentencia para evitar problemas en el exp


oracle@localhost ~]$ expdp system/**** directory=export schemas=HR EXCLUDE=TABLE:" IN('REGIONS')" dumpfile=export_exclude_table.dmp logfile=export_exclude_table.log metrics=y logtime=all

Export: Release 19.0.0.0.0 - Production on Tue Aug 18 15:06:24 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
UDE-00014: invalid value for parameter, 'exclude'.

Nota: Si tienes dos esquemas donde existe una tabla con el mismo nombre no podrás excluirla, aunque en el comando pongas SCHEMA.TABLE o incluso añadiendo alguna sentencia exclude cómo la siguiente EXCLUDE=TABLE:»IN (SELECT table_name FROM dba_tables WHERE owner=’HR’ AND table_name=’REGIONS’)». Esto es un error conocido de expdp donde se excluirá la tabla REGIONS de los dos esquemas. Si este es tu caso, como alternativa se suelen hacer dos export por separado. uno sin REGIONS en el esquema a excluir y otro con todas las tablas al completo.

Ejemplo. Excluimos tablas JOBS y JOBS1 del export de HR.

[oracle@localhost ~]$ cat exclude.par 
DIRECTORY=export
SCHEMAS=HR
EXCLUDE=TABLE:"IN('JOBS','JOBS1')"
DUMPFILE=export_exclude_tables.dmp
LOGFILE=export_exclude_tables.log
METRICS=Y
LOGTIME=ALL


<pre>[oracle@localhost ~]$ expdp system/**** parfile=exclude.par

Export: Release 19.0.0.0.0 - Production on Wed Aug 19 10:08:46 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
19-AGO-26 10:08:50.439: Iniciando &quot;SYSTEM&quot;.&quot;SYS_EXPORT_SCHEMA_01&quot;: system/******** parfile=exclude.par
19-AGO-26 10:08:51.305: W-1 El inicio ha tardado 1 segundos
19-AGO-26 10:08:56.040: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TABLE_DATA
19-AGO-26 10:08:56.534: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
19-AGO-26 10:08:56.709: W-1 Se han terminado 18 INDEX_STATISTICS objetos en 0 segundos
19-AGO-26 10:08:57.217: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
19-AGO-26 10:08:57.285: W-1 Se han terminado 6 TABLE_STATISTICS objetos en 1 segundos
19-AGO-26 10:09:05.274: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/STATISTICS/MARKER
19-AGO-26 10:09:05.543: W-1 Se han terminado 1 MARKER objetos en 8 segundos
19-AGO-26 10:09:05.700: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/USER
19-AGO-26 10:09:05.794: W-1 Se han terminado 1 USER objetos en 0 segundos
19-AGO-26 10:09:05.874: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/SYSTEM_GRANT
19-AGO-26 10:09:05.960: W-1 Se han terminado 7 SYSTEM_GRANT objetos en 0 segundos
19-AGO-26 10:09:06.043: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/ROLE_GRANT
19-AGO-26 10:09:06.125: W-1 Se han terminado 1 ROLE_GRANT objetos en 0 segundos
19-AGO-26 10:09:06.201: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/DEFAULT_ROLE
19-AGO-26 10:09:06.282: W-1 Se han terminado 1 DEFAULT_ROLE objetos en 0 segundos
19-AGO-26 10:09:06.462: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLESPACE_QUOTA
19-AGO-26 10:09:06.537: W-1 Se han terminado 1 TABLESPACE_QUOTA objetos en 0 segundos
19-AGO-26 10:09:06.883: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
19-AGO-26 10:09:06.965: W-1 Se han terminado 1 PROCACT_SCHEMA objetos en 0 segundos
19-AGO-26 10:09:09.460: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/SEQUENCE/SEQUENCE
19-AGO-26 10:09:09.547: W-1 Se han terminado 3 SEQUENCE objetos en 0 segundos
</pre>

2 – EXCLUDE INDICES

To drop all indexes from all schemas.

expdp system/**** directory=export full=yes EXCLUDE=INDEX dumpfile=export_exclude_index.dmp logfile=export_exclude_index.log metrics=y logtime=all

To exclude a specific index. If there are two indexes in different schemas, the restriction is the same as that explained at the table level.

expdp system/**** directory=export full=yes EXCLUDE=INDEX:»IN(‘EMP_NAME_IX’)» dumpfile=export_exclude_index.dmp logfile=export_exclude_index.log

3 – EXCLUDE INDEXES – CONSTRAINTS

In this example, we exclude the EMP_NAME_IX index and the JOB_ID_PK constraint.

expdp system/**** directory=export full=yes EXCLUDE=INDEX:»IN(‘EMP_NAME_IX’)»,CONSTRAINT:»IN(‘JOB_ID_PK’)» dumpfile=export_exclude_indexes.dmp logfile=export_exclude_indexes.log

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Iniciando "SYSTEM"."SYS_EXPORT_FULL_01":  system/******** directory=export full=yes EXCLUDE=INDEX:IN('EMP_NAME_IX'),CONSTRAINT:IN('JOB_ID_PK') dumpfile=export_exclude_indexes.dmp logfile=export_exclude_indexes.log 
Procesando el tipo de objeto DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
Procesando el tipo de objeto DATABASE_EXPORT/NORMAL_OPTIONS/TABLE_DATA
Procesando el tipo de objeto DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS
Procesando el tipo de objeto DATABASE_EXPORT/STATISTICS/MARKER
Procesando el tipo de objeto DATABASE_EXPORT/PRE_SYSTEM_IMPCALLOUT/MARKER
Procesando el tipo de objeto DATABASE_EXPORT/PRE_INSTANCE_IMPCALLOUT/MARKER
Procesando el tipo de objeto DATABASE_EXPORT/TABLESPACE
Procesando el tipo de objeto DATABASE_EXPORT/PROFILE
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/USER
Procesando el tipo de objeto DATABASE_EXPORT/RADM_FPTM
Procesando el tipo de objeto DATABASE_EXPORT/GRANT/SYSTEM_GRANT/PROC_SYSTEM_GRANT
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/GRANT/SYSTEM_GRANT
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/ROLE_GRANT
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/DEFAULT_ROLE
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/ON_USER_GRANT
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLESPACE_QUOTA
Procesando el tipo de objeto DATABASE_EXPORT/RESOURCE_COST
Procesando el tipo de objeto DATABASE_EXPORT/TRUSTED_DB_LINK
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/SEQUENCE/SEQUENCE
Procesando el tipo de objeto DATABASE_EXPORT/DIRECTORY/DIRECTORY
Procesando el tipo de objeto DATABASE_EXPORT/SYSTEM_PROCOBJACT/PRE_SYSTEM_ACTIONS/PROCACT_SYSTEM
Procesando el tipo de objeto DATABASE_EXPORT/SYSTEM_PROCOBJACT/PROCOBJ
Procesando el tipo de objeto DATABASE_EXPORT/SYSTEM_PROCOBJACT/POST_SYSTEM_ACTIONS/PROCACT_SYSTEM
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/PROCACT_SCHEMA
Procesando el tipo de objeto DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE
Procesando el tipo de objeto DATABASE_EXPORT/EARLY_POST_INSTANCE_IMPCALLOUT/MARKER
Procesando el tipo de objeto DATABASE_EXPORT/NORMAL_OPTIONS/TABLE
SProcesando el tipo de objeto DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE
Procesando el tipo de objeto DATABASE_EXPORT/NORMAL_POST_INSTANCE_IMPCALLOUT/MARKER
SProcesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/TABLE
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/COMMENT
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/PROCEDURE/PROCEDURE
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/PROCEDURE/ALTER_PROCEDURE
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/VIEW/VIEW
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/REF_CONSTRAINT
Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/TRIGGER
Procesando el tipo de objeto DATABASE_EXPORT/FINAL_POST_INSTANCE_IMPCALLOUT/MARKER

4 – EXCLUDE SCHEMAS

At some point, it may be necessary to exclude a schema from our export. To do so, follow these steps:

expdp system/***** directory=export full=yes EXCLUDE=SCHEMA:\»=\’HR\’\» dumpfile=export_exclude_schemas.dmp logfile=export_exclude_schemas.log metrics=y logtime=all

[oracle@localhost ~]$ expdp system/**** directory=export full=yes   EXCLUDE=SCHEMA:\"=\'HR\'\" dumpfile=export_exclude_schemas.dmp logfile=export_exclude_schemas.log metrics=y logtime=all

Export: Release 19.0.0.0.0 - Production on Wed Aug 19 00:06:20 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
19-AGO-26 00:06:26.625: Iniciando "SYSTEM"."SYS_EXPORT_FULL_01": system/******** directory=export full=yes EXCLUDE=SCHEMA:"='HR'" dumpfile=export_exclude_schemas.dmp logfile=export_exclude_schemas.log metrics=y logtime=all
19-AGO-26 00:06:27.462: W-1 El inicio ha tardado 1 segundos
19-AGO-26 00:06:34.516: W-1 Procesando el tipo de objeto DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
19-AGO-26 00:06:36.822: W-1 Procesando el tipo de objeto DATABASE_EXPORT/NORMAL_OPTIONS/TABLE_DATA
19-AGO-26 00:06:39.279: W-1 Procesando el tipo de objeto DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
19-AGO-26 00:06:41.718: W-1 Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
19-AGO-26 00:06:42.201: W-1 Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
19-AGO-26 00:06:42.487: W-1 Se han terminado 19 INDEX_STATISTICS objetos en 0 segundos
19-AGO-26 00:06:43.065: W-1 Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS
19-AGO-26 00:06:43.145: W-1 Se han terminado 7 TABLE_STATISTICS objetos en 1 segundos
19-AGO-26 00:06:52.792: W-1 Procesando el tipo de objeto DATABASE_EXPORT/STATISTICS/MARKER
19-AGO-26 00:06:53.064: W-1 Se han terminado 1 MARKER objetos en 10 segundos
19-AGO-26 00:06:53.151: W-1 Procesando el tipo de objeto DATABASE_EXPORT/PRE_SYSTEM_IMPCALLOUT/MARKER
19-AGO-26 00:06:53.182: W-1 Se han terminado 1 MARKER objetos en 10 segundos
19-AGO-26 00:06:53.236: W-1 Procesando el tipo de objeto DATABASE_EXPORT/PRE_INSTANCE_IMPCALLOUT/MARKER
19-AGO-26 00:06:53.267: W-1 Se han terminado 1 MARKER objetos en 10 segundos
19-AGO-26 00:06:53.568: W-1 Procesando el tipo de objeto DATABASE_EXPORT/TABLESPACE
19-AGO-26 00:06:53.745: W-1 Se han terminado 3 TABLESPACE objetos en 0 segundos
19-AGO-26 00:06:53.963: W-1 Procesando el tipo de objeto DATABASE_EXPORT/PROFILE
19-AGO-26 00:06:54.038: W-1 Se han terminado 1 PROFILE objetos en 0 segundos
19-AGO-26 00:06:54.229: W-1 Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/USER
19-AGO-26 00:06:54.289: W-1 Se han terminado 1 USER objetos en 0 segundos
19-AGO-26 00:06:54.560: W-1 Procesando el tipo de objeto DATABASE_EXPORT/RADM_FPTM
19-AGO-26 00:06:54.630: W-1 Se han terminado 1 RADM_FPTM objetos en 0 segundos
19-AGO-26 00:06:55.117: W-1 Procesando el tipo de objeto DATABASE_EXPORT/GRANT/SYSTEM_GRANT/PROC_SYSTEM_GRANT
19-AGO-26 00:06:55.187: W-1 Se han terminado 7 PROC_SYSTEM_GRANT objetos en 1 segundos
19-AGO-26 00:06:55.303: W-1 Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/GRANT/SYSTEM_GRANT
19-AGO-26 00:06:55.386: W-1 Se han terminado 23 SYSTEM_GRANT objetos en 0 segundos
19-AGO-26 00:06:55.461: W-1 Procesando el tipo de objeto DATABASE_EXPORT/SCHEMA/ROLE_GRANT
19-AGO-26 00:06:55.558: W-1 Se han terminado 6 ROLE_GRANT objetos en 0 segundos

5 – EXCLUDE PATTERNS

Sometimes it is necessary to exclude objects that match a pattern. In this example, two additional tables have been created alongside JOBS (JOBS1 and JOBS2). We are going to create a .par file to exclude tables named JOBS.

SQL> show user
USER es "HR"
SQL> select table_name from user_tables order by 1 asc;

TABLE_NAME
--------------------------------------------------------------------------------
COUNTRIES
DEPARTMENTS
EMPLOYEES
JOB_HISTORY
JOBS
JOBS1
JOBS2
LOCATIONS
REGIONS

9 filas seleccionadas.
[oracle@localhost ~]$ cat exclude.par 
DIRECTORY=export
SCHEMAS=HR
exclude=TABLE:"LIKE 'JOBS%'"
DUMPFILE=export_exclude_tables.dmp
LOGFILE=export_exclude_tables.log
METRICS=Y
LOGTIME=ALL
[oracle@localhost ~]$

[oracle@localhost ~]$ expdp system/**** parfile=exclude.par

19-AGO-26 11:28:20.606: W-1 . . ha exportado "HR"."EMPLOYEES"                            17.08 KB     107 filas en 0 segundos con direct_path
19-AGO-26 11:28:20.692: W-1 . . ha exportado "HR"."LOCATIONS"                            8.437 KB      23 filas en 0 segundos con direct_path
19-AGO-26 11:28:20.824: W-1 . . ha exportado "HR"."JOB_HISTORY"                          7.195 KB      10 filas en 0 segundos con direct_path
19-AGO-26 11:28:21.017: W-1 . . ha exportado "HR"."DEPARTMENTS"                          7.125 KB      27 filas en 1 segundos con direct_path
19-AGO-26 11:28:21.759: W-1 . . ha exportado "HR"."COUNTRIES"                            6.367 KB      25 filas en 0 segundos con external_table
19-AGO-26 11:28:21.985: W-1 . . ha exportado "HR"."REGIONS"                              5.546 KB       4 filas en 0 segundos con direct_path
19-AGO-26 11:28:22.500: W-1      Se han terminado 6 SCHEMA_EXPORT/TABLE/TABLE_DATA objetos en 1 segundos

6- COMBINE OPTIONS

Es bastante normal tener que combinar diferentes opciones en los exports de tus datos. En este ejemplo eliminamos del expdp todas las sequencias y las tablas que comiencen con JOBS del schema HR.

[oracle@localhost ~]$ cat exclude.par 
DIRECTORY=export
SCHEMAS=HR
exclude=SEQUENCE,TABLE:"LIKE 'JOBS%'"
DUMPFILE=export_exclude_tables.dmp
LOGFILE=export_exclude_tables.log
METRICS=Y
LOGTIME=ALL
[oracle@localhost ~]$ expdp system/**** parfile=exclude.par

Export: Release 19.0.0.0.0 - Production on Wed Aug 19 11:39:39 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
19-AGO-26 11:39:43.520: Iniciando "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** parfile=exclude.par
19-AGO-26 11:39:44.290: W-1 El inicio ha tardado 1 segundos
19-AGO-26 11:39:48.898: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TABLE_DATA
19-AGO-26 11:39:49.364: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
19-AGO-26 11:39:49.518: W-1 Se han terminado 18 INDEX_STATISTICS objetos en 0 segundos
19-AGO-26 11:39:49.981: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
19-AGO-26 11:39:50.067: W-1 Se han terminado 6 TABLE_STATISTICS objetos en 1 segundos
19-AGO-26 11:39:56.502: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/STATISTICS/MARKER
19-AGO-26 11:39:56.778: W-1 Se han terminado 1 MARKER objetos en 6 segundos
19-AGO-26 11:39:56.958: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/USER
19-AGO-26 11:39:57.049: W-1 Se han terminado 1 USER objetos en 1 segundos
19-AGO-26 11:39:57.136: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/SYSTEM_GRANT
19-AGO-26 11:39:57.208: W-1 Se han terminado 7 SYSTEM_GRANT objetos en 0 segundos
19-AGO-26 11:39:57.281: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/ROLE_GRANT
19-AGO-26 11:39:57.385: W-1 Se han terminado 1 ROLE_GRANT objetos en 0 segundos
19-AGO-26 11:39:57.457: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/DEFAULT_ROLE
19-AGO-26 11:39:57.568: W-1 Se han terminado 1 DEFAULT_ROLE objetos en 0 segundos
19-AGO-26 11:39:57.733: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLESPACE_QUOTA
19-AGO-26 11:39:57.819: W-1 Se han terminado 1 TABLESPACE_QUOTA objetos en 0 segundos
19-AGO-26 11:39:58.016: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
19-AGO-26 11:39:58.098: W-1 Se han terminado 1 PROCACT_SCHEMA objetos en 1 segundos
19-AGO-26 11:40:25.521: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TABLE
19-AGO-26 11:40:28.725: W-1 Se han terminado 6 TABLE objetos en 25 segundos
19-AGO-26 11:40:29.861: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/COMMENT
19-AGO-26 11:40:29.962: W-1 Se han terminado 34 COMMENT objetos en 0 segundos
19-AGO-26 11:40:32.546: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/PROCEDURE/PROCEDURE
19-AGO-26 11:40:32.615: W-1 Se han terminado 2 PROCEDURE objetos en 0 segundos
19-AGO-26 11:40:33.427: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
19-AGO-26 11:40:33.485: W-1 Se han terminado 2 ALTER_PROCEDURE objetos en 0 segundos
19-AGO-26 11:40:37.828: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/VIEW/VIEW
19-AGO-26 11:40:37.882: W-1 Se han terminado 1 VIEW objetos en 4 segundos
19-AGO-26 11:40:41.377: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/INDEX/INDEX
19-AGO-26 11:40:41.551: W-1 Se han terminado 16 INDEX objetos en 3 segundos
19-AGO-26 11:40:43.396: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
19-AGO-26 11:40:43.468: W-1 Se han terminado 8 CONSTRAINT objetos en 2 segundos
19-AGO-26 11:40:45.891: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
19-AGO-26 11:40:45.958: W-1 Se han terminado 10 REF_CONSTRAINT objetos en 0 segundos
19-AGO-26 11:40:46.219: W-1 Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TRIGGER
19-AGO-26 11:40:46.299: W-1 Se han terminado 2 TRIGGER objetos en 0 segundos
19-AGO-26 11:40:51.410: W-1 . . ha exportado "HR"."EMPLOYEES" 17.08 KB 107 filas en 0 segundos con direct_path
19-AGO-26 11:40:51.498: W-1 . . ha exportado "HR"."LOCATIONS" 8.437 KB 23 filas en 0 segundos con direct_path
19-AGO-26 11:40:51.621: W-1 . . ha exportado "HR"."JOB_HISTORY" 7.195 KB 10 filas en 0 segundos con direct_path
19-AGO-26 11:40:51.715: W-1 . . ha exportado "HR"."DEPARTMENTS" 7.125 KB 27 filas en 0 segundos con direct_path
19-AGO-26 11:40:52.460: W-1 . . ha exportado "HR"."COUNTRIES" 6.367 KB 25 filas en 1 segundos con external_table
19-AGO-26 11:40:52.602: W-1 . . ha exportado "HR"."REGIONS" 5.546 KB 4 filas en 0 segundos con direct_path
19-AGO-26 11:40:53.074: W-1 Se han terminado 6 SCHEMA_EXPORT/TABLE/TABLE_DATA objetos en 1 segundos
19-AGO-26 11:40:54.940: W-1 La tabla maestra "SYSTEM"."SYS_EXPORT_SCHEMA_01" se ha cargado/descargado correctamente
19-AGO-26 11:40:54.990: ******************************************************************************
19-AGO-26 11:40:54.992: El juego de archivos de volcado para SYSTEM.SYS_EXPORT_SCHEMA_01 es:
19-AGO-26 11:40:55.001: /data/export/export_exclude_tables.dmp

7- USING QUERY

Dentro del export podemos usar una consulta específica para acotar la exportación de datos. P.ej. La tabla COUNTRIES tiene 25 registros. Vamos a realizar un export del shema propietario HR, acontando la exportación de datos de esta tabla a los que cumplan la condición REGION_ID=2 que son 5 registros.

SQL> select count(1) from HR.COUNTRIES;

COUNT(1)
----------
25

SQL> select count(1) from HR.COUNTRIES WHERE REGION_ID=2;

COUNT(1)
----------
5

[expdp system/**** dumpfile=export_query_example.dmp logfile=exp_query_example.log directory=export schemas=HR query=’HR.COUNTRIES:»WHERE REGION_ID=2″‘

[oracle@localhost ~]$ expdp system/**** dumpfile=export_query_example.dmp logfile=exp_query_example.log directory=export schemas=HR query='HR.COUNTRIES:"WHERE  REGION_ID=2"'

Export: Release 19.0.0.0.0 - Production on Wed Aug 19 14:59:20 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Iniciando "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** dumpfile=export_query_example.dmp logfile=exp_query_example.log directory=export schemas=HR query=HR.COUNTRIES:"WHERE REGION_ID=2"
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TABLE_DATA
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Procesando el tipo de objeto SCHEMA_EXPORT/STATISTICS/MARKER
Procesando el tipo de objeto SCHEMA_EXPORT/USER
Procesando el tipo de objeto SCHEMA_EXPORT/SYSTEM_GRANT
Procesando el tipo de objeto SCHEMA_EXPORT/ROLE_GRANT
Procesando el tipo de objeto SCHEMA_EXPORT/DEFAULT_ROLE
Procesando el tipo de objeto SCHEMA_EXPORT/TABLESPACE_QUOTA
Procesando el tipo de objeto SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Procesando el tipo de objeto SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TABLE
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/COMMENT
Procesando el tipo de objeto SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Procesando el tipo de objeto SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Procesando el tipo de objeto SCHEMA_EXPORT/VIEW/VIEW
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/INDEX/INDEX
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TRIGGER
. . "HR"."EMPLOYEES" 17.08 KB 107 filas exportadas
. . "HR"."LOCATIONS" 8.437 KB 23 filas exportadas
. . "HR"."JOB_HISTORY" 7.195 KB 10 filas exportadas
. . "HR"."JOBS" 7.109 KB 19 filas exportadas
. . "HR"."JOBS1" 7.109 KB 19 filas exportadas
. . "HR"."JOBS2" 7.109 KB 19 filas exportadas
. . "HR"."DEPARTMENTS" 7.125 KB 27 filas exportadas
. . "HR"."COUNTRIES" 6.007 KB 5 filas exportadas
. . "HR"."REGIONS" 5.546 KB 4 filas exportadas
La tabla maestra "SYSTEM"."SYS_EXPORT_SCHEMA_01" se ha cargado/descargado correctamente
******************************************************************************

8 - MULTIPLE USE OF QUERY

Otro ejemplo es usar múltiples querys en el export. En este ejemplo se acota a los registros de la tabla HR.COUNTRIES donde se cumpla la condición REGION_ID=2 y se acotan también los registros de la tabla HRDEST.COUNTRIES donde se cumple la condición REGION_ID=3.

expdp system/**** dumpfile=export_query_example.dmp logfile=exp_query_example.log directory=export schemas=HR,HRDEST QUERY=HR.COUNTRIES:\»WHERE\ REGION_ID=2\» QUERY=HRDEST.COUNTRIES:\»WHERE\ REGION_ID=3\»

[oracle@localhost ~]$ expdp system/***** dumpfile=export_query_example.dmp logfile=exp_query_example.log directory=export schemas=HR,HRDEST QUERY=HR.COUNTRIES:\»WHERE\ REGION_ID=2\» QUERY=HRDEST.COUNTRIES:\»WHERE\ REGION_ID=3\»

Export: Release 19.0.0.0.0 – Production on Wed, Aug 19, 15:12:27, 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production
Iniciando «SYSTEM».»SYS_EXPORT_SCHEMA_01″: system/ dumpfile=export_query_example.dmp logfile=exp_query_example.log directory=export schemas=HR,HRDEST QUERY=HR.COUNTRIES:»WHERE REGION_ID=2″ QUERY=HRDEST.COUNTRIES:»WHERE REGION_ID=3″
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TABLE_DATA
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Procesando el tipo de objeto SCHEMA_EXPORT/STATISTICS/MARKER
Procesando el tipo de objeto SCHEMA_EXPORT/USER
Procesando el tipo de objeto SCHEMA_EXPORT/SYSTEM_GRANT
Procesando el tipo de objeto SCHEMA_EXPORT/ROLE_GRANT
Procesando el tipo de objeto SCHEMA_EXPORT/DEFAULT_ROLE
Procesando el tipo de objeto SCHEMA_EXPORT/TABLESPACE_QUOTA
Procesando el tipo de objeto SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Procesando el tipo de objeto SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TABLE
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/COMMENT
Procesando el tipo de objeto SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Procesando el tipo de objeto SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Procesando el tipo de objeto SCHEMA_EXPORT/VIEW/VIEW
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/INDEX/INDEX
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Procesando el tipo de objeto SCHEMA_EXPORT/TABLE/TRIGGER
. . «HR».»EMPLOYEES» 17.08 KB 107 filas exportadas
. . «HRDEST».»EMPLOYEES» 17.09 KB 107 filas exportadas
. . «HR».»LOCATIONS» 8.437 KB 23 filas exportadas
. . «HRDEST».»LOCATIONS» 8.437 KB 23 filas exportadas
. . «HR».»JOB_HISTORY» 7.195 KB 10 filas exportadas
. . «HRDEST».»JOB_HISTORY» 7.195 KB 10 filas exportadas
. . «HR».»JOBS» 7.109 KB 19 filas exportadas
. . «HR».»JOBS1″ 7.109 KB 19 filas exportadas
. . «HR».»JOBS2″ 7.109 KB 19 filas exportadas
. . «HRDEST».»JOBS» 7.109 KB 19 filas exportadas
. . «HR».»DEPARTMENTS» 7.125 KB 27 filas exportadas
. . «HRDEST».»DEPARTMENTS» 7.125 KB 27 filas exportadas
. . «HR».»COUNTRIES» 6.007 KB 5 filas exportadas
. . «HRDEST».»COUNTRIES» 6.007 KB 6 filas exportadas
. . «HR».»REGIONS» 5.546 KB 4 filas exportadas
. . «HRDEST».»REGIONS» 5.546 KB 4 filas exportadas
La tabla maestra «SYSTEM».»SYS_EXPORT_SCHEMA_01″ se ha cargado/descargado correctamente

NOTA IMPORTANTE: Whenever you need to use quotation marks or multiple values/options in your export parameters (EXCLUDE, INCLUDE, QUERY, etc.), it is highly recommended to use a profile, to avoid interpretation issues by the shell and the tool expdp.

Oracle ACE