Steps:
—————-
At Catalog Server:-
—————-
1.Create catalog database
2.create one tablespace
3.create one user and grant appropriate
privileges to that user.
4.connect to catalog db and execute the following
command i.e;’Create catalog’ to create rman metadata tables.
7.configure tnsnames.ora
8.connect to target db through catalog db and register db into
catalog db.
9.configure rman configuration parameters and take the backup of target db.
———————————————
At Target Server
———————————————-
5.configure listener.ora
6.create password file
——————————————————
Creating catalog Database (At catalog server)
——————————————————-
Step:1
——-
$ps -ef|grep smon
$srvctl start database -d hrms
#mkdir -p /u02/app/oracle/oradata/
#chown -R oracle:oinstall /u02/app/oracle/oradata
#chmod -R 775 /u02/app/oracle/oradata
Now creating catalog database i.e;single instance database,
#xhost +
#su – oracle
$dbca
.oracle single instance
next
.create a database
next
next
Global database name : catdb
next
next
syspasword:racdba
next
.filesystem
next
.use common location for all data files
click on browse
/u02/app/oracle/oradata
next
.enable archiving
next
next
22% of memory
next
next
Finish
ok
Note:automatically we get tns entry
crms
crms1–>1 Instance
crms2–>2 instance
sqlplus rmaqnuser/rmanuser
SQL>select * from rc_database;
lnx01]$ps -ef|grep smon
$export ORACLE_SID=catdb
$sqlplus / as sysdba
SQL>select name from v$database;
SQL>select name from v$datafile;
step:2
——-
SQL>create tablespace rman_ts
datafile ‘/u02/app/oracle/oradata/catdb/rman_ts01.dbf’ size 120m autoextend on;
step:3
——
SQL>create user rmanuser identified by rmanuser default tablespace rman_ts;
SQL>grant connect,resource,recovery_catalog_owner to rmanuser;
SQL>conn rmanuser/rmanuser
SQL>show user
SQL>select * from tab; ( it will be zero count)
step:4
——-
SQL>host rman catalog rmanuser/rmanuser (to connect to rman) or
$rman catalog rmanuser/rmanuser
RMAN>create catalog;
RMAN>exit
SQL>select count * from tab; (now some tables we can see)
—————–
At Target Server
—————–
step:5
——
$cd $ORACLE_HOME/network/admin
$vi listener.ora
—–
step:6
——
$cd $ORACLE_HOME/dbs
$orapwd file=orapwhrms1 password=racdba entries=3 force=y
—————————-
At catalog Server
————————–
Step:7
——
$cd $ORACLE_HOME/network/admin
admin]$ ls
$vi tnsnames.ora
——–
:wq
(here we have all three entreis i.e;HRMS,HRMS1,HRMS2)
step:8
——
$export ORACLE_SID=catdb
$rman catalog rmanuser/rmanuser target sys/[email protected]
RMAN>list incarnation; (to view existing registred db in 10g)
RMAN>register database;
RMAN>list db_unique_name all; (in 11g to view registered db)
RMAN>host ‘clear’;
RMAN>show all;
step:9
——
SQL> select * from v$rman_configuration;
RMAN>CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
RMAN>show all;
RMAN>spool log to rman.log (all commands after this will be recorded)
RMAN>spool off;
RMAN>host ‘pwd’;
lnx01]vi rman.log
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE 2 AUTOBACKUP ON;
CONFIGURE CHANNEL 1 DEVICE TYPE DISK CONNECT ‘sys/[email protected]’;
CONFIGURE CHANNEL 2 DEVICE TYPE DISK CONNECT ‘sys/[email protected]’;
:wq!
$rman catalog rmanuser/rmanuser target sys/[email protected]
RMAN>@rman.log
RMAN>show all;
RMAN>BACKUP DATABASE PLUS ARCHIVE LOG;
(it will store backupset in FRA)
————————————————————————————
SCENARIO
———————————————————————————–
1.Loss of Full database
———————–
RMAN>report schema; (location of datafiles)
$export ORACLE_SID=+ASM1
ASMCMD>ls
ASMCMD>rm *.ctl
yes>error (if your storage is ASM controlfile CANNNOT BE Removed)
$srvctl stop database -d hrms
ASMCMD>rm *.dbf *.ctl *.log
yes
ASMCMD>ls
ASMCMD>(no crd files)
ASMCMD>exit
lnx01>$export ORACLE_SID=hrms1
$sqlplus / as sysdba
SQL>startup nomount
SQL>exit
lnx01>$export ORACLE_SID=catdb
$rman catalog rmanuser/rmanuser target sys/[email protected]
(error)
$cd $ORACLE_HOME/network/admin
$vi tnsnames.ora
HRMS1=
—-
———-
——–
(UR=A)
)
:wq
$rman catalog rmanuser/rmanuser target sys/[email protected]
RMAN>restore controlfile;
RMAN>alter database mount;
RMAN>restore database;
RMAN>recover database;
RMAN>sql ‘alter database open resetlogs’;
RMAN>exit
RMAN>exit
$export ORACLE_SID=hrms1
$sqlplus / as sysdba
SQL>shut immediate
SQL>exit
lnx01]$ srvctl start database -d hrms
(It will start both instances and database)
lnx01]$ srvctl status database -d hrms
———————————————————-
2.Loss of non-system datafile
————————————————————-
# su – oracle
lnx01]$ srvctl stop database -d hrms
lnx01]$ ASMCMD
ASMCMD]rm users01.dbf
lnx01] $ export ORACLE_SID=hrms1
$ sqlplus / as sysdba
$ ps -ef|grep smon
$ srvctl start database -d hrms
SQL>startup mount
SQL>select * from v$recover_file;
SQL>alter database datafile 4 offline;
SQL>shut immediate;
lnx01]$ srvctl start database -d hrms
$ srvctl status database -d hrms
$rman catalog rmanuser/rmanuser target sys/[email protected]
RMAN>restore datafile 4;
RMAN>recover datafile 4;
RMAN>sql ‘alter database datafile 4 online’;
ASMCMD>ls
(we can see datafile 4 now in the list)
————————————————————————-
Creating Backup Script
————————————————————————-
lnx01]$export ORACLE_SID=+ASM1
$ASMCMD
ASMCMD>ls
>cd asm_dg_fra
>cd hrms
>ls
$ vi rmanfulldbbkp.rcv
run{
allocate channel c1 device type disk connect ‘sys/[email protected]’;
allocate channel c2 device type disk connect ‘sys/[email protected]’;
allocate channel c3 device type disk connect ‘sys/[email protected]’;
allocate channel c4 device type disk connect ‘sys/[email protected]’;
sql ‘alter system archive log current’;
backup database plus archive log delete all input;
sql ‘alter system archive log current’;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
Note:With respect to rman configuration channel priority goes to run blocks.
$export ORACLE_SID=catdb
$rman catalog rmanuser/rmanuser target sys/[email protected]
RMAN>@rmanfulldbbkp.rcv
$ASMCMD
AMCMD>ls
>cd asm_dg_fra
>cd hrms
>ls
>cd archivelog
>cd 202….
>ls
>cd
>cd asm_dg_data
>ls
>cd hrms
>ls