Oracle RMAN 11g Backup and Recovery (42 page)

BOOK: Oracle RMAN 11g Backup and Recovery
10.28Mb size Format: txt, pdf, ePub

Chapter 3: RMAN Setup and Configuration
75

ADR Base

diag

rdbms

Database Name

ADR Home

SID

Alert

cdump

Incident

Trace

(Others)

A new view, V$DIAG_INFO, provides information on the various ADR locations, as well as information related to ADR, such as active incidents. Here is an example of a query against the V$DIAG_INFO view:

SQL> select * from v$diag info;

INST ID NAME VALUE

---------- ------------------------- ----------------------------------------

1 Diag Enabled TRUE

1 ADR Base C:\ORACLE\PRODUCT

1 ADR Home C:\ORACLE\PRODUCT\diag\rdbms\rob11gr4\

rob11gr4

1 Diag Trace C:\ORACLE\PRODUCT\diag\rdbms\rob11gr4\

rob11gr4\trace

1 Diag Alert C:\ORACLE\PRODUCT\diag\rdbms\rob11gr4\

rob11gr4\alert

1 Diag Incident C:\ORACLE\PRODUCT\diag\rdbms\rob11gr4\

rob11gr4\incident

1 Diag Cdump C:\ORACLE\PRODUCT\diag\rdbms\rob11gr4\

rob11gr4\cdump

1 Health Monitor C:\ORACLE\PRODUCT\diag\rdbms\rob11gr4\

rob11gr4\hm

1 Default Trace File C:\ORACLE\PRODUCT\diag\rdbms\rob11gr4\

rob11gr4\trace\rob11gr4 ora 7832.trc

1 Active Problem Count 1

1 Active Incident Count 1

11 rows selected.

76
Part II: Setup Principles and Practices

The RMAN Command Line

Now that the database is in ARCHIVELOG mode (if you are going to do online backups), you are ready to configure RMAN and your database for backups. Before you can do that, it would be nice to actually know how to use the RMAN executable. So, let’s take a slight detour in our setup discussion to look at the RMAN command-line interface (CLI) and how to use it.

There are two different ways to get to RMAN. The first is from the command line, and the second is by using OEM (Oracle Enterprise Manager). We will deal with the OEM interface in more detail in Chapter 11. Most of the examples you will see in this book, however, will be done using the CLI. We figure that if you can do it from the command line, you can do it from anywhere. In the next sections, we will look at how to connect to databases with the RMAN

command line and also how to use the
connect
command.

Connecting via the RMAN Command Line

You can start RMAN from the OS prompt simply by typing the command
rman
. Once you have started the RMAN command interpreter, you can perform whatever operations you might need to perform. Often, it’s much easier to get some of the preliminary work done by using command-line parameters. Thus, when we start RMAN, we can pass several command-line parameters. You can use the command-line parameters to connect RMAN to the database you are going to back up (known as the
target database
), to the recovery catalog, or for a number of other tasks. Table 3-2

provides a list of the command-line parameters, the data type for the argument of the parameter (if there is one), and the purpose of the parameter.

RMAN Command-Line

Parameter

Purpose

Parameter

Argument Type

target

Character string

Defines the username, password, and service name of

the target database to connect to.

catalog

Character string

Defines the username, password, and service name of

the recovery catalog.

nocatalog

No arguments

Indicates that no recovery catalog is going to be

used by this session. This parameter is the default

parameter in Oracle8
i
and Oracle9
i.

cmdfile

Character string

Indicates the name of a command file script to

execute.

log

Character string

Indicates that the RMAN session should be logged.

The log file will take the name of the argument to this

parameter. Also causes all RMAN messages to the

screen to be suppressed (except the RMAN prompt).

trace

Character string

Indicates that the RMAN session should be traced.

The trace file will take the name of the argument to

this parameter.

TABLE 3-2
RMAN Command-Line Parameters

Chapter 3: RMAN Setup and Configuration
77

RMAN Command-Line

Parameter

Purpose

Parameter

Argument Type

append

No arguments

Indicates that the log file (defined by the log

parameter) should be appended to.

debug

Various

Indicates that RMAN should be started in debug mode.

arguments

msgno

No arguments

