jueves, 6 de agosto de 2009

STARTING RMAN

Enabling Archivelog Mode

SQL> connect sys/chaya as sysdba
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;

SQL> select log_mode from v$database;
LOG_MODE
--------------------
ARCHIVELOG

Starting and Exiting RMAN

Start the RMAN executable at the operating system command line without specifying any connection options, as in this example:

% rman

Start the RMAN executable at the operating system command line while connecting to a target database and, possibly, a recovery catalog, as in these examples:

% rman TARGET /
% rman TARGET SYS/oracle@trgt NOCATALOG
% rman TARGET / CATALOG rman/cat@catdb

Setting Globalization Support Environment Variables for RMAN

The following example shows typical language and date format settings:

NLS_LANG=american
NLS_DATE_FORMAT='Mon DD YYYY HH24:MI:SS'

Recovery Window-Based Backup Retention Policy
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;

Redundancy-Based Backup Retention Policy
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

3.1.3 Entering RMAN Commands at the Command Prompt
When the RMAN client is ready for your commands, it displays the command prompt, as in this example:

RMAN>

Enter commands for RMAN to execute. For example:

RMAN> CONNECT TARGET /
RMAN> CONNECT CATALOG rman/rman@inst2

RMAN> BACKUP DATABASE ;

Most RMAN commands take a number of parameters and must end with a semicolon. (The few exceptions, such as STARTUP, SHUTDOWN, and CONNECT, can be used with or without a semicolon.)

To display information about your backup, use the list backup command as follows:

RMAN> list backup;

Determine the location of a target database datafile so that you can rename it to simulate
media failure:

RMAN> report schema;

When you enter a line of text that is not a complete command, RMAN prompts for continuation input with a line number. For example:

RMAN> BACKUP DATABASE
2> INCLUDE CURRENT
3> CONTROLFILE
4> ;

Using Command Files with RMAN
For repetitive tasks, you can create a text file containing RMAN commands, and start the RMAN client with the @ argument, followed by a filename. For example, create a text file cmdfile1 in the current directory contained one line of text as shown here:

BACKUP DATABASE INCLUDE CURRENT CONTROLFILE;

You can run this command file from the command line as shown in this example, and the command contained in it is executed:

% rman TARGET / @cmdfile1

RMAN> @cmdfile1

No hay comentarios: