RMAN

Specifying Archive Destinations

posted May 18, 2011, 7:44 AM by Sachchida Ojha

Before you can archive redo logs, you must determine the destination to which you will archive, and familiarize yourself with the various destination states. The dynamic performance (V$) views, listed in "Viewing Information About the Archived Redo Log", provide all needed archive information.

This section contains:

    *Setting Initialization Parameters for Archive Destinations
    *Understanding Archive Destination Status
    *Specifying Alternate Destinations

Setting Initialization Parameters for Archive Destinations

You can choose to archive redo logs to a single destination or to multiple destinations. Destinations can be local—within the local file system or an Oracle Automatic Storage Management (Oracle ASM) disk group—or remote (on a standby database). When you archive to multiple destinations, a copy of each filled redo log file is written to each destination. These redundant copies help ensure that archived logs are always available in the event of a failure at one of the destinations.

If you want to archive to only a single destination, then specify that destination using the LOG_ARCHIVE_DEST initialization parameter. If you want to archive to multiple destinations, then you can choose to archive to two or more locations using the LOG_ARCHIVE_DEST_n initialization parameters, or to archive only to a primary and secondary destination using the LOG_ARCHIVE_DEST and LOG_ARCHIVE_DUPLEX_DEST initialization parameters.

For local destinations, in addition to the local file system or an Oracle ASM disk group, you can archive to the Fast Recovery Area. The database uses the Fast Recovery Area to store and automatically manage disk space for a variety of files related to backup and recovery. See Oracle Database Backup and Recovery User's Guide for details about the Fast Recovery Area.

Typically, you determine archive log destinations during database planning, and you set the initialization parameters for archive destinations during database installation. However, you can use the ALTER SYSTEM command to dynamically add or change archive destinations after your database is running. Any destination changes that you make take effect at the next log switch (automatic or manual).

The following table summarizes the archive destination alternatives, which are further described in the sections that follow.
Method     Initialization Parameter     Host     Example
1     LOG_ARCHIVE_DEST_n

where:

n is an integer from 1 to 31. Archive destinations 1 to 10 are available for local or remote locations. Archive destinations 11 to 31 are available for remote locations only.
    Local or remote     LOG_ARCHIVE_DEST_1 = 'LOCATION=/disk1/arc'

LOG_ARCHIVE_DEST_2 = 'LOCATION=/disk2/arc'

LOG_ARCHIVE_DEST_3 = 'SERVICE=standby1'
2     LOG_ARCHIVE_DEST and

LOG_ARCHIVE_DUPLEX_DEST
    Local only     LOG_ARCHIVE_DEST = '/disk1/arc'

LOG_ARCHIVE_DUPLEX_DEST = '/disk2/arc'

Method 1: Using the LOG_ARCHIVE_DEST_n Parameter

Use the LOG_ARCHIVE_DEST_n parameter (where n is an integer from 1 to 31) to specify from one to 31 different destinations for archived logs. Each numerically suffixed parameter uniquely identifies an individual destination.

You specify the location for LOG_ARCHIVE_DEST_n using the keywords explained in the following table:
Keyword     Indicates     Example
LOCATION     A local file system location or Oracle ASM disk group     LOG_ARCHIVE_DEST_n = 'LOCATION=/disk1/arc'

LOG_ARCHIVE_DEST_n = 'LOCATION=+DGROUP1'
LOCATION     The Fast Recovery Area     LOG_ARCHIVE_DEST_n = 'LOCATION=USE_DB_RECOVERY_FILE_DEST'
SERVICE     Remote archival through Oracle Net service name.     LOG_ARCHIVE_DEST_n = 'SERVICE=standby1'

If you use the LOCATION keyword, specify one of the following:

    *A valid path name in your operating system's local file system
    *An Oracle ASM disk group
    *The keyword USE_DB_RECOVERY_FILE_DEST to indicate the Fast Recovery Area

