This module discussed command-line options and initial operations using Recovery Manager.
Specifically, you learned how to:
- Issue the command to start RMAN
- Start RMAN without recovery catalog
- Register a target database into your recovery catalog
- Discuss the use of the
reset
command
- Demonstrate how to resynchronize a target database using the
resynch
command
- Identify other situations where the
resynch
command is needed
- Use the
change
command to alter the information in your recovery catalog
- Use the
delete
command to remove data from your recovery catalog and the validate
command to check the validity of your recovery catalog
It is highly recommended that you use the recovery catalog. Though you may spend time using the recovery catalog initially, you will be rewarded when you need to restore your database. However, there may be few instances where it is unadvisable to use a recovery catalog, such as having a local Oracle database on your machine. Often these local databases do not contain critical information or contain information that is easily re-created.
Even then, if you are on a network and your data is important, it is safer to manage your database in the manner that you manage all other production Oracle database.
The recovery catalog is an optional component of RMAN that stores historical backup information from RMAN backups. Unlike the database control file’s RMAN information, the recovery catalog data is not purged on a regular basis. Therefore, the RMAN metadata in the recovery catalog tends to be more comprehensive and to date further back than the historical information in the control file. Using a recovery catalog does have a few
additional benefits over just using the database control file:
- You must use a recovery catalog if you want to use stored RMAN scripts.
- You want to use the keep forever option when performing an RMAN backup.
- You must use a recovery catalog if you are using one or more standby databases.
- You must use a recovery catalog if you are using a split-mirror backup model.
- A recovery catalog offers a single, enterprise-wide repository of RMAN information. This provides an easier and more flexible central repository of enterprise backup information.
- A recovery catalog allows more flexibility when you are doing reporting because you can report on the target database at a time other than the current time.
- With a recovery catalog, certain default database RMAN channel configuration information will still be maintained without you needing to manually recover it in the event of a control file failure.
Since version 10g, Oracle Database has easily supported recovery through resetlogs without a recovery catalog. Also, if you are using control file autobackups (which we strongly suggest), the need for a recovery catalog for control file recoveries is pretty much removed.
Problem:
You are new to Oracle and wonder how to connect to your database via SQL*Plus so that you can perform basic
commands, such as starting and stopping your database and enabling archivelog mode.
Solution: Before you connect to an Oracle database, you must establish operating system variables before connecting to the
database, and you also need access to either a privileged OS account or a database user granted the appropriate
privileges (via a password file). These topics are discussed in the following subsections.
Establishing OS Variables
The OS environment variables are usually set when you log on to your database server. DBAs typically set these variables automatically in a startup file (such as .bashrc on Linux/Unix). Minimally, you need to set:
- ORACLE_SID to the name of your target database
- ORACLE_HOME to the parent directory where you installed the Oracle RDBMS software (binaries)
- PATH to include ORACLE_HOME/bin
In a Linux/Unix environment, Oracle provides an oraenv script for the Korn/Bash/Bourne shells and coraenv for the C shell to set the required OS variables. For example, you can run the oraenv script from the operating system prompt as follows:
$ .oraenv
You will be prompted for the name of your database. You can verify the settings of these variables as follows:
$ echo $ORACLE_SID
$ echo $ORACLE_HOME
$ echo $PATH
If the need arises, you can override these settings by establishing OS environment variables from the command line.
Here is an example of manually establishing these variables in a Linux/Unix environment:
$ export ORACLE_SID=o12c
$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0.1/db_1
$ export PATH=$ORACLE_HOME/bin:$PATH
Keep in mind the prior code is just an example. You will need to modify the prior commands to match the target
ORACLE_SID and ORACLE_HOME in your environment.
Note: In Windows the operating system variables are set in the registry.
After you have established your operating system variables, you need to connect to the database with the proper privileges. You can do this in one of two ways: using OS authentication or using a password file.
Using OS Authentications
If your Linux/Unix account is a member of the dba group (your shop might use a different group name, but dba is the
most common), you can connect to your database with the required privileges via SQL*Plus by virtue of being logged in
to your Linux/Unix account. On Windows, the OS user must be part of either the ora_dba group or the ora_oper group.
On Linux/Unix you can quickly verify the operating system groups that your account belongs to using the id
command without any parameters:
$ id
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper),503(asmdba),
504(asmoper),505(asmadmin),506(backupdba)
The prior output indicates that the oracle user is included in several groups, one of which is dba. Any user who
belongs to the dba group can connect to the database with sysdba privileges. A user with sysdba privileges can start
and stop the database. This example uses OS authentication to connect to your database as the user sys:
$ sqlplus / as sysdba
No username or password is required when using OS authentication (hence just the slash without a user/
password) because Oracle first checks to see if the OS user is a member of a privileged OS group, and if so, connects
without checking the username/password.
You can verify that you have connected as sys by issuing the following:
SQL> show user
USER is "SYS"
In the next module you will learn about using the recovery catalog.
Click the Quiz link below to review your understanding of the information presented in this module.
Recovery Catalog Maintenance - Quiz