Read Oracle RMAN 11g Backup and Recovery Online
Authors: Robert Freeman
Chapter 3: RMAN Setup and Configuration
79
RMAN Client Compatibility
When using the RMAN client, you will want to consider the compatibility of that client with the target database that you are connecting to. You will also need to consider the compatibility of the recovery catalog, which we will discuss in more detail in Chapter 9. In general, the version of the RMAN client should be the same or higher than the version of the target database that you will be connecting to. Here is a table that provides guidelines on RMAN compatibility between the target and auxiliary databases and the RMAN client:
Target/Auxiliary Database
Client Version Requirement
8.0.6
8.0.6 only
8.1.7
8.0.6.1 or 8.1.7 only
8.1.7.4
8.1.7.4 only
9.0.1
9.0.1 only
9.2.0
>= 9.0.1.3 and <= target database executable version
10.1.0
>= 9.0.1.3 and <= target database executable version
10.2.0
>= 9.0.1.3 and <= target database executable version
11.1.0
>= 9.0.1.3 and <= target database executable version
11.2.0
>= 9.0.1.3 and <= target database executable version
RMAN is stored in the $ORACLE_HOME/bin directory, and this directory should be in the PATH on the OS Oracle is running on. If you have several ORACLE_HOME directories, then you will want to be cautious. Make sure that the OS PATH is pointing to the correct ORACLE_HOME
before you start RMAN. If you do not set the PATH correctly, you could be using the wrong ORACLE_HOME directory. Also be cautious that there is not some other rman executable in the path before the RMAN executable. For example, an rman command in some versions of Unix sometimes ends up running instead of RMAN because it comes first in the path. In cases like this, you will need to adjust the path, or you may need to change to the $ORACLE_HOME/bin directory and run rman directly from that location.
Typically, RMAN will generate an error if you are using an incompatible client version. You can use OS-level utilities (such as oraenv) to determine if you are using the correct ORACLE_
HOME, or you can check the banner of the RMAN client.
Using the RMAN connect Command
If you start RMAN and realize that you either have not connected to the correct database or wish to connect to a different database (target, catalog, or auxiliary), you can use the
connect
command to change which database RMAN is connected to. To change to another target database, use the
connect target
command. To change to a different recovery catalog, use the
connect catalog
command. To connect to a different auxiliary database, use the
connect auxiliary
command. Here are some examples of the use of the
connect
command: connect target sys/password@testdb;
connect catalog rcat user/password@robdb;
80
Part II: Setup Principles and Practices
Exiting the RMAN Client
When you are done with RMAN, it’s time to get out of the client. RMAN offers two commands,
quit
and
exit
. These commands will return you to the OS prompt. RMAN also allows you to shell out to the OS with the
host
command. Here are some examples:
C:\>rman target /
Recovery Manager: Release 11.2.0.1.0-Production on Wed Oct 4 22:49:14 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL2 (DBID 582838926)
RMAN> host;
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>exit
host command complete
RMAN> exit
Recovery Manager complete.
Configuring the Database for RMAN Operations
Now that you know how to start RMAN, we need to deal with some configuration issues.
While it is possible to just fire up RMAN and do a backup, it’s a better idea to deal with some configuration questions before you do so. First, you need to set up the database user that RMAN
will be using. Next, you can configure RMAN to use several settings by default, so we will look at those settings as well.
Setting Up the Database User
By default, you can use RMAN with the SYS account (as sysdba) without any configuration required. Of course, that’s probably not the best account to use when you are doing production backups. We recommend, before you use RMAN to do a backup, that you create a separate account that is designated for RMAN backups. The following workshop helps you do just that.
RMAN Workshop:
Create the Target Database
RMAN Backup Account
Workshop Notes
For this workshop, you need an installation of the Oracle software and a database that is up and running. You need administrative privileges on this database.
Step 1.
Determine the user account name that you want to use, and create it with the database
create user
command:
CREATE USER backup admin IDENTIFIED BY backupuserpassword
DEFAULT TABLESPACE users;
Step 2.
Grant the sysdba privilege to the BACKUP_ADMIN user. You need to grant this privilege because RMAN always connects to the database by using the sysdba login. Here is an example of granting the sysdba privilege to the BACKUP_ADMIN account:
GRANT sysdba TO backup admin;
Chapter 3: RMAN Setup and Configuration
81
NOTE
If you created your database with the
dbca
, you were offered an
option to set up automated daily backups. If you selected this option,
Oracle will do some initial RMAN configuration for you (it will
configure the FRA, for example). While this RMAN configuration
is sufficient for databases that are not of consequence, if you are
managing databases that are mission critical, you should still follow
the steps outlined in this chapter and ensure that your database is
properly configured for RMAN operations.
So, what happens if you try to connect RMAN to an account that is not properly created? The following error will occur:
D:\oracle\oradata\robt>RMAN target backup/backup@robt
Recovery Manager: Release 11.2.0.1.0
Production on Tue Aug 22 21:40:51 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN-00571:
RMAN-00569:
ERROR MESSAGE STACK FOLLOWS
RMAN-00571:
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01031: insufficient privileges
Now that we have created the user and granted it the privileges it will need, we are a step closer to being ready to use RMAN. Still, we have some RMAN default settings we need to configure, so let’s look at those next.
Setting Up Database Security
We need to discuss briefly the differences between connecting to RMAN on the local server and connecting to it via Oracle Net. When you start RMAN, you might be logged onto the same server as the database. In this case, if you are logged on using a privileged OS user account, you do not need to do anything beyond the two steps in the preceding RMAN Workshop. How do you know whether your user account is a privileged one? It depends on the OS you are using. If you are using Unix, there is generally a Unix group called dba (though it may be called something else) that is created when the Oracle-owning account (usually called Oracle) is created. If your Unix user account is assigned to this group, then you will be able to connect to a target database without any additional work. If you are using Windows platforms, then the privileged users are assigned to an NT group, generally called ORA_DBA.
If you are not logging onto the local server using a privileged account, or if you are connecting to the target database using Oracle Net from a client workstation (for example, you are connecting using system/manager@testdb), then you need to configure your database to use a password file. To do so, you first need to create the password file, and then need to configure the database so that it knows to use it. Let’s look at each of these steps in detail.
Create the Password File
To create the database password file, you use the Oracle utility
orapwd
. This command takes three parameters:
■
file
The password filename
82
Part II: Setup Principles and Practices
■
password
The password for the sys user
■
entries
Any number of entries to reserve for additional privileged Oracle user accounts By default, the Oracle database (on NT) will expect the password file to take on the naming standard PWD
sid.
ora, where
sid
is your database name. Here is an example of the creation of a password file:
orapwd file PWDrobt.ora password robert entries 20
So, now that we have created the password file, we need to configure the database to use it, and thus to allow us to do remote backups via Oracle Net.