Wednesday, May 2, 2018

Configure an RMAN catalog for backup of an Oracle database


Hai, this article describes the procedure for setting up an RMAN catalog for backing up an Oracle database in Linux Env.

Target database and host details:
[oracle@rac1 ~]$
[oracle@rac1 ~]$
[oracle@rac1 ~]$ . prod.env
[oracle@rac1 ~]$
[oracle@rac1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 02-MAY-2018 15:22:54

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.dell.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                02-MAY-2018 15:22:46
Uptime                    0 days 0 hr. 0 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.dell.com)(PORT=1521)))
Services Summary...
Service "PROD" has 1 instance(s).
  Instance "PROD", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac1 ~]$
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 2 07:33:29 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

SQL>
SQL> col HOST_NAME for a15;
SQL>
SQL> select INSTANCE_NAME, STATUS,VERSION,host_name from v$instance;

INSTANCE_NAME    STATUS       VERSION           HOST_NAME
---------------- ------------ ----------------- ---------------
PROD             OPEN         11.2.0.4.0        rac1.dell.com

SQL>


Catalog database details:
[oracle@rac3 ~]$ cat catprod
export ORACLE_SID=CATPROD
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib/usr/lib; export LD_LIBRARY_PATH
[oracle@rac3 ~]$
[oracle@rac3 ~]$ tnsping PROD

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 01-MAY-2018 15:29:20

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.dell.com)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = PROD)))
OK (10 msec)
[oracle@rac3 ~]$
[oracle@rac3 ~]$
[oracle@rac3 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 1 15:25:46 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> col HOST_NAME for a15;
SQL>
SQL> select INSTANCE_NAME, STATUS,VERSION,host_name from v$instance;

INSTANCE_NAME    STATUS       VERSION           HOST_NAME
---------------- ------------ ----------------- ---------------
CATPROD          OPEN         11.2.0.4.0        rac3.dell.com

SQL>
SQL>
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/CATPROD/arch
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence           2
SQL>

SQL>
SQL> create tablespace rmants datafile '/u01/app/oracle/CATPROD/rmants.dbf' size 200m;

Tablespace created.

SQL>
SQL>
SQL>
SQL> grant connect,resource,recovery_catalog_owner to rman identified by rman;

Grant succeeded.

SQL>
SQL>
SQL> alter user rman default tablespace rmants;

User altered.

SQL>
SQL>
SQL> conn rman/rman
Connected.
SQL>
SQL> select * from tab;

no rows selected

SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rac3 ~]$
[oracle@rac3 ~]$
[oracle@rac3 ~]$
[oracle@rac3 ~]$ rman catalog rman/rman

Recovery Manager: Release 11.2.0.4.0 - Production on Tue May 1 15:43:09 2018

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

connected to recovery catalog database

RMAN> create catalog;

recovery catalog created

RMAN>

RMAN>

RMAN> exit


Recovery Manager complete.
[oracle@rac3 ~]$
[oracle@rac3 ~]$
[oracle@rac3 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 1 15:43:39 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL>
SQL> conn rman/rman
Connected.
SQL>
SQL>
SQL> select count(*) from tab;

  COUNT(*)
----------
       142

SQL>
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rac3 ~]$
[oracle@rac3 ~]$
[oracle@rac3 ~]$ rman catalog rman/rman target sys/oracle@PROD

Recovery Manager: Release 11.2.0.4.0 - Production on Tue May 1 15:46:31 2018

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

connected to target database: PROD (DBID=386830696)
connected to recovery catalog database

RMAN>

RMAN> list db_unique_name all;


RMAN>

RMAN> register database;

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

RMAN>

RMAN> list db_unique_name all;


List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
1       PROD     386830696        PRIMARY          PROD

RMAN>

RMAN>

RMAN> show all;

RMAN configuration parameters for database with db_unique_name PROD 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 COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_PROD.f'; # default

RMAN>

