rman - from the basics to the cloud

Upload: manohar-kothandaraman

Post on 02-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 RMAN - From the Basics to the Cloud

    1/28

    Simon Pane

    First4 Database [email protected]

    May 19, 2011

    mailto:[email protected]:[email protected]
  • 8/10/2019 RMAN - From the Basics to the Cloud

    2/28

  • 8/10/2019 RMAN - From the Basics to the Cloud

    3/28

    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-onlytablespaces, etc are skipped

    Block level restores Compressed backups Encrypted backups for additional protection

  • 8/10/2019 RMAN - From the Basics to the Cloud

    4/28

    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 hot-backup mode (if youre doing it right)

    Shell scripting failures:# Clean out the last backuprm -rf $LAST_BACKUP_FILE_BASE

  • 8/10/2019 RMAN - From the Basics to the Cloud

    5/28

    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

  • 8/10/2019 RMAN - From the Basics to the Cloud

    6/28

    Persistent configuration settings are stored inthe 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

  • 8/10/2019 RMAN - From the Basics to the Cloud

    7/28

    Not really a one-to-one correlation ofdatabase 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

  • 8/10/2019 RMAN - From the Basics to the Cloud

    8/28

    FILE_NAME

    ---------------1.txt

    2.txt

    cmdb_login.sql

    connecttest.sql

    norun.sql

    nosysdba.sqloraexecute.txt

    pat_list.txt

    privs.sql

    runit.cmd

    temp.sql

    tns.txttnsnames.ora

    tns_orig.txt

  • 8/10/2019 RMAN - From the Basics to the Cloud

    9/28

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

  • 8/10/2019 RMAN - From the Basics to the Cloud

    10/28

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

    delete [noprompt] expired backup of tablespace SYSTEMcompleted before 'SYSDATE-14';

  • 8/10/2019 RMAN - From the Basics to the Cloud

    11/28

    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;

  • 8/10/2019 RMAN - From the Basics to the Cloud

    12/28

    report need backup days = 1;

    report need backup redundancy = 2;

    report unrecoverable;

    report obsolete;

  • 8/10/2019 RMAN - From the Basics to the Cloud

    13/28

    CROSSCHECK Check if what RMAN thinks is there is still actually

    there

    CATALOG Let RMAN know about new backup pieces or file copiesits currently not aware of Dont confuse the catalog command with the Repository

    Catalog theyre not related

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

  • 8/10/2019 RMAN - From the Basics to the Cloud

    14/28

    Usually theres no need to manually managechannels (parallelism) anymore in runblocks: 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

  • 8/10/2019 RMAN - From the Basics to the Cloud

    15/28

    Always include the controlfile autobackups

    Give pieces meaningful names

    Must restore from the same location -> use asymbolic 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';

  • 8/10/2019 RMAN - From the Basics to the Cloud

    16/28

    Regardless of whether youre restoring onto arebuilt/replaced machine or a copy on a testserver, 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

  • 8/10/2019 RMAN - From the Basics to the Cloud

    17/28

    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 thenext time

    To move, just re-REGISTER (new 11g IMPORTcommand)

    http://download.oracle.com/docs/cd/E11882_01/license.112/e10594/editions.htmhttp://download.oracle.com/docs/cd/E11882_01/license.112/e10594/editions.htmhttp://download.oracle.com/docs/cd/E11882_01/license.112/e10594/editions.htmhttp://download.oracle.com/docs/cd/E11882_01/license.112/e10594/editions.htm
  • 8/10/2019 RMAN - From the Basics to the Cloud

    18/28

    Useful when you have a very smallenvironment

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

    PROD1 TEST1

    Catalog Into

    Catalog Into

  • 8/10/2019 RMAN - From the Basics to the Cloud

    19/28

    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

  • 8/10/2019 RMAN - From the Basics to the Cloud

    20/28

    Oracle 10g Must have the backup pieces written to a shared

    location or copy them manually if duplicating to adifferent 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

  • 8/10/2019 RMAN - From the Basics to the Cloud

    21/28

    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_samplewri$_dbu_feature_usage

    wri$_dbu_high_water_mark

  • 8/10/2019 RMAN - From the Basics to the Cloud

    22/28

    Even if the password is well known orhardcoded in scripts, encryption can provideoff site/vendor protection

    set encryption on identified bypasswd only;

    backup full database;

  • 8/10/2019 RMAN - From the Basics to the Cloud

    23/28

    Ill argue that cloud services are safe and reliable But upload bandwidth can be an issue

    Simple Approach: backup to disk and thenupload 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 AmazonSimple Storage Service (S3)

    The OSB Cloud Module appears in RMAN as a tape device

    Check with Oracle regarding OSB licensing requirements

  • 8/10/2019 RMAN - From the Basics to the Cloud

    24/28

    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

    http://www.oracle.com/technetwork/topics/cloud/downloads/index.htmlhttp://www.oracle.com/technetwork/topics/cloud/downloads/index.htmlhttp://www.oracle.com/technetwork/topics/cloud/osbws-readme-083624.htmlhttp://www.oracle.com/technetwork/topics/cloud/osbws-readme-083624.htmlhttp://rman.s3.amazonaws.com/osbws_install.jarhttp://rman.s3.amazonaws.com/osbws_install.jarhttp://www.oracle.com/technetwork/topics/cloud/osbws-readme-083624.htmlhttp://www.oracle.com/technetwork/topics/cloud/osbws-readme-083624.htmlhttp://www.oracle.com/technetwork/topics/cloud/osbws-readme-083624.htmlhttp://www.oracle.com/technetwork/topics/cloud/osbws-readme-083624.htmlhttp://www.oracle.com/technetwork/topics/cloud/osbws-readme-083624.htmlhttp://www.oracle.com/technetwork/topics/cloud/osbws-readme-083624.htmlhttp://www.oracle.com/technetwork/topics/cloud/downloads/index.htmlhttp://www.oracle.com/technetwork/topics/cloud/downloads/index.html
  • 8/10/2019 RMAN - From the Basics to the Cloud

    25/28

    Catalog saved scripts Makes the Catalog more important!!

    Tablespace Point In Time Recovery (TSPITR)

    Schedule the RMAN backups from within theDatabase!

    Use the Oracle Scheduler to call the RMAN APIs oran external OS script

  • 8/10/2019 RMAN - From the Basics to the Cloud

    26/28

    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)

  • 8/10/2019 RMAN - From the Basics to the Cloud

    27/28

    Keep your commands/scripts handy Cant remember all of the commands

    Practice in a test environment regularly

    Review the new features in each major releaseand adjust your strategy accordingly

  • 8/10/2019 RMAN - From the Basics to the Cloud

    28/28

    [email protected]