You are on page 1of 28

Simon Pane

First4 Database Partners


Simon.Pane@first4db.com
May 19, 2011

Quick overview

Real world tips and suggestions throughout

Ideas of Advanced Topics for future


consideration

Now more powerful yet simpler to use


More compatible than ever:

Handles Data De-duplication (i.e. DataDomain)


Handles disk snapshots/mirror splits (i.e. NetApp)
ASM (RAC or Grid Infrastructure)

Backups themselves are smaller:

Unused blocks, tempfiles, possibly read-only


tablespaces, etc are skipped

Block level restores


Compressed backups
Encrypted backups for additional protection

Possibly misses things:


New tablespaces
Control files after changes

Possibly includes things it shouldnt


Online redo logs do you back those up or not?

Requires tablespaces to be put into hotbackup mode (if youre doing it right)
Shell scripting failures:
# Clean out the last backup
rm -rf $LAST_BACKUP_FILE_BASE

The RMAN executable is just a CLI


Work is all done by DBMS_BACKUP_RESTORE
Hence can run client/server (like SQLPlus)

RMAN CLI can also do


Startup/Shutdown commands
SQL commands via SQL <> syntax
Does not provide any feedback/output
Not recommended use SQLPlus instead

Persistent configuration settings are stored in


the control files
Also visible through dynamic performance
views:
v$rman_configuration

Query through SQL statements or make a GC report

History also kept in the control files

Increase CONTROL_FILE_RECORD_KEEP_TIME
Defaults to 7 days

Not really a one-to-one correlation of


database files
Can be depends on how RMAN is configured
(File copies are also possible)

Think of them like ZIP files


Datafiles may be in spread among backup pieces

FILE_NAME
--------------1.txt
2.txt
cmdb_login.sql
connecttest.sql
norun.sql
nosysdba.sql
oraexecute.txt
pat_list.txt
privs.sql
runit.cmd
temp.sql
tns.txt
tnsnames.ora
tns_orig.txt

backup [as compressed backupset] [check logical]


[full] database [force]
[include current controlfile]
[format '$Backup_Base/%d_FULL_%I_%T_%s_%p.bak'] tag
['$RMAN_tag']
[plus archivelog]
[format '$Backup_Base/%d_ARCH_%I_%T_%s_%p.bak'] tag
['$RMAN_tag']

delete [noprompt] backup;


delete [noprompt] obsolete redundancy 2;
delete [noprompt] obsolete recovery window of 7 days;
delete [noprompt] archivelog all;
delete [noprompt] archivelog all backed up 1 times to
disk;

delete [noprompt] expired backup of tablespace SYSTEM


completed before 'SYSDATE-14';

list
list
list
list
list
list
list
list

backup summary;
backup by file;
backup;
expired backup;
backup of tablespace SYSTEM;
backup of datafile 3;
archivelog all;
backup of archivelog all;

report need backup days = 1;


report need backup redundancy = 2;
report unrecoverable;
report obsolete;

CROSSCHECK

Check if what RMAN thinks is there is still actually


there

CATALOG

Let RMAN know about new backup pieces or file copies


its currently not aware of
Dont confuse the catalog command with the Repository
Catalog theyre not related

Examples:
crosscheck backup;
catalog start with /tmp/restored/;

Usually theres no need to manually manage


channels (parallelism) anymore in run
blocks:
Usually configuring a default parallelism of 4
channels is optimal

Use Simple Commands

I rarely ever use run blocks

Don't panic about the catalog

Use it if its there, dont if its not

Always include the controlfile autobackups

Give pieces meaningful names

Must restore from the same location -> use a


symbolic link (even for the FRA) for all backups
Example:
ln s /u01/oracle/backups/PRD1/hot /database_backups
backup full database format /database_backups/
/%d_%I_%T_%s_%p.bak';

Regardless of whether youre restoring onto a


rebuilt/replaced machine or a copy on a test
server, the directories must be the same
Backup to: /u03/orabackups/PRD1
Restore from: /u01/orabackups/PRD1
Backup to: D:\ORA_BACKUPS\PRD1
Restore from: E:\ORA_BACKUPS\PRD1

Can have one or many highest release version


I consider it a "nice to have"
Does not require a separate license
Search "Infrastructure Repository Databases" (E10594-11)
http://download.oracle.com/docs/cd/E11882_01/license.11
2/e10594/editions.htm#CJAHFHBJ

If it's not there, it will resync automatically the


next time
To move, just re-REGISTER (new 11g IMPORT
command)

Useful when you have a very small


environment
Remember, the catalog is simply an Oracle
Schema (for backup history)
Catalog Into

PROD1

TEST1
Catalog Into

Catalog expires them when removed


Details are lost when they become expired
Should be doing DELETE EXPIRED

Keep a long term history yourself


Sometimes needed for auditor reporting
Makes it easier to pull old files from tape
Use a trigger or Scheduler Job to populate

Oracle 10g
Must have the backup pieces written to a shared
location or copy them manually if duplicating to a
different machine
DUPLICATE TARGET DATABASE TO TEST1;

Oracle 11g
New FROM ACTIVE DATABASE clause
Not as easy to restart if interrupted
Uses file copies so doesnt take into account
compression and backup optimization

Old DBID information is still present in:

Statspack Data
Automatic Workload Repository
Feature Usage Views
High Water Mark Views

Cleanup if desired:

dbms_swrf_internal.unregister_database
wri$_dbu_usage_sample
wri$_dbu_feature_usage
wri$_dbu_high_water_mark

Even if the password is well known or


hardcoded in scripts, encryption can provide
off-site/vendor protection
set encryption on identified by
passwd only;
backup full database;

Ill argue that cloud services are safe and reliable


But upload bandwidth can be an issue

Simple Approach: backup to disk and then


upload using a commercial tool:
Mozy, Carbonite, BackBlaze, etc.

Amazon Web Service (AWS) Integration:


The Oracle Secure Backup (OSB) Cloud Module allows for
RMAN backups to be written directly to the Amazon
Simple Storage Service (S3)
The OSB Cloud Module appears in RMAN as a tape device
Check with Oracle regarding OSB licensing requirements

Main download page:

http://www.oracle.com/technetwork/topics/cloud/down
loads/index.html

Readme:

http://www.oracle.com/technetwork/topics/cloud/osbw
s-readme-083624.html

Download the library:

http://rman.s3.amazonaws.com/osbws_install.jar

Install JAR file into Oracle Home


In RMAN

Configure SBT channel device specifying the library


options
Perform backup

Catalog saved scripts


Makes the Catalog more important!!

Tablespace Point In Time Recovery (TSPITR)


Schedule the RMAN backups from within the
Database!
Use the Oracle Scheduler to call the RMAN APIs or
an external OS script

Password files
OraInventory and oraInst.loc
Networking files:
sqlnet.ora tnsnames.ora ldap.ora listener.ora

Oratab file
Startup/Shutdown scripts:

/etc/inittab, /etc/init.d/dbora

CRS/CSS/ HAS files


OCR/OLR files

backups and /etc/oracle/ files

ASM Instances (metadata)

Keep your commands/scripts handy


Cant remember all of the commands

Practice in a test environment regularly


Review the new features in each major release
and adjust your strategy accordingly

Simon.Pane@first4db.com

You might also like