How to export or import a table and also export a schema in Oracle Database 10.2.0.x
FROM THE SOURCE SERVER (labserver1):
=============================================================================
STEP 1:
=============================================================================
Create an export dump directory using the oracle user name e.g oraprod (physical location):
=============================================================================
labserver1:oraprod$ mkdir -R /oradata1/exportloc
STEP 2:
Create a Dump Directory:
=============================================================================
$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.2.0 - Production on Wed Jun 23 14:20:19 2010
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> create directory expdp_dir as '/oradata1/exportloc';
Directory created.
SQL> grant read,write on directory expdp_dir to system, apps, xxis;
Grant succeeded.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
$
STEP 3:
Run the export command: e.g How to export a table from the Database
=============================================================================
Syntax:
expdp <db_user>/<password> tables=<table_name> directory=<database_directory_name> dumpfile=<dump_name> LOGFILE=<dump_log_name>
Example
expdp XXIS/password tables=XXIS_CASH_RECEIPTS directory=expdp_dir dumpfile=XXIS_CASH_RECEIPTS_new.dmp LOGFILE=XXIS_expfull_new.log
ON THE TARGET SERVER (labserver2):
STEP 4:
=============================================================================
Create an export dump directory using the oracle user name e.g orauat3 (physical location):
=============================================================================
labserver2:orauat3$ mkdir -R /oradata1/exportloc
STEP 5:
=============================================================================
Create a Dump Directory:
=============================================================================
labserver2:orauat3$
labserver2:orauat3$sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.2.0 - Production on Wed Jun 23 14:35:54 2010
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> create directory expdp_dir as '/oradata2/exportloc';
Directory created.
SQL> grant read,write on directory expdp_dir to system, apps, xxis;
Grant succeeded.
SQL> exit
STEP 6:
=============================================================================
Transfer the dmp file from source server to target server:
=============================================================================
Either using ftp tool, copy the .dmp file created in the dump directory from source to target server. Ensure that the file is placed in the export dump directory created in step 4
STEP 7:
=============================================================================
Truncate the table that you need to import to:
=============================================================================
truncate table XXIS_CASH_RECEIPTS cascade;
STEP 8:
Run the import command: e.g How to import a table from the Database
=============================================================================
Syntax:
impdp <db_user>/<password> tables=<table_name> directory=<database_directory_name> dumpfile=<dump_name> LOGFILE=<dump_log_name>
impdp XXIS/xxis tables=XXIS_CASH_RECEIPTS directory=expdp_dir DUMPFILE=XXIS_CASH_RECEIPTS_new.dmp LOGFILE=XXIS_impfull_new.log
===============================================================================
How to Export a Schema:
===============================================================================
syntax:
labserver1:oraprod$ expdp <db_user>/<password> schemas=<schema_name> directory=<database_directory_name> dumpfile=<dump_name> LOGFILE=<dump_log_name>
Example:
labserver1:oraprod$ expdp XXIS/password schemas=XXIS directory=expdp_dir dumpfile=XXIS_SCHEMA_27082010.dmp LOGFILE=XXIS_SCHEMA_27082010.log
Export: Release 10.2.0.2.0 - 64bit Production on Friday, 27 August, 2010 12:01:45
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
Starting "XXIS"."SYS_EXPORT_SCHEMA_01": XXIS/******** schemas=XXIS directory=expdp_dir dumpfile=XXIS_SCHEMA_27082010.dmp LOGFILE=XXIS_SCHEMA_27082010.log
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 847.1 MB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/SEQUENCE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/VIEW/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "XXIS"."XXIS_TRANSACTIONS" 121.6 MB 491055 rows
. . exported "XXIS"."XXIS_DELIVERY_DETAILS" 69.29 MB 382769 rows
. . exported "XXIS"."XXIS_DELIVERY_HEADER" 51.46 MB 362883 rows
. . exported "XXIS"."XXIS_TRANSPORTER_CHARGES" 47.05 MB 290746 rows
. . exported "XXIS"."XXIS_FUND_TRANSACTIONS" 40.17 MB 305621 rows
. . exported "XXIS"."XXIS_INVOICE" 35.73 MB 361193 rows
. . exported "XXIS"."XXIS_COST_OUTS" 30.57 MB 249850 rows
. . exported "XXIS"."XXIS_COST_OUT_DETAILS" 26.74 MB 249850 rows
. . exported "XXIS"."XXIS_ORDER_HEADER" 23.15 MB 181724 rows
. . exported "XXIS"."XXIS_DELIVERY_ULLAGE_DETAILS" 18.99 MB 285691 rows
. . exported "XXIS"."XXIS_ORDER_DETAILS" 19.11 MB 190227 rows
. . exported "XXIS"."XXIS_CASH_RECEIPTS" 16.10 MB 219466 rows
. . exported "XXIS"."XXIS_CUSTOMER_PRICES" 16.96 MB 213828 rows
. . exported "XXIS"."XXIS_CASH_RECEIPTS_COPY" 15.09 MB 205889 rows
. . exported "XXIS"."XXIS_CALIBRATION_DETAILS" 5.101 MB 98175 rows
. . exported "XXIS"."XXIS_COST_IN_DETAILS" 12.67 MB 87674 rows
. . exported "XXIS"."XXIS_TRANSACTIONS_22JAN08" 10.86 MB 47090 rows
. . exported "XXIS"."XXIS_CASH_RECEIPTS_WALE" 9.822 MB 134661 rows
. . exported "XXIS"."XXIS_DIP_MEMO" 9.208 MB 91376 rows
. . exported "XXIS"."XXIS_CREDIT_VIOLATIONS" 8.637 MB 74941 rows
. . exported "XXIS"."XXIS_PRODUCT_MOVEMENT" 8.414 MB 30693 rows
. . exported "XXIS"."XXIS_APPROVAL_AUDITS" 7.658 MB 114212 rows
. . exported "XXIS"."XXIS_APPROVAL_REQUESTS" 5.557 MB 67428 rows
. . exported "XXIS"."XXIS_APPROVAL_REQUESTS_ARCHIVE" 7.917 MB 101098 rows
. . exported "XXIS"."XXIS_COSTING_JV" 7.415 MB 82343 rows
. . exported "XXIS"."XXIS_QUOTATION_HEADER" 7.473 MB 57440 rows
. . exported "XXIS"."XXIS_ASTM_54B" 5.104 MB 121254 rows
. . exported "XXIS"."XXIS_ASTM_54A" 4.616 MB 109719 rows
. . exported "XXIS"."XXIS_QUOTATION_DETAILS" 4.869 MB 60484 rows
. . exported "XXIS"."XXIS_SUPPLIER_INVOICES" 4.036 MB 36209 rows
. . exported "XXIS"."XXIS_TANK_MOVEMENT" 4.580 MB 30925 rows
. . exported "XXIS"."XXIS_COST_INS" 3.715 MB 32740 rows
. . exported "XXIS"."XXIS_CUSTOMER_ZONES" 3.079 MB 50959 rows
. . exported "XXIS"."XXIS_SP_MOVEMENT" 3.919 MB 30412 rows
. . exported "XXIS"."XXIS_TANK_DIP" 3.241 MB 16790 rows
. . exported "XXIS"."XXIS_WACS" 3.177 MB 27575 rows
. . exported "XXIS"."XXIS_DLY_ISSUE_RECEIPT" 3.267 MB 30377 rows
. . exported "XXIS"."XXIS_IMPORT_EXPORT" 2.547 MB 29411 rows
. . exported "XXIS"."XXIS_MOVEMENT" 3.121 MB 30574 rows
. . exported "XXIS"."XXIS_OWNER_MOVEMENT" 2.982 MB 30513 rows
. . exported "XXIS"."XXIS_TANK_OWNER_ALLOCATION" 2.675 MB 25747 rows
. . exported "XXIS"."XXIS_CALIBRATION_DETAILS_TEMP" 1.177 MB 67615 rows
. . exported "XXIS"."XXIS_COST_IN_DETAILS_22JAN2008" 1015. KB 7325 rows
. . exported "XXIS"."XXIS_OWNER_TANK_DIP" 966.8 KB 12849 rows
. . exported "XXIS"."XXLAB_TIMELOG_DETAILS" 1.163 MB 19164 rows
. . exported "XXIS"."XXIS_VEHICLES" 884.5 KB 7164 rows
. . exported "XXIS"."XXIS_ACCPAC_ORDERS" 837.2 KB 2309 rows
. . exported "XXIS"."XXIS_COST_OUTS_22JAN08" 571.2 KB 4782 rows
. . exported "XXIS"."XXIS_INVOICE_PROCESSING" 14.75 KB 4 rows
. . exported "XXIS"."XXIS_COST_OUT_DETAILS_22JAN08" 535.8 KB 4782 rows
. . exported "XXIS"."XXIS_RETURNED_GOODS" 517.9 KB 3200 rows
. . exported "XXIS"."XXIS_APPROVAL_REQUESTS_CRDVIO" 412.3 KB 5153 rows
. . exported "XXIS"."XXIS_BDGT_LEDGER" 55.31 KB 817 rows
. . exported "XXIS"."XXIS_TABLE_5B" 359.9 KB 9231 rows
. . exported "XXIS"."XXIS_COST_INS_22JAN2008" 350.5 KB 3097 rows
. . exported "XXIS"."XXIS_TAGGING_HEADER" 213.7 KB 3413 rows
. . exported "XXIS"."XXIS_TRANSPORTATION_RATES" 250.2 KB 3117 rows
. . exported "XXIS"."XXIS_APPROVERS" 74.67 KB 804 rows
. . exported "XXIS"."XXIS_CATEGORY_PRICES" 134.7 KB 1624 rows
. . exported "XXIS"."XXIS_COST_ACCOUNTS" 23.34 KB 110 rows
. . exported "XXIS"."XXIS_COST_BALANCES" 94.72 KB 968 rows
. . exported "XXIS"."XXIS_COST_ELEMENTS" 31.14 KB 136 rows
. . exported "XXIS"."XXIS_CUSTOMER_PRODUCTS" 147.4 KB 2723 rows
. . exported "XXIS"."XXIS_DRIVERS" 112.2 KB 1565 rows
. . exported "XXIS"."XXIS_PARAMETERS" 15.77 KB 88 rows
. . exported "XXIS"."XXIS_PRODUCT_PRICES" 12.19 KB 43 rows
. . exported "XXIS"."XXIS_SERVICE_TANKS" 105.4 KB 1103 rows
. . exported "XXIS"."XXIS_STOP_DELIVERIES" 29.42 KB 320 rows
. . exported "XXIS"."XXIS_TAGGING_DETAILS" 188.8 KB 3459 rows
. . exported "XXIS"."XXIS_TRANSACTION_TYPE" 11.42 KB 40 rows
. . exported "XXIS"."XXIS_PIPELINE" 10.42 KB 4 rows
. . exported "XXIS"."XXIS_STOCK_ACCESS" 103.1 KB 2042 rows
. . exported "XXIS"."XXIS_WACS_22JAN08" 141.9 KB 1148 rows
. . exported "XXIS"."XXIS_FORM_TRANSACTION" 14.07 KB 129 rows
. . exported "XXIS"."XXIS_PIPELINE_TRANSACTIONS" 19.14 KB 6 rows
. . exported "XXIS"."XXIS_PRODUCT" 58.25 KB 509 rows
. . exported "XXIS"."XXIS_TABLE_24" 95.70 KB 2319 rows
. . exported "XXIS"."XXIS_TABLE_34" 64.34 KB 1331 rows
. . exported "XXIS"."XXIS_TANK" 87.53 KB 788 rows
. . exported "XXIS"."XXIS_TANK_CHANGES" 81.89 KB 1096 rows
. . exported "XXIS"."XXIS_TRAN_TAB_ACCESS" 78.92 KB 1208 rows
. . exported "XXIS"."XXIS_TRUCK_SCHEDULES" 10.97 KB 8 rows
. . exported "XXIS"."XXIS_BERTH_NO" 11 KB 43 rows
. . exported "XXIS"."XXIS_BLEND_MOVEMENT" 16.71 KB 10 rows
. . exported "XXIS"."XXIS_CALIBRATION_HEADER" 21.21 KB 109 rows
. . exported "XXIS"."XXIS_DELIVERY_DETAILS_AUDIT" 15.98 KB 3 rows
. . exported "XXIS"."XXIS_DELIVERY_METHOD" 10.20 KB 48 rows
. . exported "XXIS"."XXIS_DEPOTS" 6.640 KB 35 rows
. . exported "XXIS"."XXIS_FORM" 8.328 KB 24 rows
. . exported "XXIS"."XXIS_FORM_DELIVERY" 10.42 KB 48 rows
. . exported "XXIS"."XXIS_FORM_TABS" 9.476 KB 45 rows
. . exported "XXIS"."XXIS_FUNDS" 10.46 KB 1 rows
. . exported "XXIS"."XXIS_FUND_PRODUCT_TXN_TYPES" 10.70 KB 18 rows
. . exported "XXIS"."XXIS_IMPORT_BL" 26.80 KB 168 rows
. . exported "XXIS"."XXIS_IMPORT_ROB" 9.101 KB 1 rows
. . exported "XXIS"."XXIS_MEASUREMENT_UNIT" 9.828 KB 36 rows
. . exported "XXIS"."XXIS_OWNER" 8.828 KB 20 rows
. . exported "XXIS"."XXIS_PRODUCT_CLASS" 7.437 KB 3 rows
. . exported "XXIS"."XXIS_PRODUCT_GRADE" 38.42 KB 497 rows
. . exported "XXIS"."XXIS_PRODUCT_GROUP" 10.11 KB 24 rows
. . exported "XXIS"."XXIS_PRODUCT_TYPE" 7.554 KB 6 rows
. . exported "XXIS"."XXIS_STOCK_POINT" 19.21 KB 162 rows
. . exported "XXIS"."XXIS_TABLE_11" 22.11 KB 361 rows
. . exported "XXIS"."XXIS_TABLE_29" 28.71 KB 601 rows
. . exported "XXIS"."XXIS_TABLE_3" 24.93 KB 451 rows
. . exported "XXIS"."XXIS_TABLE_51" 29.76 KB 601 rows
. . exported "XXIS"."XXIS_TABLE_52" 10.00 KB 41 rows
. . exported "XXIS"."XXIS_TANK_TYPE" 7.484 KB 5 rows
. . exported "XXIS"."XXIS_VESSEL" 41.28 KB 606 rows
. . exported "XXIS"."XXIS_ZONAL_RATES" 11.12 KB 36 rows
. . exported "XXIS"."XXIS_ZONES" 9.132 KB 10 rows
. . exported "XXIS"."XXIS_ADDITIVE" 0 KB 0 rows
. . exported "XXIS"."XXIS_ADDITIVE_BLEND" 0 KB 0 rows
. . exported "XXIS"."XXIS_ASTM_53D" 0 KB 0 rows
. . exported "XXIS"."XXIS_ASTM_54D" 0 KB 0 rows
. . exported "XXIS"."XXIS_BDGT_TEMP" 0 KB 0 rows
. . exported "XXIS"."XXIS_BL_DOCUMENT" 0 KB 0 rows
. . exported "XXIS"."XXIS_BL_SEED" 0 KB 0 rows
. . exported "XXIS"."XXIS_CASH_RECEIPTS_COPY_DIFF" 0 KB 0 rows
. . exported "XXIS"."XXIS_CONVERSION_FACTORS" 0 KB 0 rows
. . exported "XXIS"."XXIS_CUSTOMER_SECURITIES" 0 KB 0 rows
. . exported "XXIS"."XXIS_DOCUMENT_RECEIPT" 0 KB 0 rows
. . exported "XXIS"."XXIS_DOC_INSTRUCTION" 0 KB 0 rows
. . exported "XXIS"."XXIS_EXPORT_BL" 0 KB 0 rows
. . exported "XXIS"."XXIS_FUND_ACCOUNTS" 0 KB 0 rows
. . exported "XXIS"."XXIS_GEN_DA_NO" 0 KB 0 rows
. . exported "XXIS"."XXIS_MERGE_RECEIPTS" 0 KB 0 rows
. . exported "XXIS"."XXIS_PRICE_HEADERS_ALL" 0 KB 0 rows
. . exported "XXIS"."XXIS_PUMP_PRICES" 0 KB 0 rows
. . exported "XXIS"."XXIS_ROOF_LEG_CHANGES" 0 KB 0 rows
. . exported "XXIS"."XXIS_SAMPLE_RECEIPT" 0 KB 0 rows
. . exported "XXIS"."XXIS_SHELL_CORRECTION" 0 KB 0 rows
. . exported "XXIS"."XXIS_SITE_ACCOUNTS" 0 KB 0 rows
. . exported "XXIS"."XXIS_SITE_TANK_DIPS" 0 KB 0 rows
. . exported "XXIS"."XXIS_SITE_USERS" 0 KB 0 rows
. . exported "XXIS"."XXIS_TABLE_6B" 0 KB 0 rows
. . exported "XXIS"."XXIS_TRANSPORTER_CHARGES_AUDIT" 0 KB 0 rows
. . exported "XXIS"."XXIS_TRIP_OUTPUT" 0 KB 0 rows
. . exported "XXIS"."XXIS_TRUCK_AVAILABILITY" 0 KB 0 rows
. . exported "XXIS"."XXLAB_OST_PRDLIFT_DETAILS" 0 KB 0 rows
. . exported "XXIS"."XXLAB_OST_PRDLIFT_HEADERS" 0 KB 0 rows
Master table "XXIS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for XXIS.SYS_EXPORT_SCHEMA_01 is:
/oradata1/exportloc/XXIS_SCHEMA_27082010.dmp
Job "XXIS"."SYS_EXPORT_SCHEMA_01" successfully completed at 12:08:43