0% found this document useful (0 votes)
8 views

Oracle DB Backup Methods

Uploaded by

rosini.credesoft
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Oracle DB Backup Methods

Uploaded by

rosini.credesoft
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Oracle DB Backup Methods

3 types of Backup methods

1. RMAN
2. Data Pump
3. User – managed --- I think I did this for OPatch b/up the other day

Backup and Recovery Techniques


 RMAN
o It’s an Oracle Database feature and does not require separate installation.
o

 User-Managed Techniques
o use operating system commands such as the Linux dd for backing up and restoring files
and the SQL*Plus RECOVER command for media recovery.
o Fully support but not recommended

 Data Pump
o Oracle Data Pump technology enables very high-speed movement of data and metadata
from one database to another.

Table 1-1 Feature Comparison of Backup Techniques

Recovery Manager Data Pump


Feature User-Managed
(RMAN) Export
Closed
Supported. Requires
database Supported. Not supported.
instance to be mounted.
backups

Requires
rollback or
Open Supported. No need to Supported. Must
undo segments
database use BEGIN/END BACKUP sta use BEGIN/END BACKU
to generate
backups tements. P statements.
consistent
backups.

Incremental
Supported. Not supported. Not supported.
backups

Corrupt Supported. Identifies Not supported. Supported.


block corrupt blocks and logs Identifies
detection in V$DATABASE_BLOCK_C corrupt blocks
Recovery Manager Data Pump
Feature User-Managed
(RMAN) Export
in the export
ORRUPTION.
log.

Supported. Establishes the


Automatic
name and locations of all Not supported. Files to
specification
files to be backed up (whole be backed up must be
of files to Not applicable.
database, tablespaces, data located and copied
include in a
files, control files, and so manually.
backup
on).

Supported. Backups are


recorded in the control file,
which is the main
repository of RMAN Not supported. DBA
Backup
metadata. Additionally, you must keep own records Not supported.
repository
can store this metadata in of backups.
a recovery catalog, which is
a schema in a different
database.

Supported. Interfaces with


a media management
software. RMAN also
Supported. Backup to
Backups to a supports proxy copy, a
tape is manual or
media feature that enables a media Not supported.
controlled by a media
manager manager to manage
manager.
completely the transfer of
data between disk and
backup media.

Backup of
initialization
Supported. Supported. Not supported.
parameter
file

Backup of
password
and Not supported. Supported. Not supported.
networking
files

Platform-
independent
Supported. Not supported. Supported.
language for
backups
Recovery Manager (RMAN)
 Recovery Manager is fully integrated with the Oracle Database to perform a range of backup
and recovery activities, including maintaining an RMAN repository of historical data about
backups.
 access RMAN through the command line or through Oracle Enterprise Manager.

RMAN COMMAND
To start RMAN, in command line: rman

Connect to a Database for RMAN to proceed:

CONNECT TARGET;

To show failures that occurred in

To start the DB Backup


BACKUP DATABASE;

--- need to alter the DB to be in ARCHIVE mode to begin the backup


To see RMAN configuration details:

SHOW ALL;
BACKUP VALIDATE CHECK LOGICAL

DATABASE ARCHIVELOG ALL;

To see the files that have been back up & can be recovered

LIST BACKUP RECOVERABLE


RMAN in NOARCHIVELOG Mode
RMAN> SHUTDOWN IMMEDIATE;
RMAN> STARTUP FORCE DBA;
RMAN> SHUTDOWN IMMEDIATE;
RMAN> STARTUP MOUNT;
BACKUP DATABASE;

RMAN> ALTER DATABASE OPEN;

RMAN Command to view files that need to be backup

REPORT SCHEMA;
CROSSCHECK BACKUP;

CROSSCHECK COPY;
Oracle Data Pump
 three distinct components:
o Command-line clients, expdp and impdp
o DBMS_DATAPUMP PL/SQL package (also known as the Data Pump API)
o DBMS_METADATA PL/SQL package (also known as the Metadata API).
 expdp and impdp - > starts the Oracle Data Pump Export utility and Oracle Data Pump
Import utility, respectively.
o Need login credentials – thought sys has sysdba privileges

Logged in and checked

Command to check current user  does this mean sysdba = sys ---?

Checking privileges;
To see directory:

set linesize 200


col directory_name for a45
col directory_path for a100
SELECT directory_name, directory_path FROM dba_directories ;

Already got an available directory in the DB:


DATA_PUMP_DIR /u01/app/oracle/admin/UATMXDB/dpdump/
Logging into DataPump export

Grant Privileges to users to data pump


SQL> GRANT READ, WRITE ON DIRECTORY DATA_PUMP_DIR TO SYSTEM;
SQL> GRANT READ, WRITE ON DIRECTORY DATA_PUMP_DIR TO SYS;
SQL> GRANT DATAPUMP_EXP_FULL_DATABASE TO system;
SQL> GRANT DATAPUMP_EXP_FULL_DATABASE TO SYS;

Run Export Data Pump [Full Database export]:


CODE:
expdp SYS/SYS@UATMXDB DIRECTORY=DATA_PUMP_DIR DUMPFILE=orclfull.dmp
LOGFILE=full_exp.log FULL=YES;

Parameters used in the above EXPDP command.


User Login:
The first parameter is a user login. Here you provide the login information of that user using which
you want to perform the export. So here in my case I have provided the login of my SYS user
(SYS/SYS@UATMXDB ) accompanied with the SID of my database which is UATMXDB.

DIRECTORY:
Using DIRECTORY parameter, specify the default location to which Export can write the dump file set
and the log file. Here in my case DIRECTORY parameter is set on the directory object,
DATA_PUMP_DIR

DUMPFILE:
Using DUMPFILE parameter, specify the names, and optionally, the directory objects of dump files
for an export job.

The dump file is made up of one or more disk files that contain table data, database object’s
metadata and control information. In addition to that, these files are written in binary format and
dump files can be imported only by data pump impdp import utility. As they are written in binary
format by server using expdp export utility thus they should not be tampered. Changing information
in these files might compromise the data consistency which may cause an error while importing.

You can supply multiple file names here separated by comma. Dot dmp is the default extension for
dump file. If no extension is given then expdp export utility will use this default extension. Though
you can specify whatever extension you want but it’s always advisable to use the oracle
recommended extensions.

Log file:
Using log file parameter expdp export utility will generate a human readable log file for you which
are very helpful in tracking the status of your export.

FULL:
This parameter full indicates that you want to perform a full database export. This parameter can
have YES or NO values. If you set this parameter to YES that means expdp utility will export all the
data and metadata of the database.

You will be prompted to login:


Username: <USERNAME> / as sysdba [this part IMP!]
Password: <password created / given >
Checking to see if dump files (.dmp) were created:

Run Import Data Pump [Full Database Import]:

impdp SYS/SYS@UATMXDB DIRECTORY=DATA_PUMP_DIR DUMPFILE=orclfull.dmp


LOGFILE=full_imp.log FULL=YES;

--- same as expdp // just remember to change the LOGFILE name!


Checking the Directory:

You might also like