If you specify SERVICE, supply a net service name that Oracle Net can resolve to a connect descriptor for a standby database. The connect descriptor contains the information necessary for connecting to the remote database.

Perform the following steps to set the destination for archived redo logs using the LOG_ARCHIVE_DEST_n initialization parameter:

   1.Set the LOG_ARCHIVE_DEST_n initialization parameter to specify from one to 31 archiving locations. For example, enter:

      LOG_ARCHIVE_DEST_1 = 'LOCATION = /disk1/archive'
      LOG_ARCHIVE_DEST_2 = 'LOCATION = /disk2/archive'
      LOG_ARCHIVE_DEST_3 = 'LOCATION = +RECOVERY'

      If you are archiving to a standby database, then use the SERVICE keyword to specify a valid net service name. For example, enter:

      LOG_ARCHIVE_DEST_4 = 'SERVICE = standby1'

   2.Optionally, set the LOG_ARCHIVE_FORMAT initialization parameter, using %t to include the thread number as part of the file name, %s to include the log sequence number, and %r to include the resetlogs ID (a timestamp value represented in ub4). Use capital letters (%T, %S, and %R) to pad the file name to the left with zeroes.

      Note:
      If the COMPATIBLE initialization parameter is set to 10.0.0 or higher, the database requires the specification of resetlogs ID (%r) when you include the LOG_ARCHIVE_FORMAT parameter. The default for this parameter is operating system dependent. For example, this is the default format for UNIX:

      LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf

      The incarnation of a database changes when you open it with the RESETLOGS option. Specifying %r causes the database to capture the resetlogs ID in the archived redo log file name. See Oracle Database Backup and Recovery User's Guide for more information about this method of recovery.

      The following example shows a setting of LOG_ARCHIVE_FORMAT:

      LOG_ARCHIVE_FORMAT = arch_%t_%s_%r.arc

      This setting will generate archived logs as follows for thread 1; log sequence numbers 100, 101, and 102; resetlogs ID 509210197. The identical resetlogs ID indicates that the files are all from the same database incarnation:

      /disk1/archive/arch_1_100_509210197.arc,
      /disk1/archive/arch_1_101_509210197.arc,
      /disk1/archive/arch_1_102_509210197.arc

      /disk2/archive/arch_1_100_509210197.arc,
      /disk2/archive/arch_1_101_509210197.arc,
      /disk2/archive/arch_1_102_509210197.arc

      /disk3/archive/arch_1_100_509210197.arc,
      /disk3/archive/arch_1_101_509210197.arc,
      /disk3/archive/arch_1_102_509210197.arc

Method 2: Using LOG_ARCHIVE_DEST and LOG_ARCHIVE_DUPLEX_DEST

To specify a maximum of two locations, use the LOG_ARCHIVE_DEST parameter to specify a primary archive destination and the LOG_ARCHIVE_DUPLEX_DEST to specify an optional secondary archive destination. All locations must be local. Whenever the database archives a redo log, it archives it to every destination specified by either set of parameters.

Perform the following steps the use method 2:

   1.Specify destinations for the LOG_ARCHIVE_DEST and LOG_ARCHIVE_DUPLEX_DEST parameter (you can also specify LOG_ARCHIVE_DUPLEX_DEST dynamically using the ALTER SYSTEM statement). For example, enter:

      LOG_ARCHIVE_DEST = '/disk1/archive'
      LOG_ARCHIVE_DUPLEX_DEST = '/disk2/archive'

   2.Set the LOG_ARCHIVE_FORMAT initialization parameter as described in step 2 for method 1.

Note:If you configure a Fast Recovery Area (by setting the DB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_SIZE parameters) and do not specify any local archive destinations, the database automatically selects the Fast Recovery Area as a local archive destination and sets LOG_ARCHIVE_DEST_1 to USE_DB_RECOVERY_FILE_DEST.

WARNING:

You must ensure that there is sufficient disk space at all times for archive log destinations. If the database encounters a disk full error as it attempts to archive a log file, a fatal error occurs and the database stops responding. You can check the alert log for a disk full message.


