RMAN Setup
RMAN Setup
world
-- the following are required only if you want to configure RMAN first time on a db
and create a new recovery catalog
-----------------------------------------------------
CREATE TABLESPACE "TOOLS" DATAFILE
'/u02/oradata/itnbheem/TOOLS_01.dbf' SIZE 200M REUSE
NOLOGGING ONLINE PERMANENT BLOCKSIZE 8192
EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO;
RMAN>CREATE CATALOG;
recovery catalog created
RMAN> exit
RMAN>REGISTER DATABASE;
RMAN>
$rman target /
--to unregister a db using db_key and dbid (get these from rman.rc_database)
EXECUTE dbms_rcvcat.unregisterdatabase(1,475939196);
--to upgrade:
RMAN> upgrade catalog;
select * from
(select * from rc_backup_set
order by completion_time desc)
where rownum < 31;
Commands:
SQL 'ALTER DATABASE MOUNT'
SQL 'ALTER DATABASE OPEN'
CREATE CATALOG
LIST BACKUP
LIST BACKUP SUMMARY
LIST COPY
LIST INCARNATION OF DATABASE
REGISTER DATABASE
REPORT SCHEMA
REPORT NEED BACKUP INCREMENTAL 3 DATABASE
REPORT NEED BACKUP DAYS 3 DATABASE
REPORT NEED BACKUP DAYS 3 TABLESPACE SYSTEM
REPORT NEED BACKUP REDUNDANCY 3
REPORT UNRECOVERABLE
REPORT OBSOLETE
RESET DATABASE
RESYNC CATALOG
SHOW ALL
SHUTDOWN
STARTUP
VALIDATE
VIEW SCHEMA
SET UNTIL TIME='SYSDATE-1';
RESTORE DATABASE VALIDATE; # to get the file names involved in restore
#Restore Validation confirms that a restore could be run, by confirming that all
database files exist and are
#free of physical and logical corruption, this does not generate any output.
run
{
set until time='sysdate-1';
restore database validate;
}
cursor cFilesList is
select handle from rman.rc_backup_piece
where (trunc(completion_time) >= compl_time and trunc(completion_time) <=
compl_time+1)
and (tag='BACKUP_DB_LEVEL_0' or tag is null);
begin
select max(trunc(completion_time)) into compl_time
from rman.rc_backup_piece
where tag='BACKUP_DB_LEVEL_0';
UTL_FILE.FCLOSE(vOutFileHandle);
end;
##################
######
##steps for restore
##do these steps on the new host
############
--steps to prepare the auxiliary database instance on a new host
--all of the following steps are performaed on auxiliary host only
----------------------------------------------------------------
1. Create an Oracle Password File for the Auxiliary Instance
cd $ORACLE_HOME/dbs
orapwd file=$ORACLE_HOME/dbs/orapw password=firesys entries=15 force=y ignorecase=y
---
---
##########################
#to check and repair block corruption using RMAN
##
run {
##########
UNREGISTER COMMANDS:
DB_KEY DB_ID
---------- ----------
1 1487421514
1 row selected.
SQL>
--------------------------------------------------------------------
Check whether backup pieces, proxy copies, or disk copies still exist.
This fixes any problems too.
Examples:
##To run RMAN command from a command file and have the rman output go to a logfile,
call it like this: