Monday, 16 July 2007

RMAN without a recovery catalog

You can use RMAN with or without the central information repository called a recovery catalog. If you do not use a recovery catalog, RMAN uses the database’s control file to store information necessary for backup and recovery operations.

How to start RMAN without a Catalog

C:\>rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jul 17 00:11:28 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORATST (DBID=709496429)
RMAN>

How to configure Backup Parameters

RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/product/10.2.0/dbs/snapcf_ORATST1.f'; # default

>> Oracle recommends that CONFIGURE CONTROLFILE AUTOBACKUP be set to ON

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored


With a control file autobackup, RMAN can recover the database even if the current control file, recovery catalog, and server parameter file are inaccessible.

Run Full Backup

RMAN> REPORT NEED BACKUP;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1 0 /oradisk1/oradata/ORATST/datafile/o1_mf_system_1zl13ds1_.dbf
2 0 /oradisk1/oradata/ORATST/datafile/o1_mf_undotbs1_1zl14557_.dbf
3 0 /oradisk1/oradata/ORATST/datafile/o1_mf_sysaux_1zl14gvs_.dbf
4 0 /oradisk1/oradata/ORATST/datafile/o1_mf_users_1zl150qk_.dbf


Performing a Full Level 0 Backup

RMAN> run {
allocate channel d1 type disk;
setlimit channel d1 kbytes 1024000;
backup format '/oradisk2/backups/ORATST/rman_%d_%t_%U.ctf' current controlfile;
backup format '/oradisk2/backups/ORATST/rman_%d_%t_%U.arf' archivelog all;
backup database format '/oradisk2/backups/ORATST/rman_%d_%t_%U.dtf';
release channel d1;
}
exit;


RMAN> list backup summary;
using target database control file instead of recovery catalog

List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1 B F A DISK 17-JUL-07 1 1 NO TAG20070717T011634
2 B A A DISK 17-JUL-07 1 1 NO TAG20070717T011638
3 B F A DISK 17-JUL-07 1 1 NO TAG20070717T011643
4 B F A DISK 17-JUL-07 1 1 NO TAG20070717T011759


Detecting Physical and Logical Block Corruption

You can run the BACKUP ... VALIDATE command to check datafiles for physical and logical corruption, or to confirm that all database files exist in the correct locations. No backup is taken, but all specified files are scanned to verify that they can be backed up. All corruptions are recorded in theV$DATABASE_BLOCK_CORRUPTION view.

The following example shows how to check your entire database and archived redo log files for physical and logical corruption:

RMAN> BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;

Starting backup at 17-JUL-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oradisk1/oradata/ORATST/datafile/o1_mf_system_1zl13ds1_.dbf
input datafile fno=00002 name=/oradisk1/oradata/ORATST/datafile/o1_mf_undotbs1_1zl14557_.dbf
input datafile fno=00003 name=/oradisk1/oradata/ORATST/datafile/o1_mf_sysaux_1zl14gvs_.dbf
input datafile fno=00004 name=/oradisk1/oradata/ORATST/datafile/o1_mf_users_1zl150qk_.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=1 stamp=628132598
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 17-JUL-07


Rman Views V$RMAN_BACKUP_JOB_DETAILS, V$RMAN_BACKUP_TYPE, V$RMAN_OUTPUT

SQL>
col STATUS format a9
col hrs format 999.99
select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'yyyy/mm/dd hh24:mi') start_time,
to_char(END_TIME,'yyyy/mm/dd hh24:mi') end_time,
elapsed_seconds/3600 hrs
from V$RMAN_BACKUP_JOB_DETAILS
order by session_key ;


The output may resemble the one shown below:

SESSION_KEY INPUT_TYPE STATUS START_TIME END_TIME HRS
----------- ------------- --------- ---------------- ---------------- -------
2 CONTROLFILE FAILED 2007/07/17 01:14 2007/07/17 01:14 .00
6 DB FULL COMPLETED 2007/07/17 01:16 2007/07/17 01:18 .02
11 DB FULL COMPLETED 2007/07/17 01:29 2007/07/17 01:37 .13

SQL>
col ins format a10
col outs format a10
col time_taken_display format a20
select SESSION_KEY,
OPTIMIZED,
COMPRESSION_RATIO,
INPUT_BYTES_PER_SEC_DISPLAY ins,
OUTPUT_BYTES_PER_SEC_DISPLAY outs,
TIME_TAKEN_DISPLAY
from V$RMAN_BACKUP_JOB_DETAILS
order by session_key;

SESSION_KEY OPT COMPRESSION_RATIO INS OUTS TIME_TAKEN_DISPLAY
----------- --- ----------------- ---------- ---------- --------------------
2 NO 1 0.00K 0.00K 00:00:03
6 NO 1.3441441 9.12M 6.79M 00:01:29
11 NO 1 3.46M 0.00K 00:07:41

SQL> select * from V$RMAN_BACKUP_TYPE;

WEIGHT INPUT_TYPE
---------- -------------
1 BACKUPSET
2 SPFILE
3 CONTROLFILE
4 ARCHIVELOG
5 DATAFILE INCR
6 DATAFILE FULL
7 DB INCR
8 RECVR AREA
9 DB FULL

SQL>
select output
from v$rman_output
where session_key = 4
order by recid;

OUTPUT
--------------------------------------------------------------------------------
connected to target database: ORATST (DBID=709496429)


using target database control file instead of recovery catalog
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1 0 /oradisk1/oradata/ORATST/datafile/o1_mf_system_1zl13ds1_.dbf
2 0 /oradisk1/oradata/ORATST/datafile/o1_mf_undotbs1_1zl14557_.dbf
3 0 /oradisk1/oradata/ORATST/datafile/o1_mf_sysaux_1zl14gvs_.dbf
4 0 /oradisk1/oradata/ORATST/datafile/o1_mf_users_1zl150qk_.dbf


RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/product/10.2.0/dbs/snapcf_ORATST
1.f'; # default



new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored


RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1 0 /oradisk1/oradata/ORATST/datafile/o1_mf_system_1zl13ds1_.dbf
2 0 /oradisk1/oradata/ORATST/datafile/o1_mf_undotbs1_1zl14557_.dbf
3 0 /oradisk1/oradata/ORATST/datafile/o1_mf_sysaux_1zl14gvs_.dbf
4 0 /oradisk1/oradata/ORATST/datafile/o1_mf_users_1zl150qk_.dbf


allocated channel: d1
channel d1: sid=42 devtype=DISK


Starting backup at 17-JUL-07
channel d1: starting full datafile backupset
channel d1: specifying datafile(s) in backupset
including current control file in backupset
channel d1: starting piece 1 at 17-JUL-07
released channel: d1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on d1 channel at 07/17/2007 01:14:42
ORA-19504: failed to create file "/oradisk2/backups/ORATST/rman_ORATST_628132480
_01in12k0_1_1.ctf"

ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

No comments: