Using Oracle RMAN with Oracle ZFS Storage Appliances on Oracle MiniCluster

Version 2

    by Dean Halbeisen

     

    This article is an example guide on how to configure Oracle MiniCluster to perform Oracle Recovery Manager (Oracle RMAN) database backups to storage devices that are part of the Oracle ZFS Storage Appliance family.

     

    Table of Contents

     

    Introduction

     

    This article starts at the point where Oracle MiniCluster initial installation and application installation have been completed or are nearly complete. The following steps must be completed before the backup configuration process can begin:

     

    • Oracle MiniCluster must be installed and configured.
    • The Oracle ZFS Storage Appliance system must be cabled and ready for configuration.

     

    Be sure to read through the entire article in sequential order, so you don't miss any key steps.

     

    Configuration Walk-Through

     

    The following sections provide a walk-through of the required steps to set up Oracle RMAN database backups to Oracle ZFS Storage Appliance systems.

     

    Configure the Oracle ZFS Storage Appliance Storage Pools

     

    Storage pools must be configured before setting up backups to an Oracle ZFS Storage Appliance system. A mirrored RAID configuration is preferred to provide the highest performance for all workloads and the best performance for mixed workloads. RAIDZ1 can be used and provides more usable capacity, with the trade-off of lower mixed workload performance and reliability. It is best to configure at least one storage pool per appliance controller in cluster configurations.

     

    Figure 1 shows example storage pool configuration information displayed in the Oracle ZFS Storage Appliance browser user interface (BUI).

     

    f1.png

    Figure 1. Configure Oracle ZFS Storage Appliance storage pools.

     

    Configure Oracle ZFS Storage Appliance Networking

     

    Configure as many network ports as possible, using either Link Aggregation Control Protocol (LACP) or IP network multipathing (IPMP).

     

    • LACP provides performance, reliability, and automated load balancing.
    • IPMP provides performance and reliability; it must be combined with the Direct NFS Client (dNFS) feature of Oracle Database to provide automated load balancing.

     

    Add up to four virtual network interface cards (VNICs) per controller in the configuration to help increase dNFS performance and provide better load balancing.

     

    For details on network configuration, see the Oracle ZFS Storage Appliance documentation.

     

    Configure Oracle ZFS Storage Appliance Routing

     

    If you are using multiple ports and multiple addresses on an Oracle ZFS Storage Appliance system, you need to configure adaptive routing.

     

    Use the Oracle ZFS Storage Appliance BUI to configure adaptive routing. On the network configuration page, select Adaptive as the multihoming model.

     

    f2.png

    Figure 2. Configure adaptive routing.

     

    Configure Oracle RMAN Projects and Shares on the Oracle ZFS Storage Appliance System

     

    At least one project and one share for Oracle RMAN use should be created on each controller in the configuration. The key settings in Table 1 should be configured for shares that will be used for Oracle RMAN backups.

     

    Table 1. Settings for Projects Used for Oracle RMAN Backups

        

    SettingValue
    Data compressionSelect LZJB (Fastest) unless you are backing up an encrypted database.
    Cache device usageSelect All data and metadata.
    Synchronous write biasSelect Throughput.
    Database record sizeSelect 1M.

     

    1. In the Oracle ZFS Storage Appliance BUI, navigate to the General page for the project created for Oracle RMAN and configure the settings shown in Table 1 for shares to be used for Oracle RMAN backups.

      f3.png

      Figure 3. Configure settings for projects that will be used for Oracle RMAN backups.

       

    2. On the Protocols page of the project created for Oracle RMAN, add an NFS exception for the network that Oracle MiniCluster is installed on.

      f4.png

      Figure 4. Add an NFS exception for the network that Oracle MiniCluster is installed on.

       

    Configure DTrace Analytics in the Oracle ZFS Storage Appliance System

     

    To monitor an Oracle ZFS Storage Appliance system for hardware bottlenecks, use the DTrace Analytics feature of the Oracle ZFS Storage Appliance system to set up a new Analytics page to monitor the following system metrics:

     

    • CPU: percent utilization broken down by CPU identifier
    • Network: interface bytes per second broken down by interface
    • Cache: ARC accesses per second broken down by hit/miss
    • Cache: ARC accesses per second for hit/miss 'metadata hits' broken down by L2ARC eligibility
    • Disk: Disks broken down by percent utilization
    • Protocol: NFSv4 operations per second broken down by type of operation

     

    To do this, use the Oracle ZFS Storage Appliance BUI to set up a new Analytics page, and then click Save.

     

    f5.png

    Figure 5. Configure DTrace Analytics to help monitor hardware bottlenecks.

     

    Enable External Storage on Oracle MiniCluster

     

    To use external NFS storage for Oracle RMAN backups, you must enable it in the Oracle MiniCluster management utility. The external shared storage can be enabled or disabled on the Database VM Group or Application VM Group Profile Summary pages in the Oracle MiniCluster Management utility. When the external storage is enabled, the added mount points are created and the external NFS share is configured to be mounted going forward.

     

    To enable external NFS storage on the Database VM Group profile, you must configure each controller in the Oracle ZFS Storage Appliance configuration. Figure 6 shows an example clustered array configuration.

     

    1. Enter the IP address or host name, share path, and mount point.
    2. Click Save and then click Apply to deploy the changes to the VM profile.

      f6.png

      Figure 6. Enable external storage.

       

    Tune Virtual Machines

     

    Check the TCP/IP and NFS tuning on each VM that is using external storage for Oracle RMAN backups. Depending on the code level running on Oracle MiniCluster, you might not need to add any of these settings, because the installation configures these settings automatically.

     

    Make sure the following entries are in the /etc/system file on each VM that is using external storage for Oracle RMAN backups. Any changes made to the /etc/system file require a reboot of the VM to take effect.

     

    set rpcmode:clnt_max_conns = 8
    set nfs:nfsv4_bsize=131072

     

    To tune the TCP/IP stack for higher performance, the following ipadm commands can be added to boot scripts, be run on the command line, or be added to backup scripts.

     

    ipadm set-prop -p max_buf=2097152 tcp
    ipadm set-prop -p send_buf=1048576 tcp
    ipadm set-prop -p recv_buf=1048576 tcp

     

    Tune the Oracle Database Instance for Oracle RMAN

     

    Tuning Oracle RMAN for high performance can be done with SQL*Plus or Oracle RMAN.

     

    Table 2 lists the Oracle Database parameters that need tuning.

     

    Table 2. Oracle Database Parameters

        

    ParameterDescription
    _backup_disk_bufcntNumber of buffers used to process backup sets
    _backup_disk_bufszSize of the buffers used to process backup sets
    _backup_file_bufcntNumber of buffers used to process image copies
    _backup_file_bufszSize of the buffers used to process image copies

     

    The Oracle RMAN tuning can be set with SQL*Plus to apply the settings to all Oracle RMAN sessions, as follows:

     

    SQL> alter system set "_backup_disk_bufcnt"=64; 
    SQL> alter system set "_backup_file_bufcnt"=64; 
    SQL> alter system set "_backup_disk_bufsz"=1048576; 
    SQL> alter system set "_backup_file_bufsz"=1048576; 

     

    The Oracle RMAN tuning can also be set in each Oracle RMAN session by adding the following parameters to the run block of Oracle RMAN scripts:

     

    sql 'alter system set "_backup_disk_bufcnt"=64';
    sql 'alter system set "_backup_disk_bufsz"=1048576'; 

     

    Create Directories on the Shared Storage Shares

     

    You must create a directory on the /sharedstore mount point, because the system configures the default mount point owner to be root and this does not meet Oracle RMAN requirements. This directory must be owned by the oracle user and either the oinstall or dba group on the database VMs to meet Oracle RMAN requirements. The directory for scripts is not required, but it is best practice to store Oracle RMAN scripts on the shared storage to enable both nodes to access the same scripts. The DatabaseName directory is also not required, but this is a good way to keep the Oracle RMAN output for each database together.

     

    # mkdir /backups1/rman
    # mkdir /backups1/rman/scripts
    # mkdir /backups1/rman/DatabaseName
    # chmod -R 775 /backups1/rman
    # chown -R oracle:oinstall /backups1/rman
     
    # mkdir /backups2/rman
    # mkdir /backups2/rman/scripts
    # mkdir /backups2/rman/DatabaseName
    # chmod -R 775 /backups2/rman
    # chown -R oracle:oinstall /backups2/rman

     

    Configure the ORANFSTAB File for dNFS

     

    Using dNFS is required for all database backups to NFS shares on Oracle MiniCluster, because NFSv3 is not supported and using dNFS is the only way to use NFSv4 with Oracle RMAN. Databases created with the Oracle MiniCluster management utility should already be configured for dNFS by default, if shared storage was enabled when you created the database. You can also create the file manually, if necessary.

     

    If you are using an Oracle Real Application Clusters (Oracle RAC) database, you must set up ORANFSTAB files on both cluster nodes. The default location for the ORANFSTAB files is the $ORACLE_HOME/dbs directory. Note that the command syntax for the export and mount parameters requires that both entries be on the same line, even if the text wraps to a new line on the screen while you are adding the text to the file. If you make sure this file is configured before enabling or using dNFS, this will avoid the need to restart the database an additional time.

     

    The following are key settings not typically found in the ORANFSTAB file:

     

    • nfs_version: NFSv3 is the default for Oracle Database, but NFSv4 is required.
    • local: This setting is required on Oracle MiniCluster because there are always multiple networks on the VMs and you need to direct the NFS traffic over the correct ports. This setting is especially helpful if you are using the extra network ports on the systems for backup and recovery.

     

    server: 10.133.81.69
    nfs_version: NFSv4
    local: 10.129.73.174
    path: 10.133.81.69
    export: /export/MC14/backups-01 mount: /backups1
     
    server: 10.133.81.67
    nfs_version: NFSv4
    local: 10.129.73.174
    path: 10.133.81.67
    export: /export/MC14/backups-02 mount: /backups2

     

    Enable dNFS

     

    Databases created with the Oracle MiniCluster management utility should be already configured for dNFS by default, if shared storage was enabled when you created the database. You can also enable dNFS manually, if necessary, by running the following commands. If you are using an Oracle RAC database, you must set up ORANFSTAB files on both nodes. No matter what type of database you are using, the database must be restarted to enable dNFS.

     

    # cd $ORACLE_HOME/lib
    # make -f ins_rdbms.mk dnfs_on
    # mv $ORACLE_HOME/lib/libodm12.so $ORACLE_HOME/lib/libodm12.so.dnfsenabled;
    # cp $ORACLE_HOME/lib/libnfsodm12.so $ORACLE_HOME/lib/libodm12.so

     

    Create Cluster Services for Oracle RMAN

     

    Create cluster services to allow Oracle RMAN to connect to the database regardless of which node the backup or the database is being run from. Cluster services are also a great way to load balance the Oracle RMAN backups across Oracle RAC nodes or networks.

     

    The following is the general command to create cluster services:

     

    # srvctl add service -d DatabaseName -s ServiceName -r PrimaryNode -a SecondaryNodes

     

    As an example, the following commands create cluster services RMAN1 and RMAN2 for database VIS:

     

    # srvctl add service -d VIS -s RMAN1 -r VIS001 -a VIS002
    # srvctl add service -d VIS -s RMAN2 -r VIS002 -a VIS001

     

    If you have password and login issues when connecting to the services, you might need to copy the local password files to external password files, as seen in the following example:

     

    # cp $ORACLE_HOME/dbs/orapwDBName $ORACLE_HOME/dbs/orapwDBInstanceName

     

    As an example, the following commands copy the local password file to external password files:

     

    # cp $ORACLE_HOME/dbs/orapwVIS $ORACLE_HOME/dbs/orapwVIS001
    # cp $ORACLE_HOME/dbs/orapwVIS $ORACLE_HOME/dbs/orapwVIS002

     

    If the services are ever running on a secondary (and not primary) node, you can stop and start the services to reset them back to their primary nodes, as shown in the following example:

     

    # srvctl stop service RMAN1
    # srvctl stop service RMAN2
    # srvctl start service RMAN1
    # srvctl start service RMAN2

     

    Example Scripts

     

    The following sections contain example Oracle RMAN backup scripts. Examples include the following:

     

     

    Example Oracle RMAN Full Backup Script

     

    This example Oracle RMAN script performs a full backup of an Oracle RAC database.

     

    The following are key points about using the script:

     

    • Make sure to load balance the channels by switching nodes every other channel allocation.
    • Ideally, use the same mount points on each node.
    • Use more Oracle RMAN channels to raise performance and use fewer Oracle RMAN channels to lower performance.
    • Store the database on flash storage to make it easy to tune the number of channels to any backup target.

     

    alter database begin backup;
    run {
    sql 'alter system set "_backup_disk_bufcnt"=64';
    sql 'alter system set "_backup_disk_bufsz"=1048576';
    allocate channel ch001 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch002 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch003 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch004 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch005 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch006 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch007 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch008 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch009 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch010 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch011 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch012 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch013 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch014 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch015 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch016 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch017 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch017 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch019 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch020 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch021 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch022 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch023 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch024 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch025 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch026 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch027 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch028 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch029 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch030 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch031 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch032 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
     
    backup archivelog all not backed up 1 times delete input
    TAG 'logs_bb'; 
     
    BACKUP database
    TAG 'full_bkset'; 
     
    backup archivelog all not backed up 1 times delete input
    TAG 'logs_ab'; 
     
    backup current controlfile
    TAG 'ctl_bk' FORMAT '/backups1/rman/DBNAME/%d_%s_%p_%c_%t.ctl.rman';
     
    backup spfile
    TAG 'spfile_bk' FORMAT '/backups2/rman/DBNAME/%d_%s_%p_%c_%t.spfile.rman';
     
    DELETE FORCE NOPROMPT obsolete;
     
    release channel ch001;
    release channel ch002;
    release channel ch003;
    release channel ch004;
    release channel ch005;
    release channel ch006;
    release channel ch007;
    release channel ch008;
    release channel ch009;
    release channel ch010;
    release channel ch011;
    release channel ch012;
    release channel ch013;
    release channel ch014;
    release channel ch015;
    release channel ch016;
    release channel ch017;
    release channel ch018;
    release channel ch019;
    release channel ch020;
    release channel ch021;
    release channel ch022;
    release channel ch023;
    release channel ch024;
    release channel ch025;
    release channel ch026;
    release channel ch027;
    release channel ch028;
    release channel ch029;
    release channel ch030;
    release channel ch031;
    release channel ch032;
    }
    alter database end backup;
    exit

     

    Example Oracle RMAN Incremental Level 1 Backup Script

     

    This example Oracle RMAN script performs an incremental level 1 backup of an Oracle RAC database.

     

    The following are key points about using the script:

     

    • Make sure to load balance the channels by switching nodes every other channel allocation.
    • Ideally, use the same mount points on each node.
    • Use more Oracle RMAN channels to raise performance and use fewer Oracle RMAN channels to lower performance.
    • Use block change tracking to reduce the runtime of incremental backups.

     

    alter database begin backup;
    run {
    sql 'alter system set "_backup_disk_bufcnt"=64';
    sql 'alter system set "_backup_disk_bufsz"=1048576';
    allocate channel ch001 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch002 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch003 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch004 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch005 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch006 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch007 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch008 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch009 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch010 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch011 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch012 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch013 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch014 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch015 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch016 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch017 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch018 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch019 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch020 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch021 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch022 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch023 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch024 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch025 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch026 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch027 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch028 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch029 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch030 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch031 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch032 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
     
    backup archivelog all not backed up 1 times delete input
    TAG 'logs_bb' ;
     
    BACKUP INCREMENTAL LEVEL 1 database
    TAG 'full_bkset' ;
     
    backup archivelog all not backed up 1 times delete input
    TAG 'logs_ab' ;
     
    backup current controlfile
    TAG 'ctl_bk' FORMAT '/backups1/rman/DBNAME/%d_%s_%p_%c_%t.ctl.rman';
     
    backup spfile
    TAG 'spfile_bk' FORMAT '/backups2/rman/DBNAME/%d_%s_%p_%c_%t.spfile.rman';
     
    DELETE FORCE NOPROMPT obsolete;
     
    release channel ch001;
    release channel ch002;
    release channel ch003;
    release channel ch004;
    release channel ch005;
    release channel ch006;
    release channel ch007;
    release channel ch008;
    release channel ch009;
    release channel ch010;
    release channel ch011;
    release channel ch012;
    release channel ch013;
    release channel ch014;
    release channel ch015;
    release channel ch016;
    release channel ch017;
    release channel ch018;
    release channel ch019;
    release channel ch020;
    release channel ch021;
    release channel ch022;
    release channel ch023;
    release channel ch024;
    release channel ch025;
    release channel ch026;
    release channel ch027;
    release channel ch028;
    release channel ch029;
    release channel ch030;
    release channel ch031;
    release channel ch032;
    }
    alter database end backup;
    exit

     

    Example Oracle RMAN Image Copy Backup Script

     

    This example Oracle RMAN script performs an image copy backup of an Oracle RAC database.

     

    The following are key points about the script:

     

    • It creates copies of database files.
    • It enables mounting the database from the copies made by Oracle RMAN.
    • It provides the highest performing backup.

     

    alter database begin backup;
    run {
    sql 'alter system set "_backup_disk_bufcnt"=64';
    sql 'alter system set "_backup_disk_bufsz"=1048576';
    allocate channel ch001 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch002 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch003 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch004 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch005 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch006 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch007 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch008 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch009 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch010 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch011 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch012 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch013 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch014 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch015 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch016 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch017 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch018 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch019 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch020 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch021 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch022 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch023 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch024 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch025 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch026 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch027 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch028 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch029 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch030 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch031 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch032 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
     
    backup archivelog all not backed up 1 times delete input
    TAG 'logs_bi' ;
     
    backup incremental level 1 for recover of copy with
    TAG 'IMAGECOPY' database ;
     
    backup archivelog all not backed up 1 times delete input
    TAG 'logs_ai' ; 
     
    backup current controlfile
    TAG 'ctl_bk' FORMAT '/backups1/rman/DBNAME/%d_%s_%p_%c_%t.ctl.rman';
     
    backup spfile
    TAG 'spfile_bk' FORMAT '/backups2/rman/DBNAME/%d_%s_%p_%c_%t.spfile.rman';
     
    DELETE FORCE NOPROMPT obsolete;
     
    release channel ch001;
    release channel ch002;
    release channel ch003;
    release channel ch004;
    release channel ch005;
    release channel ch006;
    release channel ch007;
    release channel ch008;
    release channel ch009;
    release channel ch010;
    release channel ch011;
    release channel ch012;
    release channel ch013;
    release channel ch014;
    release channel ch015;
    release channel ch016;
    release channel ch017;
    release channel ch018;
    release channel ch019;
    release channel ch020;
    release channel ch021;
    release channel ch022;
    release channel ch023;
    release channel ch024;
    release channel ch025;
    release channel ch026;
    release channel ch027;
    release channel ch028;
    release channel ch029;
    release channel ch030;
    release channel ch031;
    release channel ch032;
    }
    alter database end backup;
    exit

     

    Example Oracle RMAN Image Merge Script

     

    This example Oracle RMAN script performs an image merge backup of an Oracle RAC database.

     

    The following are key points about the script:

     

    • It is a very I/O-intensive process that must be run on database nodes.
    • It enables faster restores with less log replaying.
    • It must be run after image copy backups.
    • It works only on images copies.

     

    run {
    sql 'alter system set "_backup_disk_bufcnt"=64';
    sql 'alter system set "_backup_disk_bufsz"=1048576';
    allocate channel ch001 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch002 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch003 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch004 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch005 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch006 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch007 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch008 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch009 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch010 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch011 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch012 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch013 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch014 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch015 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch016 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch017 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch018 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch019 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch020 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch021 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch022 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch023 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch024 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch025 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch026 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch027 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch028 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch029 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch030 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch031 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch032 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
     
    recover copy of database with
    tag 'IMAGECOPY';
     
    release channel ch001;
    release channel ch002;
    release channel ch003;
    release channel ch004;
    release channel ch005;
    release channel ch006;
    release channel ch007;
    release channel ch008;
    release channel ch009;
    release channel ch010;
    release channel ch011;
    release channel ch012;
    release channel ch013;
    release channel ch014;
    release channel ch015;
    release channel ch016;
    release channel ch017;
    release channel ch018;
    release channel ch019;
    release channel ch020;
    release channel ch021;
    release channel ch022;
    release channel ch023;
    release channel ch024;
    release channel ch025;
    release channel ch026;
    release channel ch027;
    release channel ch028;
    release channel ch029;
    release channel ch030;
    release channel ch031;
    release channel ch032;
    }
    exit

     

    Example Oracle RMAN Restore Validate Script

     

    This example Oracle RMAN script validates the restore operation of an Oracle RAC database without actually restoring anything. You can remove the word validate from the example script to make it a restore database script.

     

    The following are key points about the script:

     

    • It verifies that a restore could be done.
    • It shows how the restore would perform if the script were run.
    • It should be run after any changes are made to backup scripts.

     

    run {
    sql 'alter system set "_backup_disk_bufcnt"=64';
    sql 'alter system set "_backup_disk_bufsz"=1048576';
    allocate channel ch001 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch002 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch003 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch004 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch005 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch006 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch007 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch008 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch009 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch010 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch011 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch012 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch013 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch014 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch015 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch016 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch017 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch018 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch019 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch020 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch021 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch022 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch023 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch024 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch025 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch026 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch027 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch028 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch029 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch030 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
    allocate channel ch031 device type disk connect 'sys/SYSPWD@DBscan/RMAN1' format '/backups1/rman/DBNAME/%U';
    allocate channel ch032 device type disk connect 'sys/SYSPWD@DBscan/RMAN2' format '/backups2/rman/DBNAME/%U';
     
    restore validate database;
     
    release channel ch001;
    release channel ch002;
    release channel ch003;
    release channel ch004;
    release channel ch005;
    release channel ch006;
    release channel ch007;
    release channel ch008;
    release channel ch009;
    release channel ch010;
    release channel ch011;
    release channel ch012;
    release channel ch013;
    release channel ch014;
    release channel ch015;
    release channel ch016;
    release channel ch017;
    release channel ch018;
    release channel ch019;
    release channel ch020;
    release channel ch021;
    release channel ch022;
    release channel ch023;
    release channel ch024;
    release channel ch025;
    release channel ch026;
    release channel ch027;
    release channel ch028;
    release channel ch029;
    release channel ch030;
    release channel ch031;
    release channel ch032;
    }
    exit

     

    See Also

     

    For more information, please see the following resources:

     

     

    About the Author

     

    Dean Halbeisen is a solutions manager at Oracle. He has over 20 years of IT experience and is an expert in enterprise computing solutions, most recently applying these practices to next-generation data center solutions, integrated systems, and Oracle engineered systems. In his current role, he is responsible for solution architecture and development around Oracle Optimized Solutions, including communicating about Oracle's systems, solutions, technology strategies, and roadmaps to customers, partners, and internal stakeholders.