Os Us en Wp Snapshot[1]

download Os Us en Wp Snapshot[1]

of 20

Transcript of Os Us en Wp Snapshot[1]

  • 8/2/2019 Os Us en Wp Snapshot[1]

    1/20

    An Oracle White Paper

    April 2010

    Backup and Recovery for Oracle Databaseswith the Snapshot Feature of Sun Storage 7000Unified Storage Systems

  • 8/2/2019 Os Us en Wp Snapshot[1]

    2/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    Introduction ......................................................................................... 1Configuration Details........................................................................... 2

    Tested Configurations ..................................................................... 2Projects and File System Details .................................................... 2Prerequisites ...................................................................................3

    Using the Snapshot Feature with Oracle Databases .......................... 4Snapshot Feature Overview............................................................ 4Cold Backup for Oracle Databases................................................. 4Hot Backup for Oracle Databases................................................... 6

    Accessing the Snapshot, Using the Cloning Process ......................... 8Clone Overview............................................................................... 8Cloning the Snapshot...................................................................... 9

    Accessing the Clone for Backup ....................................................... 10Accessing the Clone ..................................................................... 10

    Restoration and Recovery of the Oracle Database........................... 11Rollback Overview ........................................................................ 11Full Database Restore with the Rollback Feature......................... 11Restoring and Recovering Datafiles, Using theRollback Feature ........................................................................... 13Restoring Only Selected Datafiles ................................................ 15

    Recommendations ............................................................................ 15Conclusion ........................................................................................ 16Appendix 1: For More Information..................................................... 17

  • 8/2/2019 Os Us en Wp Snapshot[1]

    3/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    Introduction

    Oracles Sun Storage 7000 Unified Storage Systems family of products has comprehensive

    data protection features that provide instant snapshots, cloning, rollback, and remote

    replication. These features can make database protection and maintenance tasks easier for

    systems and database administrators. This document shows the methodologies to be used for

    performing backup and recovery operations on Oracle databases, using the snapshot, clone,and rollback features. It is intended for Oracle Database administrators, system administrators,

    and anyone else who would like to understand or deploy Oracle databases with these features.

    Topics covered in this paper include the following:

    Consistent cold backup point-in-time copy using the snapshot feature

    Hot backup point-in-time copy using the snapshot feature

    Using the clone feature for backup, test, and data verification

    Using the rollback feature to restore database files

    Note: Because the products in the Sun Storage 7000 Unified Storage Systems family provide

    the same Web-based graphical user interface, this document applies to the entire family. The

    release used here was 2008.Q4.

    1

  • 8/2/2019 Os Us en Wp Snapshot[1]

    4/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    Configuration Details

    The following sections and Figure 1 offer details about the configuration used for the examples

    discussed in this paper.

    Tested Configurations

    Database release:

    Oracle9iDatabase Release 2 (9.2), Oracle Database 10gRelease 2 (10.2), Oracle Database 11g

    Release 1 (11.1.6)

    Operating system:

    Oracle Solaris 10 5/08 for SPARC and x64 platforms

    Red Hat Enterprise Linux (RHEL) 5.2 (x64) NFS version 3

    Projects and File System Details

    Sun Storage 7000 Unified Storage Systems: isv-USS

    Oracle userid in the Sun Storage 7000 Unified Storage Systems: oracle

    Production database details:

    Oracle project: oracle_project

    Oracle Database shares: oradata, oralog, oraarchive

    Control files: Stored in oralog share

    Mount point in the Sun Storage 7000 Unified Storage Systems:

    /export/oracle_project/

    Mount point in the client: /oradata/data, /oradata/logs, /oradata/archive

    Client (database server): isv-6300b

    Cloned database details:

    Cloned Oracle project: oracle_clone_project

    Cloned Oracle Database shares: oradata, oralog, oraarchive

    Cloned mount point in the Sun Storage 7000 Unified Storage Systems:

    /export/oracle_clone_project/

    Cloned mount point in the different client: /oradata/data, /oradata/logs, /oradata/archive

    Client (database server): isv-6300c

    2

  • 8/2/2019 Os Us en Wp Snapshot[1]

    5/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    Prerequisites

    Following are the prerequisites for the configuration used for the examples discussed in this paper:

    The Oracle Database instance is already running on the database server (client) accessing the Sun

    Storage 7000 Unified Storage Systems for the database, using the Network File System (NFS)

    protocol.

    The user, roles, project, and Secure Shell (SSH) are configured as described in the following

    BigAdmin articles about the Sun Storage 7000 Unified Storage Systems:

    Deploying Oracle Databases Using NFS on Sun Storage 7000 Unified Storage Systems

    www.sun.com/bigadmin/features/articles/7000_oracle_deploy.jsp

    Deploying Oracle ASM Using iSCSI on Sun Storage 7000 Unified Storage Systems

    www.sun.com/bigadmin/features/articles/7000_oracle_iscsi_asm.jsp

    Note: The clone is accessed from an alternative client (isv-6300c), and the database server (isv 6300b)

    accesses oracle_project.

    Figure 1. This figure depicts configuration details of the Sun Storage 7000 Unified Storage Systems usage of the snapshot feature.

    3

  • 8/2/2019 Os Us en Wp Snapshot[1]

    6/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    Using the Snapshot Feature with Oracle Databases

    Sun Storage 7000 Unified Storage Systems products provide a convenient way to take a point-in-time

    snapshot copy of either the share or the project containing the database files.

    Snapshot Feature Overview

    Snapshots are read-only copies. In a project-level snapshot, every share in the project has its own copy

    of the snapshot, all with the same snapshot name. The snapshot uses a copy-on-write method and

    hence doesnt occupy any space at the beginning. When new data is written to the share, the old copy

    is written to the snapshot.

    Sun Storage 7000 Unified Storage Systems products can support an unlimited number of snapshots. A

    snapshot is dependent on the parent share.

    Figure 2. Sun Storage 7000 Unified Storage Systems products can support an unlimited number of snapshots.

    Types of Snapshots

    Sun Storage 7000 Unified Storage Systems products can support the following types of snapshots:

    Manual snapshots. Manual snapshots are on-demand snapshots. The user can initiate a snapshot

    anytime, at either the project level or the share level.

    Scheduled snapshots. At a predetermined interval defined by the user (minute, hour, day, week,

    month), snapshots are automatically taken without user interaction. With this method, users have the

    choice of specifying the number of snapshots kept.

    Cold Backup for Oracle Databases

    Cold backup is the type of Oracle database backup done when the database is in shutdown (or in not-

    mounted state). If the database is running in nonarchived log mode, this is the only possible backup

    mode. The backup time depends on the size of the database and also on how fast the copy is made.

    4

  • 8/2/2019 Os Us en Wp Snapshot[1]

    7/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    With the snapshot feature, the downtime of the database can be reduced dramatically, because the

    database needs to be in shutdown for only a few seconds until the snapshot is taken.

    Figure 3. This figure il lustrates a snapshot of the database, or cold backup.

    To take a consistent snapshot of the Oracle database

    1. Shut down the database.

    SQL> shutdown immediate;

    2. Take the snapshot of the share. From the GUI, select Shares -> Projects -> [oracle_db project] -

    > Snapshots.

    3. Click+ to add a manual snapshot, and provide a name such asoracle_snap.

    4. Alternatively, steps 2 and 3 can be done with the command-line interface (CLI). From the client (isv-6300b), do this:

    # ssh -l oracled isv-USS -T STARTUP PFILE=;

    Here are the scripts for the cold backup (to run as Oracle user):

    5

  • 8/2/2019 Os Us en Wp Snapshot[1]

    8/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    cold_backup.sh

    startdb.sh

    shutdb.sh

    Hot Backup for Oracle Databases

    In this mode, the backup is done while the database is up and running. With this backup method, the

    database must be running in archivelog mode. The backup time depends on the size of the databaseand also on how fast the copy is done. With the snapshot feature, the amount of time the database

    needs to be in hot backup mode is reduced dramatically.

    To take a snapshot of the Oracle database in hot backup mode

    6

  • 8/2/2019 Os Us en Wp Snapshot[1]

    9/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    1. Place the tablespaces (Oracle9iDatabase) or the database (Oracle Database 10g, Oracle Database

    11g) in hot backup mode.

    SQL> alter database begin backup;

    or

    SQL> alter tablespace begin backup;

    (Repeat step 1 for all the tablespaces.)

    2. Take the snapshot of the share. From the GUI, select Shares -> Projects -> [oracle_db project]

    -> Snapshots.

    3. Click+ to add a manual snapshot, and provide a name such as oracle_snap. A snapshot of the

    whole project with all the shares is taken.

    4. Alternatively, steps 2 and 3 can be done with the CLI. From the client, do this:

    # ssh -l oracled isv-USS -T alter database end backup;

    or

    SQL> alter tablespace end backup;

    (Repeat step 5 for all the tablespaces.)

    The whole hot backup procedure can be automated with the following script:

    7

  • 8/2/2019 Os Us en Wp Snapshot[1]

    10/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    hot_backup.sh

    begin_hot_backup.sql

    end_hot_backup.sql

    Accessing the Snapshot, Using the Cloning Process

    Cloning is the process of creating a readable/writable view of the snapshot.

    Clone Overview

    Cloning can be done only at the share level. More than one clone can exist for a snapshot, and each

    can have its own mount points, iSCSI target data, and so on. While clones are being used for

    read/write purposes, snapshots can be taken for those clones. Because a clone is a readable/writable

    view of the snapshot, there is a dependency between a clone and its parent snapshot. If either the

    8

  • 8/2/2019 Os Us en Wp Snapshot[1]

    11/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    snapshot or the parent share/logical unit number (LUN) is deleted, all the children snapshots as well as

    their clones and the clone snapshots will be deleted.

    Cloning the Snapshot

    Following is the procedure for cloning a snapshot:

    1. If the clones are to be grouped under a different project, create the project:

    oracle_clone_project

    Update the default mount point to

    /export/oracle_clone_project

    2. From the GUI, go to Shares -> Projects -> [ oracle_project] -> Shares -> [pencil icon for the

    oradata share that holds the Oracle database] -> Snapshots.

    3. Click+ on the oracle_snap snapshot.

    4. From the Project list, choose the name of the clone, as shown in Figure 4.

    Figure 4. This figure depicts the user interface for cloning a snapshot.

    5. Repeat steps 1 through 3 for the oralog and oraarchive shares.

    6. Alternatively, steps 2 through 5 can be done with the CLI. From the client, do this:

    # ssh -l oracled isv-USS -T

  • 8/2/2019 Os Us en Wp Snapshot[1]

    12/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    run(clone oracle_clone_project oralog);

    run(commit);

    run(shares select oracle_project);

    run(select oraarchive);run(snapshots select oracle_snap);

    run(clone oracle_clone_project oraarchive);

    run(commit);

    EOF

    7. If the original project is chosen, all the project characteristics will be inherited. It will have the mount

    point /export/oracle_clone_project/.

    Accessing the Clone for Backup

    The following sections describe the processes for accessing the clone for backup.

    Accessing the Clone

    Follow these steps to access the clone:

    1. From a different client, mount the clone shares as a regular share:

    # mkdir -p /oradata/data

    # mkdir -p /oradata/logs

    # mkdir -p /oradata/archive

    # chown -fR oracle:dba /oradata

    # mount -F nfs isv-USS:/export/oracle_clone_project/oradata /oradata/data

    # mount -F nfs isv-USS:/export/oracle_clone_project/oradata /oradata/data

    # mount -F nfs isv-USS:/export/oracle_clone_project/oradata /oradata/data

    2. If the original snapshot was taken with the cold backup method, the database can be opened for

    read/write straightaway without the need for recovery.

    SQL> startup ;

    3. If the snapshot was taken with the hot backup method, the database must be recovered.

    SQL> startup mount;

    SQL> recover automatic database;

    SQL> alter database open;

    4. Either perform a physical copy of the backup or use third-party backup software to back up the

    database.

    10

  • 8/2/2019 Os Us en Wp Snapshot[1]

    13/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    Restoration and Recovery of the Oracle Database

    The following describes the procedures for restoring and recovering the Oracle database.

    Rollback Overview

    Sun Storage 7000 Unified Storage Systems products provide a convenient way to do faster restoration

    of the file system or the LUN from the snapshot. It is important to note that the rollback happens at

    the share level and not with individual files in the share. In other words, the entire share is rolled back.

    Full Database Restore with the Rollback Feature

    In this scenario, the backup is taken for the whole project. Following is the process for rolling the

    database back to the point in time when oracle_snap was taken. This process voids all the

    modifications performed on the database after oracle_snap was done.

    Figure 5. This figure illustrates restoring the full database, or full database rollback using cold backup.

    1. Shut down the database.

    2. From the GUI, select Shares -> Projects -> [oracle_project] -> Shares -> [oradata] ->

    Snapshots.

    3. Click the rollback icon, on the line that shows oracle_snap, as shown in Figure 6.

    11

  • 8/2/2019 Os Us en Wp Snapshot[1]

    14/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    Figure 6. This figure depicts the user interface for rollback and, specifically, the rollback data icon.

    4. Repeat steps 2 and 3 for oralog and oraarchive.

    5. You can do steps 2 through 4 by running the script from the client:

    # ssh isv-USS -T startup ;

    The following scripts can be used to do the full restore of the database:

    12

  • 8/2/2019 Os Us en Wp Snapshot[1]

    15/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    full_db_restore.sh

    startdb.sh

    shutdb.sh

    Restoring and Recovering Datafiles, Using the Rollback Feature

    In this mode, only the datafiles are restored. The current control files, online redo logs, and archived

    logs are necessary to perform the recovery of the datafiles, so only the oradata share should be rolled

    back. If this share contains a copy of the control file, copy the current control file to oradata after the

    rollback before attempting recovery.

    13

  • 8/2/2019 Os Us en Wp Snapshot[1]

    16/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    Figure 7. This figure illustrates the process for recovering datafiles, or datafile rollback using hot backup/need recovery.

    1. Shut down the database.

    2. From the GUI, select Shares -> Projects -> [oracle_project] -> Shares -> [oradata] ->Snapshots.

    3. Click the rollback icon from the line that shows oracle_snap.

    4. Alternatively, you can do steps 2 and 3 with the CLI by running this script from the client:

    # ssh isv-USS -T startup mount ;

    SQL>recover automatic database;

    SQL>alter database open;

    Now the database is fully recovered.

    The following scripts can be used to carry out the recovery process:

    14

  • 8/2/2019 Os Us en Wp Snapshot[1]

    17/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    db_restore_recover.sh

    startdb_recover.sh

    shutdb.sh

    Restoring Only Selected Datafiles

    If only selected datafiles from the snapshot need to be restored, the process will be manual.

    1. Shut down the database (if necessary). If only a non-system-related datafile needs to be restored, you

    can offline the datafile only.

    2. Follow the process defined to create a clone of the snapshot for oradata.

    3. Mount the clone at the client.

    4. Copy the specific files from the clone to the original share.

    5. Recover the datafile or the full database, depending on which files are restored.

    6. Open the database.

    7. If the clone is not needed anymore, destroy it.

    Recommendations

    If the database has many tablespaces and datafiles, the datafiles can be spread across different shares in

    the same project, for efficient restore/recovery. For example, the payroll user data and index might be

    15

  • 8/2/2019 Os Us en Wp Snapshot[1]

    18/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    on an oradata_payroll share, oradata_system might hold SYSTEMS and SYSAUX tablespaces, and so

    on.

    Periodically perform housekeeping on the clones and snapshots.

    The snapshots and clones are dependent copies. The files have to be copied to the remote location

    either on tape or on different physical drives to create independent physical copies.

    Take a snapshot of the database (or even a backup) before you perform a rollback operation. Once

    the rollback is done, the process is irreversible.

    Conclusion

    Oracles Sun Storage 7000 Unified Storage Systems products deliver comprehensive data protection

    features that make database protection and maintenance tasks easier for systems administrators and

    database administrators. Instant snapshots, cloning, rollback, and remote replication are all

    methodologies that can be used for performing backup and recovery operations with Oracle Database.Understanding and utilizing these features will enhance the security of your mission-critical data.

    16

  • 8/2/2019 Os Us en Wp Snapshot[1]

    19/20

    Oracle White Paper Backup and Recovery for Oracle Databases with the Snapshot Feature of Sun Storage 7000 Unified Storage Systems

    17

    Appendix 1: For More Information

    Here are some additional resources:

    Oracle Technology Network: oracle.com/technology/index.html

    Product documentation: oracle.com/sundocs

    Training: http://education.oracle.com/pls/web_prod-plq-

    dad/db_pages.getpage?page_id=315&p_org_id=1001&lang=US

    Sun Storage Web site: oracle.com/us/products/servers-storage/storage/index.htm

    Support/resources: oracle.com/support

  • 8/2/2019 Os Us en Wp Snapshot[1]

    20/20

    Backup and Recovery for Oracle Databases with

    the Snapshot Feature of Sun Storage 7000

    Unified Storage Systems

    April 2010

    Authors: Sridhar Ranganathan and Jeffrey

    Wright

    Oracle Corporation

    World Headquarters

    500 Oracle Parkway

    Redwood Shores, CA 94065

    U.S.A.

    Worldwide Inquiries:

    Phone: +1.650.506.7000

    Fax: +1.650.506.7200

    oracle.com

    Copyright 2009, 2010, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only and

    the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other

    warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or

    fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are

    formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any

    means, electronic or mechanical, for any purpose, without our prior written permission.

    Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective

    owners.

    AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. Intel

    and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are

    trademarks or registered trademarks of SPARC International, Inc. UNIX is a registered trademark licensed through X/Open

    Company, Ltd. 0110