SAMPLE :
- SAMPLE parameter is used for exporting the sample number of rows.
- SAMPLE Percentage of data to be exported.Suppose if you don’t want the entire data from a table or schema and just need few numbers of records you can use this sample parameter of expdp utility.
-
The sample_percent indicates the probability that a block of rows will be selected as part of the sample. It does not mean that the database will retrieve exactly that amount of rows from the table.
Table record count :
SQL> conn hari/oracle;
Connected.
SQL> select count(*) from emp;
COUNT(*)
--------
100000
Scenario 1
Export the sample data from emp table
[oracle@18c empdata]$ expdp system/oracle directory=test_dir tables=hari.emp dumpfile=emp.dmp logfile=emp.log sample=10 Export: Release 18.0.0.0.0 - Production on Thu Aug 23 20:12:32 2018 Version 18.3.0.0.0 Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/******** directory=test_dir tables=hari.emp dumpfile=emp.dmp logfile=emp.log sample=10 Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER Processing object type TABLE_EXPORT/TABLE/TABLE . . exported "HARI"."EMP" 91.39 KB 9943 rows Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded *********************************************************************** Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is: /u01/empdata/emp.dmp Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at Thu Aug 23 20:12:48 2018 elapsed 0 00:00:15
Scenario 2
[oracle@18c empdata]$ expdp system/oracle directory=test_dir tables=hari.emp dumpfile=emp1.dmp logfile=emp1.log sample=10 Export: Release 18.0.0.0.0 - Production on Thu Aug 23 20:13:07 2018 Version 18.3.0.0.0 Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/******** directory=test_dir tables=hari.emp dumpfile=emp1.dmp logfile=emp1.log sample=10 Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER Processing object type TABLE_EXPORT/TABLE/TABLE . . exported "HARI"."EMP" 92.63 KB 10088 rows Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded *********************************************************************** Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is: /u01/empdata/emp1.dmp Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at Thu Aug 23 20:13:23 2018 elapsed 0 00:00:15
Note: Everytime you perform the export count of rows would be different as it take out the sample of subset of a table.
Catch Me On:- Hariprasath Rajaram
Telegram:https://t.me/joinchat/I_f4DhGF_Zifr9YZvvMkRg
LinkedIn:https://www.linkedin.com/in/hari-prasath-aa65bb19/
Facebook:https://www.facebook.com/HariPrasathdba
FB Group:https://www.facebook.com/groups/894402327369506/
FB Page: https://www.facebook.com/dbahariprasath/?
Twitter: https://twitter.com/hariprasathdba