🫑Export and Import Oracle Database with Data Pump

Data Pump เป็น Utility ของ Oracle Database ที่ใช้ในการ Backup, Restore & Recovery เหมือน RMAN ในลักษณะของ Logical Backup ที่ใช้งานง่ายกว่า และไม่ต้องทำการ Enable Archive Log Mode เหมาะในกรณีที่ไม่สามารถ Shutdown Database เพื่อทำการ Enable Archive Log Mode ได้ แต่ทำงานช้ากว่ามาก และต้องทำการ Create Database ขึ้นมาก่อน

Get Started

  • ทำการ Connect Database ด้วย SQL*Plus

$
sqlplus / as sysdba
  • ทำการตรวจสอบ Fast Recovery Area จะเห็นว่า Space Limit ถูกใช้จนเต็ม

SQL>
select space_used/1024/1024/1024, space_limit/1024/1024/1024 from v$recovery_file_dest ;
SPACE_USED/1024/1024/1024 SPACE_LIMIT/1024/1024/1024
------------------------- --------------------------
               3.92004061                     3.9375
  • ทำการเพิ่ม Size ของ Fast Recovery Area

SQL>
alter system set db_recovery_file_dest_size=30G ;
  • ทำการตรวจสอบ Fast Recovery Area อีกครั้งหนึ่ง

SQL>
select space_used/1024/1024/1024, space_limit/1024/1024/1024 from v$recovery_file_dest ;
SPACE_USED/1024/1024/1024 SPACE_LIMIT/1024/1024/1024
------------------------- --------------------------
               3.92004061                         30
  • ทำการ Export Data Pump ด้วย SYSDBA

$
expdp \"/ as sysdba\" dumpfile=orcl.dmp logfile=export_orcl.log full=yes ;
  • ทำการ Create Tablespace ก่อนทำการ Import

  • ทำการ Import Data Pump ด้วย SYSDBA

  • กรณีที่ต้องการเฉพาะบาง Schema

  • กรณีที่ต้องการ Export แบบ Overwrite

อ่านเพิ่มเติม : https://bit.ly/2m0Vkyo, https://bit.ly/2maBFfW

Last updated

Was this helpful?