Indicates that the RMAN- prefix should be shown with

each error message. If this option is not selected, then

certain non-error messages will not include a message

number with them.

send

Character string

Sends the character string message to the media

management layer.

pipe

String

Invokes the RMAN pipe interface.

timeout

Integer

Indicates the number of seconds to wait for pipe input.

auxiliary

Character string

Defines the username, password, and service name of

the auxiliary database to connect to.

checksyntax

None

Checks the command file listed for syntax errors.

slaxdebug

None

Checks for command line and RMAN prompt parsing

errors.

TABLE 3-2
RMAN Command-Line Parameters
(continued)

Here are some examples of starting RMAN with some command-line parameters (and you will see others later):

RMAN target system/manager@robt nocatalog

RMAN target 'sys/robert as sysdba@robt' nocatalog

RMAN target system/manager@robt

catalog system/manager@catalog log "RMAN.log"

RMAN target system/manager@robt nocatalog log "RMAN.log"

NOTE

The = sign between the command-line parameter and the value of that

parameter is optional. Also, if you are running Oracle Database 11
g
Real Application Clusters, you can connect to only one instance of

that cluster.

Note that RMAN
always
connects as SYSDBA to the target database. This is good to know because it implies that the account we connect to has to have the SYSDBA privileges.

If you forget the command-line arguments to RMAN (and somehow manage to leave this book and your documentation at home), there is a way to get RMAN to display the valid command-line parameters. Simply start RMAN with an invalid parameter. As you can see in

78
Part II: Setup Principles and Practices

the following example, RMAN will return an error, but will also provide you with a list of valid command-line parameters (we removed some of the errors at the bottom of the listing for brevity): C:\Documents and Settings\Robert>rman help

Argument Value Description

-------------------------------------------------------------------------

target quoted-string connect-string for target database

catalog quoted-string connect-string for recovery catalog

nocatalog none if specified, then no recovery catalog

cmdfile quoted-string name of input command file

log quoted-string name of output message log file

trace quoted-string name of output debugging message log file

append none if specified, log is opened in append mode

debug optional-args activate debugging

msgno none show RMAN-nnnn prefix for all messages

send quoted-string send a command to the media manager

pipe string building block for pipe names

timeout integer number of seconds to wait for pipe input

checksyntax none check the command file for syntax errors

-------------------------------------------------------------------------

Both single and double quotes (' or ") are accepted for a quoted-string.

Quotes are not required unless the string contains embedded white-space.

RMAN offers the
checksyntax
parameter, which allows you to check the RMAN commands you want to issue for errors. Here is an example of the use of the
checksyntax
parameter: C:\Documents and Settings\Robert>rman checksyntax

Recovery Manager: Release 11.2.0.1.0 Production on Thu Nov 5 04:03:03 2009

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

RMAN> backup database pls archivelog;

RMAN 00571:

RMAN 00569:

ERROR MESSAGE STACK FOLLOWS

RMAN 00571:

RMAN 00558: error encountered while parsing input commands

RMAN 01009: syntax error: found "identifier": expecting one of: "archivelog, auxiliary, backupset, backup, channel, controlfilecopy, copy, current, database, datafilecopy, datafile, db recovery file dest, delete, diskratio, filesperset, force, format, from, include, keep, maxsetsize, noexclude, nokeep, not, plus, pool, recovery, reuse, section, skip readonly, skip, spfile, tablespace, tag, to, (, ;"

RMAN 01008: the bad identifier was: pls

RMAN 01007: at line 1 column 17 file: standard input

RMAN> backup database plus archivelog;

The command has no syntax errors

Note that a lot can be divined from RMAN error messages. Often, within the message, you can see that RMAN was expecting a particular keyword or phrase.

Other books

Changelings by Jo Bannister
Mind of an Outlaw by Norman Mailer
Practice Makes Perfect by Kathryn Shay
SCRATCH (Corporate Hitman Book 2) by Linden, Olivia, Newton, LeTeisha
Entwine by Rebecca Berto
Wednesday by James, Clare
My Pirate Lover by Stewart, Lexie
Sarah's Surrender by McDonough, Vickie;
Garden of Desire: 1 by Devlin, Delilah