 |
|
Oracle
Concepts - RMAN Catalog Installation
Oracle Tips by Burleson Consulting |
Installing the RMAN Catalog
The catalog should be owned by a user with the
resource role grant. I suggest a user in a small database dedicated to
system administration functions such as the RMAN catalog and
Enterprise Manager catalog. Create a tablespace for use by the
RMAN user and assign that as the user?s default tablespace with
unlimited quota. For example, if we wanted our user to be named
rman_dba, the steps would be as follows:
sqlplus
system/manager
SQL>CREATE TABLESPACE rman_data DATAFILE 'file_spec' DEFAULT STORAGE
(clause);
SQL>CREATE USER rman_dba IDENTIFIED BY rman_dba
2: DEFAULT TABLESPACE rman_data
3: TEMPORARY TABLESPACE temp
4: QUOTA UNLIMITED ON rman_data;
SQL>GRANT RESOURCE,CONNECT TO rman_dba;
SQL>CONNECT rman_dba/rman_dba
SQL> @$ORACLE_HOME/rdbms/admin/catrman.sql
Once the catalog is built, the recovery
manager can be utilized. The command is either rman, rman80, or RMAN80
depending on your operating system. There are literally dozens of
commands for use with the RMAN facility. I suggest reviewing the
Oracle8i Server Backup and Recovery Guide, Release 8.1.5 (or most
current release) (Oracle Corporation, 1999) before using RMAN.
The following are some example scenarios
showing how the commands can be made into scripts.
Connection to rman in UNIX on early versions
can be tricky. On some UNICES the double quote (?) character has to be
escaped, and you need to use the double quotes to log into rman (at
least on early versions). Assuming the database to be backed up is
ORTEST1 with a TNS alias of ORTEST1, the user is as specified earlier,
and the catalog database is ORRMAN, the connection to RMAN for the
user SYSTEM password MANAGER would look like this:
$ rman
ORTEST1\ system/manager@ORTEST1 rcvcat "rman_dbo/rman_dbo@ORRMAN\"
Intuitive, isn?t it? A sample session from
Recovery Manager (RMAN) is shown next.
The target database service name in the
?tnsnames.ora? file is ?ORTEST1.? The recovery catalog database
service name in the ?tnsnames.ora? file is ?ORRMAN.?
% cd $ORACLE_HOME/rdbms/admin
% sqlplus sys/change_on_install@ORRMAN
SQL> grant connect, resource to RMAN_DBA identified by RMAN_DBA;
Grant succeeded.
SQL> connect rman/rman@ORRMAN
Connected.
SQL> @catrman.sql
SQL> exit
%
% rman 'target sys/change_on_install@ORTEST1 rcvcat rman/rman@ORRMAN'
Recovery Manager: Release 8.0.2.0.0 - Beta
RMAN-06005: connected to target database: ORTEST1
RMAN-06008: connected to recovery catalog database
RMAN> register database;
RMAN-08006: database registered in recovery catalog
RMAN-08002: starting full resync of recovery catalog
RMAN-08004: full resync complete
RMAN> run
2> {
3> allocate channel c1 type disk;
4> backup full format '/oracle16/ORTEST1/amin/backup/backup%s%p'
(database);
5> }
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=12 devtype=DISK
RMAN-08008: channel c1: started datafile backupset
RMAN-08502: set_count=9 set_stamp=280246639
RMAN-08011:
channel c1: including current controlfile in backupset
RMAN-08010: channel c1: including datafile number 1 in backupset
RMAN-08010: channel c1: including datafile number 2 in backupset
.
.
.
RMAN-08010: channel c1: including datafile number 11 in backupset
RMAN-08010: channel c1: including datafile number 12 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=/oracle16/ORTEST1/admin/backup/backup91
comment=NONE
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-10030: RPC call appears to have failed to start on channel
default
RMAN-10036: RPC call ok on channel default
RMAN-08031: released channel: c1
RMAN> exit
Incomplete restore scenario
The following shows the scenario for an
incomplete recovery. The following scenario assumes that:
- You wish to do an incomplete recovery due to
an application error that was made at a specific time.
- There are three tape drives.
- You are using a recovery catalog.
TIP: It is highly advisable to back up the
database immediately after opening the database resetlogs.
The following script restores and recovers the
database to the time immediately before the user error occurred. The
script does the following:
-
Starts the database mount and restricts
connections to DBA-only users.
-
Restores the database files (to the original
locations).
-
Recovers the data files by either using a
combination of incremental backups and redo or just redo. Recovery
Manager will complete the recovery when it reaches the transaction
from the time specified.
-
Opens the database resetlogs.
Oracle recommends that you backup your
database after the resetlogs (this is not shown in the example).
Ensure that you set your NLS_LANG and
NLS_DATE_FORMAT environment variables. You can set these to whatever
you wish?the date format of the following example is the standard date
format used for recovery, e.g., for UNIX (csh):
> setenv
NLS_LANG AMERICAN
> setenv NLS_DATE_FORMAT 'YYYY-MM-DD:hh24:mi:ss'
Next, start up Server Manager:
SVRMGR>
connect internal
Connected.
SVRMGR> startup mount restrict
SVRMGR>exit
# rman target internal/knl@prod1 rcvcat rman/rman@rcat cmdfile
case2.rcv
run {
# The 'set until time' command is for all commands executed
# between the { and } braces. Means both restore and recover
# will both be relative to that point in time.
# Note that Recovery Manager uses the Recovery Catalog to,
# determine the structure of the database at that time, and
# restore it.
#
set until time '1997-06-23:15:45:00';
#
allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
allocate channel t3 type 'SBT_TAPE';
#
restore
(database);
#
# There is no need to manually catalog logs before recovery,
# as Recovery Manager does catalog resync from the current
# control file.
#
recover
database;
#
sql 'alter database open resetlogs';
The preceding scenarios are just examples of
how to use the recovery manager. Please consult your manual before
attempting to use the facility for production work. The RMAN readme
file contains valuable insights into RMAN use and has several
additional scenarios.
More information on OPEN RESETLOGS is available
HERE.
|