RMAN> spool log to show.log;
RMAN> show all;
RMAN> exit
[oracle@rac3 ~]$ ls
catprod  show.log
[oracle@rac3 ~]$
[oracle@rac3 ~]$ vi show.log
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/PROD/RMAN_CAT_BKP/%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/u01/app/oracle/PROD/RMAN_CAT_BKP/%U.bkp';
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 COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/PROD/RMAN_CAT_BKP/snapcf_PROD.f';
[oracle@rac3 ~]$


[oracle@rac1 ~]$ hostname
rac1.dell.com
[oracle@rac1 ~]$
[oracle@rac1 ~]$ mkdir –p /u01/app/oracle/PROD/RMAN_CAT_BKP


[oracle@rac3 ~]$
[oracle@rac3 ~]$
[oracle@rac3 ~]$ rman catalog rman/rman target sys/oracle@PROD

Recovery Manager: Release 11.2.0.4.0 - Production on Tue May 1 15:56:04 2018

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

connected to target database: PROD (DBID=386830696)
connected to recovery catalog database

RMAN>

RMAN> @show.log

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;



RMAN>

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     /u01/app/oracle/PROD/system01.dbf
2    0     /u01/app/oracle/PROD/sysaux01.dbf
3    0     /u01/app/oracle/PROD/undotbs01.dbf
4    0     /u01/app/oracle/PROD/users01.dbf

RMAN>

RMAN> backup database plus archivelog;


Starting backup at 01-MAY-18
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=42 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2 RECID=1 STAMP=974997734
channel ORA_DISK_1: starting piece 1 at 01-MAY-18
channel ORA_DISK_1: finished piece 1 at 01-MAY-18
piece handle=/u01/app/oracle/PROD/RMAN_CAT_BKP/01t1qi77_1_1.bkp tag=TAG20180501T164215 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 01-MAY-18

Starting backup at 01-MAY-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/PROD/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/PROD/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/PROD/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/PROD/users01.dbf
channel ORA_DISK_1: starting piece 1 at 01-MAY-18
channel ORA_DISK_1: finished piece 1 at 01-MAY-18
piece handle=/u01/app/oracle/PROD/RMAN_CAT_BKP/02t1qi79_1_1.bkp tag=TAG20180501T164216 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 01-MAY-18

Starting backup at 01-MAY-18
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=3 RECID=2 STAMP=974997762
channel ORA_DISK_1: starting piece 1 at 01-MAY-18
channel ORA_DISK_1: finished piece 1 at 01-MAY-18
piece handle=/u01/app/oracle/PROD/RMAN_CAT_BKP/03t1qi83_1_1.bkp tag=TAG20180501T164243 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 01-MAY-18

Starting Control File Autobackup at 01-MAY-18
piece handle=/u01/app/oracle/PROD/RMAN_CAT_BKP/c-386830696-20180501-00 comment=NONE
Finished Control File Autobackup at 01-MAY-18

RMAN>

RMAN>

RMAN>

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
---- ----- -----------------------------------------------------

RMAN>

================================================================================================================
Loss of Control file:
[oracle@rac1 ~]$
[oracle@rac1 ~]$ . prod.env
[oracle@rac1 ~]$
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 2 07:33:29 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL>
SQL> col HOST_NAME for a15;
SQL>
SQL> select INSTANCE_NAME, STATUS,VERSION,host_name from v$instance;

INSTANCE_NAME    STATUS       VERSION           HOST_NAME
---------------- ------------ ----------------- ---------------
PROD             OPEN         11.2.0.4.0        rac1.dell.com

SQL>
SQL>
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/PROD/control01.ctl
/u01/app/oracle/PROD/control02.ctl

SQL>

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rac1 ~]$
[oracle@rac1 ~]$
[oracle@rac1 ~]$ cd $ORACLE_BASE/PROD
[oracle@rac1 PROD]$ ls
arch           redo01.log  RMAN_CAT_BKP  temp01.dbf
control01.ctl  redo02.log  sysaux01.dbf  undotbs01.dbf
control02.ctl  redo03.log  system01.dbf  users01.dbf
[oracle@rac1 PROD]$
[oracle@rac1 PROD]$
[oracle@rac1 PROD]$ rm -rf control0*
[oracle@rac1 PROD]$
[oracle@rac1 PROD]$ ls
arch        redo02.log  RMAN_CAT_BKP  system01.dbf  undotbs01.dbf
redo01.log  redo03.log  sysaux01.dbf  temp01.dbf    users01.dbf
[oracle@rac1 PROD]$
[oracle@rac1 PROD]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 2 07:41:31 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL> shut
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/PROD/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL>
SQL>
SQL> shut abort
ORACLE instance shut down.
SQL>
SQL> startup nomount
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size                  2253784 bytes
Variable Size            1006636072 bytes
Database Buffers          637534208 bytes
Redo Buffers                7094272 bytes
SQL>

