simon pane first4 database partners simon.pane@first4db

28
Simon Pane First4 Database Partners [email protected] May 19, 2011

Upload: others

Post on 30-Dec-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Simon Pane First4 Database Partners Simon.Pane@first4db

Simon PaneFirst4 Database Partners

[email protected] 19, 2011

Page 2: Simon Pane First4 Database Partners Simon.Pane@first4db

Quick overview

Real world tips and suggestions throughout

Ideas of “Advanced Topics” for future consideration

Page 3: Simon Pane First4 Database Partners Simon.Pane@first4db

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

Page 4: Simon Pane First4 Database Partners Simon.Pane@first4db

Possibly misses things:◦ New tablespaces

◦ Control files after changes

Possibly includes things it shouldn’t◦ Online redo logs – do you back those up or not?

Requires tablespaces to be put into hot-backup mode (if you’re doing it right)

Shell scripting failures:# Clean out the last backup

rm -rf $LAST_BACKUP_FILE_BASE

Page 5: Simon Pane First4 Database Partners Simon.Pane@first4db

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

Page 6: Simon Pane First4 Database Partners Simon.Pane@first4db

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

Page 7: Simon Pane First4 Database Partners Simon.Pane@first4db

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

Page 8: Simon Pane First4 Database Partners Simon.Pane@first4db

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

Page 9: Simon Pane First4 Database Partners Simon.Pane@first4db

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']

Page 10: Simon Pane First4 Database Partners Simon.Pane@first4db

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';

Page 11: Simon Pane First4 Database Partners Simon.Pane@first4db

list backup summary;

list backup by file;

list backup;

list expired backup;

list backup of tablespace SYSTEM;

list backup of datafile 3;

list archivelog all;

list backup of archivelog all;

Page 12: Simon Pane First4 Database Partners Simon.Pane@first4db

report need backup days = 1;

report need backup redundancy = 2;

report unrecoverable;

report obsolete;

Page 13: Simon Pane First4 Database Partners Simon.Pane@first4db

CROSSCHECK◦ Check if what RMAN “thinks” is there is still actually

there

CATALOG◦ Let RMAN know about new backup pieces or file copies

it’s currently not aware of Don’t confuse the “catalog” command with the “Repository

Catalog” – they’re not related

Examples:◦ crosscheck backup;

◦ catalog start with ‘/tmp/restored/’;

Page 14: Simon Pane First4 Database Partners Simon.Pane@first4db

Usually there’s 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 it’s there, don’t if it’s not

Page 15: Simon Pane First4 Database Partners Simon.Pane@first4db

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';’

Page 16: Simon Pane First4 Database Partners Simon.Pane@first4db

Regardless of whether you’re 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

Page 17: Simon Pane First4 Database Partners Simon.Pane@first4db

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.112/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)

Page 18: Simon Pane First4 Database Partners Simon.Pane@first4db

Useful when you have a very small environment

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

PROD1 TEST1

Catalog Into

Catalog Into

Page 19: Simon Pane First4 Database Partners Simon.Pane@first4db

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

Page 20: Simon Pane First4 Database Partners Simon.Pane@first4db

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 doesn’t take into account compression and backup optimization

Page 21: Simon Pane First4 Database Partners Simon.Pane@first4db

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

Page 22: Simon Pane First4 Database Partners Simon.Pane@first4db

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;

Page 23: Simon Pane First4 Database Partners Simon.Pane@first4db

I’ll 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

Page 25: Simon Pane First4 Database Partners Simon.Pane@first4db

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

Page 26: Simon Pane First4 Database Partners Simon.Pane@first4db

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)

Page 27: Simon Pane First4 Database Partners Simon.Pane@first4db

Keep your commands/scripts handy◦ Can’t remember all of the commands

Practice in a test environment regularly

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