SQLFILE Parameter in Oracle19c Database.

DESCRIPTION:

In this article we are going to see the Oracle 19c Datapump- Sqlfile

Sqlfile option will show you the DDL in the text format.Sometimes customer provides us data pump export file, by that time we will use SQLFILE parameter and find out DDL’s (Schema names) and perform data pump import accordingly.

SYNTAX:

impdp directory=DATA_PUMP_DIR dumpfile=PRODDB_Full.dmp sqlfile=FULL_DDL.sql

[oracle@oracle19c ~]$ impdp directory=My_Dir dumpfile=table01.dmp logfile=table01.log tables='table01' sqlfile=tab.sql

Import: Release 19.0.0.0.0 - Production on Mon Jan 25 09:30:30 2021

Version 19.3.0.0.0

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

Username: data

Password:

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Master table "DATA"."SYS_SQL_FILE_TABLE_01" successfully loaded/unloaded

Starting "DATA"."SYS_SQL_FILE_TABLE_01":  data/******** directory=My_Dir dumpfile=table01.dmp logfile=table01.log tables=table01 sqlfile=tab.sql

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER

Job "DATA"."SYS_SQL_FILE_TABLE_01" successfully completed at Mon Jan 25 09:30:36 2021 elapsed 0 00:00:01




[oracle@oracle19c ~]$ cd /u01/app/oracle/oradata/

[oracle@oracle19c oradata]$ ls

compressed1.dmp  con01.dmp  con.log        CONTINUE.dmp  My_Dir        schema.dmp  table01.dmp       tablespace.log  tabs.log

compressed2.dmp  con01.log  CONTINUE1.dmp  CONTINUE.log  ORACLE19C     schema.log  table01.log       tabs00.log      tab.sql

compressed.dmp   con.dmp    CONTINUE1.log  export.log    ORACLE19CCON  tab00.dmp   tablespace01.log  tabs.dmp

sqlfile activity completed successfully and ‘tab.sql‘ file has created in the specified dump directory location.

[oracle@oracle19c oradata]$ vi tab.sql

Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

TABLESPACE LEVEL PARAMETER

DESCRIPTION:

In this article, we are going to see  how to export and Import table space using Datapump.

Tablespaces are the logical storage units which are used by the database to store separate objects, such as tables, types, PL/SQL code, and so on. Typically, related objects are grouped together and stored in the same tablespace.

Using expdp export utility of data pump we can export tablespaces. Exporting tablespace is also a way of taking logical backup of the tablespace of your database. Exporting tablespace means only the tables contained in a specified set of tablespace are unloaded along with its dependent objects.

Exporting tablespace means

  • Only the tables contained in a specified set of tablespace are unloaded
  • If a table is unloaded, then its dependent objects are also unloaded
  • Tablespace export unloads both object metadata and Data.

DIRECTORY.

Create a directory anywhere in your system or on your network where expdp export utility can save the exported files such as dump files and log files.

TABLE SPACE:

Using this TABLESPACES parameter we can specify the list of tablespace names which you want to export. For example here I have specified USERS.

[oracle@oracle19c ~]$ expdp directory=My_Dir tablespaces=users dumpfile=tab00.dmp logfile=tabs00.log

Export: Release 19.0.0.0.0 - Production on Mon Jan 25 09:22:37 2021

Version 19.3.0.0.0

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

Username: data

Password:

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Starting "DATA"."SYS_EXPORT_TABLESPACE_01":  data/******** directory=My_Dir tablespaces=users dumpfile=tab00.dmp logfile=tabs00.log

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/COMMENT

Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

. . exported "DATA"."TABLE01"                            5.515 KB       5 rows

Master table "DATA"."SYS_EXPORT_TABLESPACE_01" successfully loaded/unloaded

******************************************************************************

Dump file set for DATA.SYS_EXPORT_TABLESPACE_01 is:

  /u01/app/oracle/oradata/tab00.dmp

Job "DATA"."SYS_EXPORT_TABLESPACE_01" successfully completed at Mon Jan 25 09:22:51 2021 elapsed 0 00:00:09

Export activity completed successfully.

[oracle@oracle19c ~]$ !sq

sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jan 25 09:23:37 2021

Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

SQL> conn data/pump

Connected.

SQL> select * from table01;

ID NAME

---------- ------------------------------

 1 aaa

 2 bbb

 3 ccc

 4 ddd

 5 eee
SQL> drop table table01;

Table dropped.

SQL> select * from Table01;

select * from Table01

              *

ERROR at line 1:

ORA-00942: table or view does not exist


SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

Import the tablespaces using the Dumpfile

[oracle@oracle19c ~]$ impdp directory=My_Dir  dumpfile=tab00.dmp  logfile=tabs00.log

Import: Release 19.0.0.0.0 - Production on Mon Jan 25 09:24:28 2021

Version 19.3.0.0.0

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

Username: data

Password:

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Master table "DATA"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "DATA"."SYS_IMPORT_FULL_01":  data/******** directory=My_Dir dumpfile=tab00.dmp logfile=tabs00.log

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

. . imported "DATA"."TABLE01"                            5.515 KB       5 rows

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER

Job "DATA"."SYS_IMPORT_FULL_01" successfully completed at Mon Jan 25 09:24:36 2021 elapsed 0 00:00:03

Import Activity successfully completed.Now we can access the tablespaces.

[oracle@oracle19c ~]$ !sq

sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jan 25 09:24:51 2021

Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

SQL> conn data/pump

Connected.


SQL> select * from table01;

ID NAME

---------- ------------------------------

 1 aaa

 2 bbb

 3 ccc

 4 ddd

 5 eee

Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

Full Database Export in Oracle19c using Datapump

DESCRIPTION:

Using expdp utility provided by data pump we can export data or say unload data or metadata from one database to another. By using this utility we can either export the complete database or a subset of databases such as Database Schema, Table spaces or even individual tables.

DATABASE VERSION:

19.3.0.0.

DIRECTORY:

create a directory by using CREATE DIRECTORY command.

FULL:

This parameter FULL indicates that you want to perform a full database export. This parameter can have YES or NO values. If you set this parameter to YES that means expdp utility will export all the data and metadata of the database.

DUMPFILE:

Using DUMPFILE parameter you specify the names, and optionally, the directory objects of dump files for an export job.

[oracle@oracle19c ~]$ expdp directory=My_Dir  FULL=Y  dumpfile=fulldb.dmp logfile=fulldb.log

Export: Release 19.0.0.0.0 - Production on Mon Jan 25 09:35:42 2021

Version 19.3.0.0.0

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

Username: data

Password:

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Starting "DATA"."SYS_EXPORT_FULL_01":  data/******** directory=My_Dir FULL=Y dumpfile=fulldb.dmp logfile=fulldb.log

Processing object type DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA

Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/TABLE_DATA

Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA

Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA

Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type DATABASE_EXPORT/STATISTICS/MARKER

Processing object type DATABASE_EXPORT/PRE_SYSTEM_IMPCALLOUT/MARKER

Processing object type DATABASE_EXPORT/PRE_INSTANCE_IMPCALLOUT/MARKER

Processing object type DATABASE_EXPORT/TABLESPACE

Processing object type DATABASE_EXPORT/PROFILE

Processing object type DATABASE_EXPORT/SCHEMA/USER

Processing object type DATABASE_EXPORT/RADM_FPTM

Processing object type DATABASE_EXPORT/GRANT/SYSTEM_GRANT/PROC_SYSTEM_GRANT

Processing object type DATABASE_EXPORT/SCHEMA/GRANT/SYSTEM_GRANT

Processing object type DATABASE_EXPORT/SCHEMA/ROLE_GRANT

Processing object type DATABASE_EXPORT/SCHEMA/DEFAULT_ROLE

Processing object type DATABASE_EXPORT/SCHEMA/ON_USER_GRANT

Processing object type DATABASE_EXPORT/SCHEMA/TABLESPACE_QUOTA

Processing object type DATABASE_EXPORT/RESOURCE_COST

Processing object type DATABASE_EXPORT/TRUSTED_DB_LINK

Processing object type DATABASE_EXPORT/DIRECTORY/DIRECTORY

Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/PRE_SYSTEM_ACTIONS/PROCACT_SYSTEM

Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/PROCOBJ

Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/POST_SYSTEM_ACTIONS/PROCACT_SYSTEM

Processing object type DATABASE_EXPORT/SCHEMA/PROCACT_SCHEMA

Processing object type DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE

Processing object type DATABASE_EXPORT/EARLY_POST_INSTANCE_IMPCALLOUT/MARKER

Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/TABLE

Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE

Processing object type DATABASE_EXPORT/NORMAL_POST_INSTANCE_IMPCALLOUT/MARKER

Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE

Processing object type DATABASE_EXPORT/SCHEMA/TABLE/COMMENT

Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX

Processing object type DATABASE_EXPORT/FINAL_POST_INSTANCE_IMPCALLOUT/MARKER

Processing object type DATABASE_EXPORT/SCHEMA/POST_SCHEMA/PROCACT_SCHEMA

Processing object type DATABASE_EXPORT/AUDIT_UNIFIED/AUDIT_POLICY_ENABLE

Processing object type DATABASE_EXPORT/POST_SYSTEM_IMPCALLOUT/MARKER

. . exported "SYS"."KU$_USER_MAPPING_VIEW"               6.070 KB      37 rows

. . exported "AUDSYS"."AUD$UNIFIED":"SYS_P181"           136.5 KB     174 rows

. . exported "SYSTEM"."REDO_DB"                          25.59 KB       1 rows

. . exported "WMSYS"."WM$WORKSPACES_TABLE$"              12.10 KB       1 rows

. . exported "WMSYS"."WM$HINT_TABLE$"                    9.984 KB      97 rows

. . exported "LBACSYS"."OLS$INSTALLATIONS"               6.960 KB       2 rows

. . exported "WMSYS"."WM$WORKSPACE_PRIV_TABLE$"          7.078 KB      11 rows

. . exported "SYS"."DAM_CONFIG_PARAM$"                   6.531 KB      14 rows

. . exported "SYS"."TSDP_SUBPOL$"                        6.328 KB       1 rows

. . exported "WMSYS"."WM$NEXTVER_TABLE$"                 6.375 KB       1 rows

. . exported "LBACSYS"."OLS$PROPS"                       6.234 KB       5 rows

. . exported "WMSYS"."WM$ENV_VARS$"                      6.015 KB       3 rows

. . exported "SYS"."TSDP_PARAMETER$"                     5.953 KB       1 rows

. . exported "SYS"."TSDP_POLICY$"                        5.921 KB       1 rows

. . exported "WMSYS"."WM$VERSION_HIERARCHY_TABLE$"       5.984 KB       1 rows

. . exported "WMSYS"."WM$EVENTS_INFO$"                   5.812 KB      12 rows

. . exported "LBACSYS"."OLS$AUDIT_ACTIONS"               5.757 KB       8 rows

. . exported "LBACSYS"."OLS$DIP_EVENTS"                  5.539 KB       2 rows

. . exported "AUDSYS"."AUD$UNIFIED":"AUD_UNIFIED_P0"         0 KB       0 rows

. . exported "LBACSYS"."OLS$AUDIT"                           0 KB       0 rows

. . exported "LBACSYS"."OLS$COMPARTMENTS"                    0 KB       0 rows

. . exported "LBACSYS"."OLS$DIP_DEBUG"                       0 KB       0 rows

. . exported "LBACSYS"."OLS$GROUPS"                          0 KB       0 rows

. . exported "LBACSYS"."OLS$LAB"                             0 KB       0 rows

. . exported "LBACSYS"."OLS$LEVELS"                          0 KB       0 rows

. . exported "LBACSYS"."OLS$POL"                             0 KB       0 rows

. . exported "LBACSYS"."OLS$POLICY_ADMIN"                    0 KB       0 rows

. . exported "LBACSYS"."OLS$POLS"                            0 KB       0 rows

. . exported "LBACSYS"."OLS$POLT"                            0 KB       0 rows

. . exported "LBACSYS"."OLS$PROFILE"                         0 KB       0 rows

. . exported "LBACSYS"."OLS$PROFILES"                        0 KB       0 rows

. . exported "LBACSYS"."OLS$PROG"                            0 KB       0 rows

. . exported "LBACSYS"."OLS$SESSINFO"                        0 KB       0 rows

. . exported "LBACSYS"."OLS$USER"                            0 KB       0 rows

. . exported "LBACSYS"."OLS$USER_COMPARTMENTS"               0 KB       0 rows

. . exported "LBACSYS"."OLS$USER_GROUPS"                     0 KB       0 rows

. . exported "LBACSYS"."OLS$USER_LEVELS"                     0 KB       0 rows

. . exported "SYS"."AUD$"                                    0 KB       0 rows

. . exported "SYS"."DAM_CLEANUP_EVENTS$"                     0 KB       0 rows

. . exported "SYS"."DAM_CLEANUP_JOBS$"                       0 KB       0 rows

. . exported "SYS"."TSDP_ASSOCIATION$"                       0 KB       0 rows

. . exported "SYS"."TSDP_CONDITION$"                         0 KB       0 rows

. . exported "SYS"."TSDP_FEATURE_POLICY$"                    0 KB       0 rows

. . exported "SYS"."TSDP_PROTECTION$"                        0 KB       0 rows

. . exported "SYS"."TSDP_SENSITIVE_DATA$"                    0 KB       0 rows

. . exported "SYS"."TSDP_SENSITIVE_TYPE$"                    0 KB       0 rows

. . exported "SYS"."TSDP_SOURCE$"                            0 KB       0 rows

. . exported "SYSTEM"."REDO_LOG"                             0 KB       0 rows

. . exported "WMSYS"."WM$BATCH_COMPRESSIBLE_TABLES$"         0 KB       0 rows

. . exported "WMSYS"."WM$CONSTRAINTS_TABLE$"                 0 KB       0 rows

. . exported "WMSYS"."WM$CONS_COLUMNS$"                      0 KB       0 rows

. . exported "WMSYS"."WM$LOCKROWS_INFO$"                     0 KB       0 rows

. . exported "WMSYS"."WM$MODIFIED_TABLES$"                   0 KB       0 rows

. . exported "WMSYS"."WM$MP_GRAPH_WORKSPACES_TABLE$"         0 KB       0 rows

. . exported "WMSYS"."WM$MP_PARENT_WORKSPACES_TABLE$"        0 KB       0 rows

. . exported "WMSYS"."WM$NESTED_COLUMNS_TABLE$"              0 KB       0 rows

. . exported "WMSYS"."WM$RESOLVE_WORKSPACES_TABLE$"          0 KB       0 rows

. . exported "WMSYS"."WM$RIC_LOCKING_TABLE$"                 0 KB       0 rows

. . exported "WMSYS"."WM$RIC_TABLE$"                         0 KB       0 rows

. . exported "WMSYS"."WM$RIC_TRIGGERS_TABLE$"                0 KB       0 rows

. . exported "WMSYS"."WM$UDTRIG_DISPATCH_PROCS$"             0 KB       0 rows

. . exported "WMSYS"."WM$UDTRIG_INFO$"                       0 KB       0 rows

. . exported "WMSYS"."WM$VERSION_TABLE$"                     0 KB       0 rows

. . exported "WMSYS"."WM$VT_ERRORS_TABLE$"                   0 KB       0 rows

. . exported "WMSYS"."WM$WORKSPACE_SAVEPOINTS_TABLE$"        0 KB       0 rows

. . exported "MDSYS"."RDF_PARAM$"                        6.515 KB       3 rows

. . exported "SYS"."AUDTAB$TBS$FOR_EXPORT"               5.953 KB       2 rows

. . exported "SYS"."DBA_SENSITIVE_DATA"                      0 KB       0 rows

. . exported "SYS"."DBA_TSDP_POLICY_PROTECTION"              0 KB       0 rows

. . exported "SYS"."FGA_LOG$FOR_EXPORT"                      0 KB       0 rows

. . exported "SYS"."NACL$_ACE_EXP"                           0 KB       0 rows

. . exported "SYS"."NACL$_HOST_EXP"                      6.976 KB       2 rows

. . exported "SYS"."NACL$_WALLET_EXP"                        0 KB       0 rows

. . exported "SYS"."SQL$TEXT_DATAPUMP"                   362.5 KB      63 rows

. . exported "SYS"."SQL$_DATAPUMP"                       7.945 KB      63 rows

. . exported "SYS"."SQLOBJ$AUXDATA_DATAPUMP"             72.75 KB      94 rows

. . exported "SYS"."SQLOBJ$DATA_DATAPUMP"                    0 KB       0 rows

. . exported "SYS"."SQLOBJ$PLAN_DATAPUMP"                1.847 MB    3100 rows

. . exported "SYS"."SQLOBJ$_DATAPUMP"                    14.69 KB      94 rows

. . exported "SYSTEM"."SCHEDULER_JOB_ARGS"                   0 KB       0 rows

. . exported "SYSTEM"."SCHEDULER_PROGRAM_ARGS"               0 KB       0 rows

. . exported "WMSYS"."WM$EXP_MAP"                        7.718 KB       3 rows

. . exported "WMSYS"."WM$METADATA_MAP"                       0 KB       0 rows

. . exported "DATA"."TABLE01"                            5.515 KB       5 rows

Master table "DATA"."SYS_EXPORT_FULL_01" successfully loaded/unloaded

******************************************************************************

Dump file set for DATA.SYS_EXPORT_FULL_01 is:

  /u01/app/oracle/oradata/fulldb.dmp

Job "DATA"."SYS_EXPORT_FULL_01" successfully completed at Mon Jan 25 09:38:24 2021 elapsed 0 00:02:38

 

full export is done successfully.

Restrictions with Full Database export.

  • A full export does not export system schemas that contain Oracle-managed data and metadata.

  • Grants on objects owned by the SYS schema are never exported.

    Thank you for giving your valuable time to read the above information.
    If you want to be updated with all our articles send us the Invitation or Follow us:
    Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
    LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
    Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
    Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
    Ramkumar’s Telegram: https://t.me/oracleageant
    Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8