CONNECT

Purpose

Use the CONNECT command to establish a connection between RMAN and a target, auxiliary, or recovery catalog database.

Prerequisites

RMAN connections to a database are specified and authenticated in the same way as SQL*Plus connections to a database. The only difference is that RMAN connections to a target or auxiliary database require the SYSBACKUP or SYSDBA privilege.

See Also:

Caution:

Good security practice requires that passwords are not entered in plain text on the command line. Enter passwords in RMAN only when requested by an RMAN prompt. See Oracle Database Security Guide to learn about password protection.

See Also:

RMAN for command-line connection options

You can only run the CONNECT TARGET, CONNECT CATALOG, and CONNECT AUXILIARY commands at the RMAN prompt and only if RMAN is not already connected to the databases specified by these commands. To connect to a different target, catalog, or auxiliary database you must start a new RMAN session.

Usage Notes

An RMAN session runs in NOCATALOG mode by default if all of the following conditions are met:

  • You did not specify CATALOG or NOCATALOG when you started RMAN.

  • You have not yet run CONNECT CATALOG in an RMAN session.

  • You run a command such as BACKUP that requires an RMAN repository connection (as shown in Example 2-59).

Connecting to CDBs and PDBs

RMAN provides full support for performing backup and recovery operations in a multitenant environment. The multitenant architecture enables an Oracle Database to function as a multitenant container database (CDB) that includes zero, one, or many customer-created pluggable databases (PDBs). The process of establishing an RMAN connection to a CDB or PDB is similar to that of non-CDBs. You can use either operating system authentication or password file authentication.

See Also:

To connect to a CDB, you connect to the root as a common user with the common SYSDBA or common SYSBACKUP privilege as described in "connectStringSpec".

To connect to a PDB, you can connect either as a common user or a local user. The user creating the connection must have the privileges described in"connectStringSpec".

Note:

When you connect as TARGET to a PDB, you cannot connect to a recovery catalog.

To perform operations on the whole CDB or the root, you connect as TARGET to the root. The user creating the connection must be a common user with the common SYSDBA or common SYSBACKUP privilege.To perform operations on multiple PDBs, connect as TARGET to the root. The user creating the connection must be a common user with the common SYSDBA or common SYSBACKUP privilege. To perform operations on a PDB, you can connect as TARGET either to the root or to the PDB. To connect to a PDB, the user creating the connection must have the privileges described in "connectStringSpec".

See Also:

Oracle Database Backup and Recovery User's Guide for additional information about connecting to CDBs and PDBs

Semantics

Syntax Element Description
CONNECT AUXILIARY Establishes a connection between RMAN and an auxiliary database instance.

Auxiliary instances are used with the TRANSPORT TABLESPACE and DUPLICATE commands, and during RMAN TSPITR.

CONNECT CATALOG Establishes a connection between RMAN and a recovery catalog database.

If the recovery catalog is a virtual private catalog (see CREATE CATALOG), then the RMAN client connecting to this catalog must be at patch level 10.1.0.6 or 10.2.0.3. Oracle9i RMAN clients cannot connect to a virtual private catalog. This version restriction does not affect RMAN client connections to an Oracle Database 11g base recovery catalog, even if it has some virtual private catalog users.

RMAN issues an RMAN-06445 error if you attempt to use the CONNECT CATALOG command in an RMAN session when RMAN is in the default NOCATALOG mode (see "Usage Notes").

Note: You must use RMAN with a recovery catalog in a Data Guard environment.

CONNECT TARGET Establishes a connection between RMAN and a target database.

Note: RMAN can connect to physical standby databases as TARGET in a Data Guard environment. If you run CONNECT TARGET for a database that has a DB_UNIQUE_NAME that is unknown to the recovery catalog, but the DBID identifies a registered database, then RMAN automatically and implicitly registers the database in the recovery catalog.

    connectStringSpec Specifies the connection information for the database.

Examples

Example 2-58 Connecting to a Target Database Without a Recovery Catalog

This example starts RMAN in NOCATALOG mode and then connects to the target database with an Oracle Net service name prod1. sbu is a user who is granted the SYSBACKUP privilege.

% rman NOCATALOG
RMAN> CONNECT TARGET "sbu@prod1 AS SYSBACKUP";

target database Password: password
connected to target database: PROD1 (DBID=39525561)

Example 2-59 Connecting to a Target Database in the Default NOCATALOG Mode

This example starts RMAN without specifying either CATALOG or NOCATALOG and then uses operating system authentication to connect to a target database with operating system authentication. Because no CONNECT CATALOG command has been run, RMAN defaults to NOCATALOG mode when you run the BACKUP command.

% rman
RMAN> CONNECT TARGET /
RMAN> BACKUP DATABASE;

At this point in the RMAN session, you cannot run CONNECT CATALOG because the session has defaulted to NOCATALOG mode. An attempt to connect to the catalog in this session receives an error:

RMAN> CONNECT CATALOG rco@catdb

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06445: cannot connect to recovery catalog after NOCATALOG has been used

Example 2-60 Connecting to Target, Recovery Catalog, and Auxiliary Databases

This example connects to a target database with operating system authentication and connects to the recovery catalog and auxiliary databases with password files. sbu is a user who is granted the SYSBACKUP privilege. RMAN prompts for the password.

% rman
RMAN> CONNECT TARGET;

connected to target database: PROD (DBID=39525561)

RMAN> CONNECT CATALOG rco@catdb;
 
recovery catalog database Password: password
connected to recovery catalog database

RMAN> CONNECT AUXILIARY "sbu@dupdb AS SYSBACKUP";

auxiliary database Password: password
connected to auxiliary database: DUPDB (not mounted)

Example 2-61 Connecting to the Root Using Operating System Authentication

This example connects to the root in a CDB using operating system authentication. By default, the connection is established using SYSDBA privilege.

%rman
RMAN> CONNECT TARGET /

Example 2-62 Connecting to a PDB as a Local User

This example connects to the PDB hr_pdb as the local user sbu_pdb who is granted the SYSBACKUP privilege on the hr_pdb PDB. hrpdb is the net service name corresponding to the PDB hr_pdb.

%rman
RMAN> CONNECT TARGET "sbu_pdb@hrpdb AS SYSBACKUP";