[oracle@rac3 ~]$
[oracle@rac3 ~]$ rman catalog rman/rman target sys/oracle@PROD

Recovery Manager: Release 11.2.0.4.0 - Production on Wed May 2 07:42:15 2018

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

connected to target database: PROD (not mounted)
connected to recovery catalog database

RMAN>

RMAN> list db_unique_name all;


List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
1       PROD     386830696        PRIMARY          PROD

RMAN>

RMAN>

RMAN> restore controlfile;

Starting restore at 02-MAY-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/PROD/RMAN_CAT_BKP/c-386830696-20180501-00
channel ORA_DISK_1: piece handle=/u01/app/oracle/PROD/RMAN_CAT_BKP/c-386830696-20180501-00 tag=TAG20180501T164244
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/PROD/control01.ctl
output file name=/u01/app/oracle/PROD/control02.ctl
Finished restore at 02-MAY-18

RMAN>

RMAN> mount database;

database mounted
released channel: ORA_DISK_1

RMAN>

RMAN> restore database;

Starting restore at 02-MAY-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/PROD/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/PROD/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/PROD/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/PROD/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/PROD/RMAN_CAT_BKP/02t1qi79_1_1.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/PROD/RMAN_CAT_BKP/02t1qi79_1_1.bkp tag=TAG20180501T164216
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 02-MAY-18

RMAN>

RMAN>

RMAN> recover database;

Starting recover at 02-MAY-18
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 3 is already on disk as file /u01/app/oracle/PROD/redo03.log
archived log for thread 1 with sequence 4 is already on disk as file /u01/app/oracle/PROD/redo01.log
archived log for thread 1 with sequence 5 is already on disk as file /u01/app/oracle/PROD/redo02.log
archived log file name=/u01/app/oracle/PROD/redo03.log thread=1 sequence=3
archived log file name=/u01/app/oracle/PROD/redo01.log thread=1 sequence=4
archived log file name=/u01/app/oracle/PROD/redo02.log thread=1 sequence=5
media recovery complete, elapsed time: 00:00:02
Finished recover at 02-MAY-18

RMAN>

RMAN>

RMAN> sql 'alter database open resetlogs';

sql statement: alter database open resetlogs
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN>

RMAN>

RMAN> exit;


Recovery Manager complete.
[oracle@rac3 ~]$

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 2 07:50:29 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL>
SQL> col HOST_NAME for a15;
SQL>
SQL> select INSTANCE_NAME, STATUS,VERSION,host_name from v$instance;            
INSTANCE_NAME    STATUS       VERSION           HOST_NAME
---------------- ------------ ----------------- ---------------
PROD             OPEN         11.2.0.4.0        rac1.dell.com

SQL>
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/PROD/control01.ctl
/u01/app/oracle/PROD/control02.ctl

SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rac1 ~]$

================================================================================================================
Loss of Datafile:
[oracle@rac1 ~]$
[oracle@rac1 ~]$
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 2 07:54:00 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL> col HOST_NAME for a15;
SQL>
SQL> select INSTANCE_NAME, STATUS,VERSION,host_name from v$instance;

INSTANCE_NAME    STATUS       VERSION           HOST_NAME
---------------- ------------ ----------------- ---------------
PROD             OPEN         11.2.0.4.0        rac1.dell.com

SQL>
SQL>
SQL> col TABLESPACE_NAME for a20;
SQL> col FILE_NAME for a40;
SQL> select TABLESPACE_NAME, FILE_NAME,STATUS from dba_data_files;

