- Backup entire database using Data Pump.
- Backup table(s)
- Backup tablespace(s)
- Backup schema(s)
- Backup using Transportable tablespaces (TTS)
- Generate multiple small sizes of dump files
- Backup in parallel mode
There are single shot solution to all the above problem statement and it is Data Pump. It is one of various backup tools provided by Oracle and it is regularly improved by them.
One can access Data Pump utility using its interface DBMS_DATAPUMP PL/SQL package, DBMS_METADATA, expdp & impdp. The use of expdp facilitates database backup at various levels.
expdp can be utilized in various ways to achieve different objectives related to backups. However, to execute expdp command user needs to have DATAPUMP_EXP_FULL_DATABASE role assigned in case if any table beyond your schema needs to be exported.
A schema export is specified using the SCHEMAS parameter. This is the default export mode. In fact expdp command is supplied with few parameters:
- directory : Name of directory which will be the location of file creation.
- dumpfile : Name of dump file. For multiple files generic format <name>_%u.dmp can also be given.
- logfile : Name of logfile.
- include : Specific object can be included by this parameter.
- exclude : Specific object can be excluded by this parameter.
- content : This will limit content of dump file. Possible values would be METADATA_ONLY, DATA_ONLY, ALL
- query : Filter rows of tables by supplying where clause. For example where clause can be supplied as SCOTT.DEPT:'”WHERE ROWNUM = 0″‘
- network_link : This is used to utilized database linke during export.
- flashback_time : This feature is supplied to get data consistency. Possible values: systimestamp
- flashback_scn : This feature is same as flashback_time. However, this will use scn number instead of timestamp.
- tables : List of tables can be provided using this parameter.
- attach : If a expdp job is executing in background, user can connect with the specific job using this parameter.
- compression : Compress the dump file contents. Possible values: METADATA_ONLY, DATA_ONLY, ALL, NONE
- estimate : This will help to estimate required disk space. Possible value : Y, N
- filesize : Size of dump file can be limited to the value of this parameter.
- job_name : Name of export job to be defined using this parameter.
- nologfile : Log file creation can be suppressed.
- parallel : Cuncurrent number of thread for execution of expdp job.
- parfile : Parameters can be defined with expdp on command line or can be defined in a file and name of the file is provided using this parameter.
- reuse_dumpfiles : Existing dump file with same name will be Overwritten.
- schemas : List of schemas to be provided.
- status : The frequency in seconds which job displays client feedback
- tablespaces : List of tablespaces to be provided.
- transport_full_check : This is helpfule in case of transportable tablespaces for checking dependencies of objects to be exported.
- transport_tablesapces : Using this parameter metadata of DB can be exported. This is the method through which we can migrate/move/copy multi terabytes database to another server.
The expdp command can be written for table level backup as:
expdp oracle/********@orcl tables=t1 directory=TEST_DIR dumpfile=T1_%U.dmp logfile=expdpEMP_DEPT.log filesize=1M
[oracle@mishika expdp]$ expdp oracle/********@orcl tables=t1 directory=TEST_DIR dumpfile=T1_%U.dmp logfile=expdpEMP_DEPT.log filesize=1M
Export: Release 18.104.22.168.0 – on XXXX XXXXXXXX XXXX
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 22.214.171.124.0 – 64bit
Starting “oracle”.”SYS_EXPORT_TABLE_02″: oracle/********@orcl tables=t1 directory=TEST_DIR dumpfile=T1_%U.dmp logfile=expdpEMP_DEPT.log filesize=1M
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/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
. . exported “oracle”.”T1″ 22.69 MB 173992 rows
Master table “oracle”.”SYS_EXPORT_TABLE_02″ successfully loaded/unloaded
Dump file set for oracle.SYS_EXPORT_TABLE_02 is:
Job “oracle”.”SYS_EXPORT_TABLE_02″ successfully completed at Fri Sep 1 16:05:44 2017 elapsed 0 00:00:49