Monday, June 13, 2011

RMAN: Need recovery catalog for creating scripts in RMAN



When i try to create scripts in RMAN with out  Recovery catalog, RMAN is not allowing to create with it.
you need recovery catalog to create scripts in it.

$rman target / nocatalog

Recovery Manager: Release 11.2.0.2.0 - Production on Mon Jun 13 14:00:46 2011

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

connected to target database: OMNIX (DBID=3688465868)
using target database control file instead of recovery catalog

RMAN> create script b1{
2> allocate channel c1 DEVICE TYPE sbt;
3> BACKUP DATAFILE 10;
4> }

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of create script command at 06/13/2011 14:01:09
RMAN-06002: command not allowed when not connected to a recovery catalog

RMAN>


Now i am creating Recovery catalog with in the same user

CREATE A CATALOG FOR THE RMAN.

Step : 1  Create a DB by any name preferred as ‘catalog’
Step : 2   Create a Tablespace by name ´rman’ and allocate 500 MB space
Step : 3   Create a user name called rman and grant connect, resource and recovery_catalog_owner.
Step : 4  Put the Tnsnames of the target DB in the catalog server and put the catalog tnsnames in the Target server
Step : 5 In the catalog DB
$ Rman target sys/oracle catalog rman/rman @catalog
RMAN> create catalog, ( Only once )
RMAN> register database;
Step 6: When you connect to the catalog DB
$ Rman target sys/oracle  catalog rman/rman@catalog

 

Create a new database for RMAN – Recovery catalog database

Note: You can create a small database with minimal sizes of tablespaces and others, and you can name the database as CATDB for naming convention and to avoid the confusion between your production and rman databases.

Create a new tablespace in the new database (CATDB)



CREATE TABLESPACE rman
DATAFILE '/u02/app/oradata/rman/rman01.dbf' size 100m;

Create the Recovery Catalog Owner in the new database (OMNIX)

CREATE USER rman IDENTIFIED BY rman
DEFAULT TABLESPACE rman
QUOTA UNLIMITED ON rman;

Grant the necessary privileges to the schema owner

SQL> GRANT connect, resource, recovery_catalog_owner TO rman;

Here the role "RECOVERY_CATALOG_OWNER" provides the user with all privileges required to maintain and query the recovery catalog

Creating the Recovery Catalog

Connect to the database which will contain the catalog as the catalog owner. For example:
$ rman catalog rman/passwd@omnix
Recovery Manager: Release 11.2.0.2.0 - Production on Mon Jun 13 14:00:46 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to recovery catalog database
RMAN>

Run the CREATE CATALOG command to create the catalog

RMAN> CREATE CATALOG;

recovery catalog created

Registering a Database in the Recovery Catalog

Connect to the target database and recovery catalog database.

$ ORACLE_SID=OMNIX; export ORACLE_SID

$ rman target / catalog rman/rman



Recovery Manager: Release 11.2.0.2.0 - Production on Mon Jun 13 14:06:46 2011


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


connected to target database: OMNIX (DBID=3688465868)
connected to recovery catalog database


RMAN> REGISTER DATABASE;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

Make sure that the registration was successful by running REPORT SCHEMA:



RMAN> create script b{
2> allocate channel c1 DEVICE TYPE sbt;
3> BACKUP DATAFILE 10;
4> }

created script b

Please find the list of RECOVERY CATALOG views

Recovery Catalog ViewCorresponding V$ ViewCatalog View Describes ...
V$ARCHIVED_LOG
Archived and unarchived redo logs
V$BACKUP_DATAFILE
Control files in backup sets
V$BACKUP_CORRUPTION
Corrupt block ranges in datafile backups
V$BACKUP_DATAFILE
Datafiles in backup sets
V$BACKUP_FILES
RMAN backups and copies known to the repository.
V$BACKUP_PIECE
Backup pieces
V$BACKUP_REDOLOG
Archived redo logs in backup sets
V$BACKUP_SET
Backup sets for all incarnations of the database
V$BACKUP_SPFILE
Server parameter files in backups

Deprecated in favor of RC_RESYNC
V$DATAFILE_COPY
Control file copies on disk
V$COPY_CORRUPTION
Corrupt block ranges in datafile copies
V$DATABASE
Databases registered in the recovery catalog
V$DATABASE_BLOCK_CORRUPTION
Database blocks marked as corrupted in the most recent RMAN backup or copy
V$DATABASE_INCARNATION
Database incarnations registered in the recovery catalog
V$DATAFILE
Datafiles registered in the recovery catalog
V$DATAFILE_COPY
Datafile copies on disk
V$LOG_HISTORY
Online redo log history indicating when log switches occurred
V$OFFLINE_RANGE
Offline ranges for datafiles
V$PROXY_ARCHIVEDLOG
Archived log backups taken with the proxy copy functionality
V$PROXY_DATAFILE
Control file backups taken with the proxy copy functionality
V$PROXY_DATAFILE
Datafile backups that were taken using the proxy copy functionality
V$LOG and V$LOGFILE
Online redo logs for all incarnations of the database since the last catalog resynchronization
V$THREAD
All redo threads for all incarnations of the database since the last catalog resynchronization
n/a
Recovery catalog resynchronizations
V$RMAN_CONFIGURATION
RMAN configuration settings
V$RMAN_STATUS
Historical status information about RMAN operations.
n/a
Names of scripts stored in the recovery catalog
n/a
Contents of the scripts stored in the recovery catalog
V$TABLESPACE
All tablespaces registered in the recovery catalog, all dropped tablespaces, and tablespaces that belong to old incarnations

No comments:

Post a Comment