TABLESPACE_NAME      FILE_NAME                                STATUS
-------------------- ---------------------------------------- ---------
USERS                /u01/app/oracle/PROD/users01.dbf         AVAILABLE
UNDOTBS1             /u01/app/oracle/PROD/undotbs01.dbf       AVAILABLE
SYSAUX               /u01/app/oracle/PROD/sysaux01.dbf        AVAILABLE
SYSTEM               /u01/app/oracle/PROD/system01.dbf        AVAILABLE

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rac1 ~]$
[oracle@rac1 ~]$
[oracle@rac1 ~]$
[oracle@rac1 ~]$ cd $ORACLE_BASE/PROD
[oracle@rac1 PROD]$ ls
arch           redo01.log  RMAN_CAT_BKP  temp01.dbf
control01.ctl  redo02.log  sysaux01.dbf  undotbs01.dbf
control02.ctl  redo03.log  system01.dbf  users01.dbf
[oracle@rac1 PROD]$
[oracle@rac1 PROD]$
[oracle@rac1 PROD]$ rm -rf system01.dbf
[oracle@rac1 PROD]$
[oracle@rac1 PROD]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 2 07:57:58 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL> shut
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/PROD/system01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL>
SQL> shut abort
ORACLE instance shut down.
SQL>
SQL> startup
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size                  2253784 bytes
Variable Size            1006636072 bytes
Database Buffers          637534208 bytes
Redo Buffers                7094272 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/PROD/system01.dbf'


SQL>

[oracle@rac3 ~]$
[oracle@rac3 ~]$ rman catalog rman/rman target sys/oracle@PROD

Recovery Manager: Release 11.2.0.4.0 - Production on Wed May 2 07:59:08 2018

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

connected to target database: PROD (DBID=386830696, not open)
connected to recovery catalog database

RMAN>

RMAN>

RMAN> sql 'alter database datafile 1 offline';

sql statement: alter database datafile 1 offline

RMAN>

RMAN> restore datafile 1;

Starting restore at 02-MAY-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=22 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/PROD/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/PROD/RMAN_CAT_BKP/02t1qi79_1_1.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/PROD/RMAN_CAT_BKP/02t1qi79_1_1.bkp tag=TAG20180501T164216
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 02-MAY-18

RMAN>

RMAN>

RMAN> recover datafile 1;

Starting recover at 02-MAY-18
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 3 is already on disk as file /u01/app/oracle/PROD/arch/1_3_974992360.dbf
archived log for thread 1 with sequence 4 is already on disk as file /u01/app/oracle/PROD/arch/1_4_974992360.dbf
archived log for thread 1 with sequence 5 is already on disk as file /u01/app/oracle/PROD/arch/1_5_974992360.dbf
archived log file name=/u01/app/oracle/PROD/arch/1_3_974992360.dbf thread=1 sequence=3
archived log file name=/u01/app/oracle/PROD/arch/1_4_974992360.dbf thread=1 sequence=4
archived log file name=/u01/app/oracle/PROD/arch/1_5_974992360.dbf thread=1 sequence=5
media recovery complete, elapsed time: 00:00:01
Finished recover at 02-MAY-18

RMAN>

RMAN> sql 'alter database datafile 1 online';

sql statement: alter database datafile 1 online

RMAN>

RMAN>


SQL> col HOST_NAME for a15;
SQL>
SQL> select INSTANCE_NAME, STATUS,VERSION,host_name from v$instance;           
INSTANCE_NAME    STATUS       VERSION           HOST_NAME
---------------- ------------ ----------------- ---------------
PROD             MOUNTED      11.2.0.4.0        rac1.dell.com

SQL>
SQL> alter database open;

Database altered.

SQL>
SQL> select INSTANCE_NAME, STATUS,VERSION,host_name from v$instance;

INSTANCE_NAME    STATUS       VERSION           HOST_NAME
---------------- ------------ ----------------- ---------------
PROD             OPEN         11.2.0.4.0        rac1.dell.com

SQL>

================================================================================================================
Loss of Redo Logfile:

[oracle@rac1 PROD]$