Oracle9i Recovery Manager User's Guide Release 2 (9.2) Part Number A96566-01 |
|
This chapter describes how to start and stop the Recovery Manager (RMAN) command-line interface and make database connections. This chapter contains these topics:
You have the following basic options for starting RMAN:
% rman TARGET / CATALOG rman/cat@catdb % rman TARGET SYS/oracle@trgt NOCATALOG % rman TARGET / CATALOG rman/cat@catdb AUXILIARY SYS/oracle@auxdb
% rman
If you connect to the target database on the command line when you start RMAN, then after the RMAN prompt is displayed you can begin executing commands.
If you start RMAN without connecting to the target database, then you must issue CONNECT
TARGET
command at the RMAN prompt before you can begin performing backup and recovery operations.
You can connect to the following types of databases.
When connecting to a target or auxiliary database, you must have the SYSDBA
privilege. You can connect as SYSDBA
using a password file or using operating system authentication.
Note: You do not need to specify the |
If the target database uses password files, then you can connect using a password. Use a password file for either local or remote access. You must use a password file if you are connecting remotely as SYSDBA
using a net service name.
If you connect to the database using operating system authentication, remember to set the environment variable specifying the Oracle SID. For example, to set the SID to trgt
at the UNIX command line enter:
% ORACLE_SID=trgt; export ORACLE_SID
Note that a SYSDBA
privilege is not required when connecting to the recovery catalog. The only requirement is that the RECOVERY_CATALOG_OWNER
role be granted to the schema owner.
See Also:
The first chapter of the Oracle9i Database Administrator's Guide to learn how to authenticate users on a database, and to create a password file |
RMAN provides a number of command-line options that you can specify when starting RMAN. For example, you can start RMAN:
See Also:
|
You can start Recovery Manager at the operating system command line without connecting to a database by issuing the RMAN
command without any arguments. For example, enter:
% rman
If you did not specify the LOG
option at the command line, then RMAN displays the RMAN prompt:
RMAN>
After the RMAN prompt is displayed, you can issue further commands to connect to the target database, recovery catalog database, or auxiliary database.
If you start RMAN without specifying either CATALOG
or NOCATALOG
on the command line, then RMAN makes no repository connection. The first time a command is issued that requires the repository, if no CONNECT
CATALOG
command has been issued yet, then RMAN automatically connects in the default NOCATALOG
mode. After that point, the CONNECT
CATALOG
command is not valid in the session.
In these examples, assume that these variables have the following meanings.
Variable | Meaning |
---|---|
|
User with |
|
The password for connecting as |
|
The net service name for the target database |
To connect from the operating system command line, enter the connection as in the following examples:
# example of operating system authentication % rman TARGET / NOCATALOG # example of Oracle Net authentication % rman TARGET SYS/oracle@trgt NOCATALOG
Note that you can also start RMAN without specifying either NOCATALOG
or CATALOG
as follows:
# example of operating system authentication % rman TARGET / # example of Oracle Net authentication % rman TARGET SYS/oracle@trgt
If you do not specify the NOCATALOG
keyword on the command line, and if you also do not specify CONNECT
CATALOG
after RMAN has started, then RMAN connects in NOCATALOG
mode by default the first time that you run a command that requires a repository. For example:
% rman TARGET / RMAN> BACKUP DATABASE; # RMAN defaults to NOCATALOG mode
Alternatively, start RMAN and connect to the target database from the RMAN prompt, as in this example:
% rman NOCATALOG RMAN> CONNECT TARGET
This example connects to the target database by using a password file:
% rman NOCATALOG RMAN> connect target SYS/oracle@trgt
In these examples, assume that you maintain a recovery catalog and that these variables have the following meanings.
To connect to the target and recovery catalog databases from the operating system command line, enter the connection as in the following examples:
# operating system authentication % rman TARGET / CATALOG rman/cat@catdb # Oracle Net authentication % rman TARGET SYS/oracle@trgt CATALOG rman/cat@catdb
Alternatively, start RMAN and connect to the target database from the RMAN prompt. This example uses operating system authentication:
% rman RMAN> CONNECT TARGET RMAN> CONNECT CATALOG rman/cat@catdb
This example uses Oracle Net authentication:
% rman RMAN> CONNECT TARGET SYS/oracle@trgt RMAN> CONNECT CATALOG rman/cat@catdb
RMAN can only connect to one instance in an Oracle Real Application Clusters database at a time. Assume that trgt1
, trgt2
, and trgt3
are net service names for three instances in an Oracle Real Application Clusters configuration. In this case, you can connect to the target database using only one of these net service names. For example, you can connect as follows:
% rman TARGET SYS/oracle@trgt2 CATALOG rman/cat@catdb
Each net service name must specify one and only one instance. You cannot specify a net service name that uses Oracle Net features to distribute connections to more than one instance.
Note that the fact that RMAN connects to only one instance for its initial target connection does not preclude running a backup using all three instances. For example, you can configure automatic channels to connect to each cluster instance as follows:
CONFIGURE DEFAULT DEVICE TYPE TO sbt; CONFIGURE DEVICE TYPE sbt PARALLELISM 3; CONFIGURE CHANNEL 1 DEVICE TYPE sbt CONNECT = 'SYS/oracle@trgt1'; CONFIGURE CHANNEL 2 DEVICE TYPE sbt CONNECT = 'SYS/oracle@trgt2'; CONFIGURE CHANNEL 3 DEVICE TYPE sbt CONNECT = 'SYS/oracle@trgt3';
Then, make a whole database backup by running the following command:
BACKUP DATABASE;
To use the DUPLICATE
command or to perform RMAN TSPITR, you need to connect to an auxiliary instance. In these examples, assume that these variables have the following meanings.
If the auxiliary database uses password files for authentication, then you can connect using a password for either local or remote access. If you are connecting remotely through a net service name, then authentication through a password file is mandatory.
To connect to an auxiliary instance from the operating system command line, enter the following:
% rman AUXILIARY SYS/aux@auxdb
To connect to the target, auxiliary, and recovery catalog databases, issue the following (all on one line):
% rman TARGET SYS/oracle@trgt CATALOG rman/cat@catdb AUXILIARY SYS/aux@auxdb
Alternatively, you can start RMAN and connect to the auxiliary database from the RMAN prompt:
% rman RMAN> CONNECT AUXILIARY SYS/aux@auxdb
To connect to the target, auxiliary, and recovery catalog databases, issue:
% rman RMAN> CONNECT TARGET SYS/oracle@trgt RMAN> CONNECT CATALOG rman/cat@catdb RMAN> CONNECT AUXILIARY SYS/aux@auxdb
To connect to RMAN from the operating system command line and hide authentication information, you must first start RMAN and then perform either of the following actions:
CONNECT
commands at the RMAN prompt. If the password is not provided in the connect string, then RMAN prompts for the password.For example, if you are running RMAN in an UNIX environment, then you can use the following procedure:
% rman
connect.rman
:
CONNECT TARGET SYS/oracle@trgt CONNECT CATALOG rman/cat@catdb
% chmod 711 connect.rman
RMAN> @connect.rman
The RMAN pipe interface is an alternative method for issuing commands to RMAN and receiving the output. By using a pipe, RMAN can interface with the DBMS_PIPE
PL/SQL package and avoid the operating system command shell altogether.
RMAN does not permit the pipe interface to be used with public pipes, because they are a potential security problem. With a public pipe, any user who knows the name of the pipe can send commands to RMAN and intercept its output.
If the pipes are not already initialized, then RMAN creates them as private pipes. If you want to put commands on the input pipe before starting RMAN, be careful to first create the pipe by calling DBMS_PIPE.CREATE_PIPE
. Whenever a pipe is not explicitly created as a private pipe, the first access to the pipe automatically creates it as a public pipe, and RMAN returns an error if it is told to use a public pipe.
Note that the order of steps in the procedure does not have to be exactly as shown in scenario 1. In scenario 2, you put commands into the pipe and then connect to the database.
To use RMAN in pipe mode (scenario 1):
PIPE
option. For example, issue:
% rman PIPE abc TARGET SYS/oracle @trgt
You can also specify the TIMEOUT
option, which forces RMAN to exit automatically if it does not receive any input from the input pipe in the specified number of seconds. For example, enter:
% rman PIPE abc TARGET SYS/oracle@trgt TIMEOUT = 60
DBMS_PIPE.PACK_MESSAGE
and DBMS_PIPE.SEND_MESSAGE
. In pipe mode, RMAN issues message RMAN-00572
when it is ready to accept input instead of displaying the standard RMAN prompt.DBMS_PIPE.RECEIVE_MESSAGE
and DBMS_PIPE.UNPACK_MESSAGE
.EXIT
command to force RMAN to terminate. Alternatively, use the TIMEOUT
option, in which case RMAN terminates automatically after not receiving any input for the specified length of time).To use RMAN in pipe mode (scenario 2):
ORA$RMAN_
pipe_IN
).RMAN-00572
when it is ready to accept input instead of displaying the standard RMAN prompt.PIPE
option, and specify TIMEOUT =
0
. For example, enter:
% rman PIPE abc TARGET SYS/oracle@trgt TIMEOUT = 0
DBMS_PIPE.PACK_MESSAGE
and DBMS_PIPE.SEND_MESSAGE
. When it has exhausted the input pipe, RMAN exits immediately.DBMS_PIPE.RECEIVE_MESSAGE
and DBMS_PIPE.UNPACK_MESSAGE
.
See Also:
Oracle9i Supplied PL/SQL Packages and Types Reference for documentation on the |
To quit RMAN and terminate the program, type EXIT
or QUIT
at the RMAN prompt. For example:
RMAN> exit
See Also:
Oracle9i Recovery Manager Reference for |
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|