Understanding Archive Destination Status

Each archive destination has the following variable characteristics that determine its status:

    * Valid/Invalid: indicates whether the disk location or service name information is specified and valid
    * Enabled/Disabled: indicates the availability state of the location and whether the database can use the destination
    * Active/Inactive: indicates whether there was a problem accessing the destination

Several combinations of these characteristics are possible. To obtain the current status and other information about each destination for an instance, query the V$ARCHIVE_DEST view.

The LOG_ARCHIVE_DEST_STATE_n (where n is an integer from 1 to 31) initialization parameter lets you control the availability state of the specified destination (n).

    * ENABLE indicates that the database can use the destination.
    * DEFER indicates that the location is temporarily disabled.
    * ALTERNATE indicates that the destination is an alternate. The availability state of an alternate destination is DEFER. If its parent destination fails, the availability state of the alternate becomes ENABLE. ALTERNATE cannot be specified for destinations LOG_ARCHIVE_DEST_11 to LOG_ARCHIVE_DEST_31.

Specifying Alternate Destinations

If you want to specify that a location be an archive destination only in the event of a failure of another destination, you can make it an alternate destination. Both local and remote destinations can be alternates. The following example makes LOG_ARCHIVE_DEST_4 an alternate for LOG_ARCHIVE_DEST_3:

ALTER SYSTEM SET LOG_ARCHIVE_DEST_4 = 'LOCATION=/disk4/arch';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_3 = 'LOCATION=/disk3/arch
   ALTERNATE=LOG_ARCHIVE_DEST_4';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_4=ALTERNATE;

SQL> SELECT dest_name, status, destination FROM v$archive_dest;
 
DEST_NAME               STATUS    DESTINATION
----------------------- --------- ----------------------------------------------
LOG_ARCHIVE_DEST_1      VALID     /disk1/arch
LOG_ARCHIVE_DEST_2      VALID     +RECOVERY
LOG_ARCHIVE_DEST_3      VALID     /disk3/arch
LOG_ARCHIVE_DEST_4      ALTERNATE /disk4/arch

RMAN-04006: error from auxiliary database: ORA-12528: TNS:listener: all appropriate instances are blocking new connections

posted Mar 29, 2011, 9:45 AM by Sachchida Ojha   [ updated Mar 29, 2011, 10:36 AM ]

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04006: error from auxiliary database: ORA-12528: TNS:listener: all appropriate instances are blocking new connections


You need to have the database in the SID_LIST_LISTENER section of LISTENER.ORA and your TNSNAMES needs to read
orcl.. = (connect_data=(***SID***= ))
instead of service_name =

va-iperf01:DUPDB1:/u01/ARBPRDDB/app/oracle/product/11.2.0/dbhome_1/network/admin>vi listener.ora
"listener.ora" 38 lines, 899 characters
# LISTENER.ORA Network Configuration File: /u01/ARBPRDDB/app/oracle/product/9205/network/admin/listener.ora
# Generated by Oracle configuration tools.
SUBSCRIBE_FOR_NODE_DOWN_EVENT_LISTENER=OFF

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = DUPDB1)
      (ORACLE_HOME = /u01/ARBPRDDB/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = DUPDB1)
    )
   (SID_DESC =
      (GLOBAL_DBNAME = DUPAT1)
      (ORACLE_HOME = /u01/ARBPRDDB/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = DUPAT1)
    )
   (SID_DESC =
      (GLOBAL_DBNAME = STGDB1)
      (ORACLE_HOME = /u01/ARBPRDDB/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = STGDB1)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = STGAT1)
      (ORACLE_HOME = /u01/ARBPRDDB/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = STGAT1)
    )

  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = dbref01)(PORT = 1521))
      )
    )
  )

DUPAT1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST =  dbref01)(PORT = 1521))
    )
    (CONNECT_DATA =
      (ORACLE_SID = DUPAT1)
    )
  )
