Sunday, 21 January 2018

Logical Backup (Datapump Utility)

Oracle backup Logical Backup

About the backup, i've already give a bit clue in my previous blog (https://tauseefdba.blogspot.com/2018/01/backing-up-oracle-database-physical.html), Logical backup is one in which we didn't copy files but copy structure and the data with in that structure is copied. Logical backup means backing up the database objects like tables, views , indexes...etc using the datapump (EXPDP,IMDP) utility given by Oracle.
Datapump is a bit faster than export utility used in past, but its over all too slow as compared to physical/RMAN backup, but it is handy in moving objects or schemas in between the databases. Simple prcoess to take backup through Datapump is :

-- Getting started

create user testuser identified by test default tablespace users;

-- Create directory at location physically

$ cd /u01

u01$ mkdir backup

$ cd backup

$ pwd
/u01/backup

-- Creating directory in Oracle Database

$sqlplus / as sysdba

SQL> create directory backup as '/u01/backup';

-- Granting privileges

SQL> grant read,write ON DIRECTORY backup TO testuser;

--Full database backup

expdp system/oracle full=y dumpfile=testdb_full.dmp logfile=export_testdb_full.log directory=backup

Impdp system/oracle Full=y dumpfile=testdb_full.dmp logfile=import_testdb_full.log directory=backup

-- Specific Schemas

expdp system/oracle schemas=hr,scott dumpfile=testdb_hrscott.dmp logfile=export_hrscott_full.log directory=backup

Impdp system/oracle schemas=hr,scott dumpfile=testdb_hrscott.dmp logfile=import_hrscott_full.log directory=backup

--  Selective Tables

expdp hr/hr tables=EMPLOYEES,DEPARTMENT directory=backup dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log

impdp hr/hr tables=EMPLOYEES,DEPARTMENT directory=backup dumpfile=EMP_DEPT.dmp logfile=impdpEMP_DEPT.log

-- Backing meta data only

expdp  system/oracle directory=backup dumpfile=hr_metadata_content.dmp logfile=exp_content_hr.log schemas=hr content=METADATA_ONLY

impdp directory=backup dumpfile=hr_metadata_content.dmp logfile=imp_content_meta_hr.log remap_schema=hr:hr_new full=y


No comments:

Post a Comment

Installing Oracle 11g on Linux

Unpack Files Unzip the files. # 11.2.0.1 unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip #11.2.0.2 u...