DUPDB1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = dbref01)(PORT = 1521))
    )
    (CONNECT_DATA =
      (ORACLE_SID = DUPDB1)
    )
  )

INBOUND_CONNECT_TIMEOUT_AT1 = 0
INBOUND_CONNECT_TIMEOUT_DB1 = 0
#added to remove ORA-3136 from alert.log
INBOUND_CONNECT_TIMEOUT_LISTENER = 0

DIAG_ADR_ENABLED_listener_name=OFF


RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189580 and starting SCN of 273527957659

posted Mar 29, 2011, 4:30 AM by Sachchida Ojha

contents of Memory Script:
{
   set until scn  273529928967;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 29-MAR-11

starting media recovery

released channel: t1
released channel: t2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/29/2011 05:23:15
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189588 and starting SCN of 273529475213
RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189587 and starting SCN of 273529345373
RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189586 and starting SCN of 273529226331
RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189585 and starting SCN of 273529011622
RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189584 and starting SCN of 273528742811
RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189583 and starting SCN of 273528605198
RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189582 and starting SCN of 273528477408
RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189581 and starting SCN of 273528410865
RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 189580 and starting SCN of 273527957659


RMAN-20020: database incarnation not set

posted Mar 27, 2011, 9:14 PM by Sachchida Ojha   [ updated Mar 27, 2011, 9:36 PM ]

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 03/28/2011 04:13:18
RMAN-03014: implicit resync of recovery catalog failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20020: database incarnation not set

RMAN> list incarnation;

RMAN-06900: WARNING: unable to generate V$RMAN_STATUS or V$RMAN_OUTPUT row
RMAN-06901: WARNING: disabling update of the V$RMAN_STATUS and V$RMAN_OUTPUT rows
ORACLE error from target database:
ORA-03135: connection lost contact

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00601: fatal error in recovery manager
RMAN-03004: fatal error during execution of command
RMAN-04022: target database mount id 4032431613 does not match channel's mount id 4032443022
RMAN-03002: failure of list command at 03/28/2011 04:34:01
ORA-03114: not connected to ORACLE

va-idb01:RPTDB:/u01/app/oracle/product/10gR2/network/admin $rman target / catalog rman/rman@rman

Recovery Manager: Release 10.2.0.4.0 - Production on Mon Mar 28 04:34:41 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: RPTDB (DBID=4032003294)
connected to recovery catalog database

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
75964004 75964188 RPTDB    4032003294       PARENT  272929425162 22-MAR-11
75964004 75964005 RPTDB    4032003294       CURRENT 273104788857 24-MAR-11

RMAN> reset database;

database incarnation already registered

RMAN>


RMAN-10038: database session for channel t1 terminated unexpectedly

posted Mar 27, 2011, 5:15 PM by Sachchida Ojha

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/27/2011 23:23:21
RMAN-03015: error occurred in stored script Memory Script
RMAN-10038: database session for channel t1 terminated unexpectedly

ORA-04031 during rman duplicate

posted Mar 25, 2011, 4:15 PM by Sachchida Ojha   [ updated Mar 26, 2011, 8:54 AM ]

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/25/2011 22:53:31
RMAN-03015: error occurred in stored script Memory Script
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/u07/ARBPRDDB/archive/arbprddb_1_330411_576139613.arc'
ORA-00283: recovery session canceled due to errors
ORA-04031: unable to allocate 1052696 bytes of shared memory ("shared pool","unknown object","PMR sga heap","log read buffer")

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found ";": expecting one of: "advise, allocate, alter, backup, @, catalog, change, configure, connect, convert, copy, create, crosscheck, delete, drop, ant, host, import, list, mount, open, print, quit, recover, register, release, repair, replace, report, reset, restore, resync, revoke, run, send, set, show, shutdown, spool, sqlunregister, upgrade, validate, {, "
RMAN-01007: at line 0 column 2 file: standard input

SYS@DUPRAT1  SQL>show parameter shared

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
max_shared_servers                   integer
shared_memory_address                integer     0
shared_pool_reserved_size            big integer 6710886
shared_pool_size                     big integer 128M
shared_server_sessions               integer
shared_servers                       integer     0
SYS@DUPRAT1  SQL>show parameter large

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cell_partition_large_extents         string      DEFAULT
large_pool_size                      big integer 0
SYS@DUPRAT1  SQL>show sga

Total System Global Area  254754816 bytes
Fixed Size                  2205680 bytes
Variable Size             159385616 bytes
Database Buffers           83886080 bytes
Redo Buffers                9277440 bytes


SYS@RAT1  SQL>show parameter sha

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cursor_sharing                       string      EXACT
hi_shared_memory_address             integer     0
max_shared_servers                   integer
shadow_core_dump                     string      partial
shared_memory_address                integer     0
shared_pool_reserved_size            big integer 12000000
shared_pool_size                     big integer 0
shared_server_sessions               integer
shared_servers                       integer     1
SYS@RAT1  SQL>show sga

Total System Global Area 1.6034E+10 bytes
Fixed Size                  2222616 bytes
Variable Size            2617247208 bytes
Database Buffers         1.3388E+10 bytes
Redo Buffers               26525696 bytes
SYS@RAT1  SQL>show parameter large

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cell_partition_large_extents         string      DEFAULT
large_pool_size                      big integer 0
SYS@RAT1  SQL>
SYS@RAT1  SQL>show parameter memory

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 30G
memory_target                        big integer 30G
shared_memory_address                integer     0
SYS@RAT1  SQL>




RMAN-06136: ORACLE error from auxiliary database: ORA-00059: maximum number of DB_FILES exceeded

posted Mar 25, 2011, 6:06 AM by Sachchida Ojha

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/25/2011 11:57:06
RMAN-03015: error occurred in stored script Memory Script
RMAN-06136: ORACLE error from auxiliary database: ORA-00059: maximum number of DB_FILES exceeded

Unregister a database from old catalog and register to a new catalog

posted Sep 24, 2010, 11:36 AM by Sachchida Ojha

$ sqlplus rman/rman@rmand
sqlplus>select 'execute dbms_rcvcat.unregisterdatabase ('||db_key||','||dbid||');' from rc_database where name = 'PRODDB';

'EXECUTEDBMS_RCVCAT.UNREGISTERDATABASE('||DB_KEY||','||DBID||');'
--------------------------------------------------------------------------------
execute dbms_rcvcat.unregisterdatabase (1032389,3914890523);

sqlplus>execute dbms_rcvcat.unregisterdatabase (1032389,3914890523);
PL/SQL procedure successfully completed.

SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


$rman target / catalog rman/rman@rman

Recovery Manager: Release 10.2.0.4.0 - Production on Fri Sep 24 18:34:29 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: PRODDB (DBID=3914890523)
connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN>


RMAN Cold level0 backup

posted Sep 17, 2010, 8:11 AM by Sachchida Ojha   [ updated Sep 17, 2010, 8:14 AM ]

# $Header: cold_database_backup_level0.rcv,v 1.5 2000/02/17 21:39:45 integ Exp $
# ---------------------------------------------------------------------------
#               cold_database_backup_level0.rcv
# ---------------------------------------------------------------------------
#
#  Backs up the whole database.  This backup is part of the incremental
#  strategy (this means it can have incremental backups of levels > 0
#  applied to it).
#
#  We do not need to explicitly request the control file to be included
#  in this backup, as it is automatically included each time file 1 of
#  the system tablespace is backed up (the inference: as it is a whole
#  database backup, file 1 of the system tablespace will be backed up,
#  hence the controlfile will also be included automatically).
#
#  Typically, a level 0 backup would be done at least once a week.
#
#  The scenario assumes:
#     o you want to perform a level 0 backup
#     o you are backing your database up to two tape drives
#     o you want each backup set to include a maximum of 5 files
#     o you wish to include offline datafiles, and read-only tablespaces,
#       in the backup
#     o you want the backup to terminate if any files are not
#       accessible
#     o you want to open the database after the backup completes
#     o you are not using a Recovery Catalog
#     o you are using a TNS alias name for the target database
#
#  Note that the format string is constructed to guarantee uniqueness and
#  to enhance NetBackup for Oracle backup and restore performance.
#
#  The connect statements could be part of the rman command line in the
#  Oracle script file that calls this script. They were put here so that
#  the passwords could be protected by setting file permissions to only
#  allow the Oracle dba access.
#
#  Add the following connect statement if using a Recovery Catalog.
#      connect rcvcat '<user>/<passwd>@<TNS alias>'
#
#  Modify the target connect statement according to the following syntax:
#      connect target '<user>/<passwd>@<TNS alias>'
#
#  Script run by:
#      rman nocatalog cmdfile cold_database_backup_level0.rcv
#
# ---------------------------------------------------------------------------

connect target internal/oracle
connect rcvcat rman/rman@admindb

run {
# Cold database level 0 backup
allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
allocate channel t3 type 'SBT_TAPE';
allocate channel t4 type 'SBT_TAPE';
backup
  incremental level 0
  tag cold_db_bk_level0
  filesperset 5
  # Recommended format
  format 'bk_%s_%p_%t'
    (database);

# now that the backup is complete, open the db.
sql 'alter database open';
}

RMAN hot level 0 backup script

posted Sep 17, 2010, 8:08 AM by Sachchida Ojha   [ updated Sep 17, 2010, 8:15 AM ]

# $Header: hot_database_backup_level0.rcv
#  Backs up the whole database.  This backup is part of the incremental
#  strategy (this means it can have incremental backups of levels > 0
#  applied to it).
#
#  We do not need to explicitly request the control file to be included
#  in this backup, as it is automatically included each time file 1 of
#  the system tablespace is backed up (the inference: as it is a whole
#  database backup, file 1 of the system tablespace will be backed up,
#  hence the controlfile will also be included automatically).
#
#  Typically, a level 0 backup would be done at least once a week.
#
#  The scenario assumes:
#     o you want to perform a level 0 backup
#     o you are backing your database up to two tape drives
#     o you want each backup set to include a maximum of 5 files
#     o you wish to include offline datafiles, and read-only tablespaces,
#       in the backup
#     o you want the backup to continue if any files are inaccessible.
#     o you are not using a Recovery Catalog
#     o you want to archive the current log and then back up all the
#       archive logs, putting a maximum of 20 logs in a backup set and
#       deleting them once the backup is complete.
#     o you are using a TNS alias name for the target database
#
#  Note that the format string is constructed to guarantee uniqueness and
#  to enhance NetBackup for Oracle backup and restore performance.
#
#  The connect statements could be part of the rman command line in the
#  Oracle script file that calls this script. They were put here so that
#  the passwords could be protected by setting file permissions to only
#  allow the Oracle dba access.
#
#  Add the following connect statement if using a Recovery Catalog.
#      connect rcvcat '<user>/<passwd>@<TNS alias>'
#
#  Modify the target connect statement according to the following syntax:
#      connect target '<user>/<passwd>@<TNS alias>'
#
#  Script run by:
#      rman nocatalog cmdfile hot_database_backup_level0.rcv
#
# ---------------------------------------------------------------------------

connect target /
connect catalog rman/rman@RMANDB

run {
# Hot database level 0 whole backup

allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
#allocate channel t3 type 'SBT_TAPE';
#allocate channel t4 type 'SBT_TAPE';

backup
  incremental level 0
  tag hot_db_bk_level0
  filesperset 5
  # recommended format
  format 'bk_%s_%p_%t'
    (database);
  sql 'alter system archive log current';
  # backup all archive logs
  backup
   filesperset 20
   format 'al_%s_%p_%t'
   (archivelog all
    delete input);
}


1-10 of 28