Thursday 22 February 2018

RAC Database Restore and Recovery From rman backup step by step



Real-Time Scenarios

Production database was completely crashed, We have Valid RMAN Full and  archive log backups on Tape but redo log file is not accessible

Note 
If you have a Rman backup and archive log backups, and if you can access redo log files, you can return to the last moment.
If you can recover the redologs, you can do a complete recovery. Otherwise it is incomplete recovery. 
This also means there is data loss. Because all processes are not recovered.

1) Stop application
2) Comment out scheduled backup of on Both Node (LWAIPT01 And 02 -Oracle RAC DB) for 18:00 on Saturday
3) Take a full backup of current database on tape (Crashed) (Friday Evening around 18:25 UKT)

Backup of existing crashed Database as below

RMAN> connect target sys/Lwaipt01_sys@database
connected to target database: database (DBID=1127659667)
RMAN> connect catalog database/rman_database@TAF_RCATNET
run
{
allocate channel ch1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)' CONNECT 'sys/Lwaipt01_sys@database1' maxpiecesize 50G;
allocate channel ch2 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)' CONNECT 'sys/Lwaipt01_sys@database1' maxpiecesize 50G;
allocate channel ch3 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)' CONNECT 'sys/Lwaipt01_sys@database2' maxpiecesize 50G;
allocate channel ch4 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)' CONNECT 'sys/Lwaipt01_sys@database2' maxpiecesize 50G;
backup full tag "WEEKLY_FULL_DB_BACKUP" filesperset 5 format 'weekly_full_%d_%u_%s_%p' database;
backup current controlfile tag "DAILY_INC_CTL_BACKUP" format 'ctl_%d_%s_%p';
backup archivelog all delete input format 'arc_c1_%d_%u_%s_%p' tag "ARCH_BACKUP";
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 60 DAYS;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}

4) Take the backup of controle file for existing crashed Database as below
 
alter database backup controlfile to trace

Alter database backup controlfile to trace as '/path/filename.trc';

Alter database backup controlfile to trace as '/backup/asfdev/asfdev_control.trc';

Alter database backup controlfile to trace as '/tmp/asfppt_control.trc';

5) Validate RMAN Full Backup which was taken in Weekend on Tape (started on 28th June and finished on 30thJune)

RMAN> connect target sys/Lwaipt01_sys@database
connected to target database: database (DBID=1127659667)
RMAN> connect catalog database/rman_database@TAF_RCATNET
connected to recovery catalog database
RMAN> run {

set until time "to_date ('Jul 01 2014 14:31:00' , 'Mon DD YYYY HH24:MI:SS')";
allocate channel ch1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
allocate channel ch2 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
allocate channel ch3 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
allocate channel ch4 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
restore database preview;
}2> 3> 4> 5> 6> 7> 8> 9> 10>

6) Validate new backup (started on 11th July and finished on 13thJuly)

7)note down all the media ID from RMAN for old RMAN Backup

 select distinct media from v$backup_piece where trunc(start_time) in ('28-JUN-2014','29-JUN-2014','30-JUN-2014','01-JUN-2014') order by 1;

8) Note down all the media ID from RMAN for New Backup
9) Note down all archive sequence and corresponding scn no.

SQL> set time on
05:48:34 SQL> ALTER SESSION SET nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
Session altered.
06:29:56 SQL> col next_change# format 999999999999999;
                         col first_change# format 999999999999999;

                         select sequence#, to_date(first_time,'DD-MON-YYYY HH24:MI:SS') first_time,
                                                  first_change#,
                                                  to_date(next_time,'DD-MON-YYYY HH24:MI:SS') next_time,
                                                  next_change# from v$archived_log
                         where completion_time between to_date('JUN-28-2014','MON-DD-YYYY') and to_date('JUL-01-2014','MON-DD-YYYY')

10)Generate text file (includes all DB components and characters))
10 b) Backup of Current Archive log which residing on server

connect target sys/Lwaipt01_sys@database
connect catalog database/rman_database@TAF_RCATNET
run
{

allocate channel ch1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
sql 'alter system archive log current';
backup archivelog all;
release channel ch1;

}

Implementation 


1) Stop Database &  listener and dropped the Production Crashed DB on LWAIPT01/02  
  srvctl stop database -d database -o immediate
 lsnrctl stop listner  
 drop Database
export ORACLE_SID=database1
$ sqlplus "/ as sysdba"

SQL> STARTUP MOUNT RESTRICT;
SQL> DROP DATABASE;

it will take 30 min
eg
Deleted Oracle managed file +DATA_DG01/database/datafile/system.284.709540449
Mon Jul 14 19:04:14 2014
Deleted Oracle managed file +DATA_DG01/database/datafile/undotbs1.283.709540961
Deleted Oracle managed file +DATA_DG01/database/datafile/sysaux.327.709533949
Deleted Oracle managed file +DATA_DG01/database/datafile/users.272.709542017
Deleted Oracle managed file +DATA_DG01/database/datafile/undotbs2.311.709536351
Deleted Oracle managed file +DATA_DG01/database/datafile/tivolimon.312.709535929
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.271.709542419
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_ctl.323.709534449
Mon Jul 14 19:04:25 2014
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live.307.709536915
Deleted Oracle managed file +DATA_DG01/database/datafile/nr_netreveal.319.709534985
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_main.310.709536357
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_system.270.709542423
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live.306.709536919
Mon Jul 14 19:04:38 2014
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_xmldocs.282.709540969
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live.334.709533295
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live.287.709540435
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.330.709533935
Mon Jul 14 19:04:51 2014
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.326.709534435
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.322.709534973
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.318.709535447
Mon Jul 14 19:05:01 2014
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.278.709541587
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.315.709535917
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.275.709542001
Mon Jul 14 19:05:12 2014
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.346.709530917
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_live_audit.303.709537579
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_system.300.709538195
Deleted Oracle managed file +DATA_DG01/database/datafile/nvm_system.343.709531447
stdin 
 
3) start the database in No mount stage 
  Startup nomount

4) Disable cluster and put the database in no archive log mode

SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=spfile sid='*';

System altered.
   

5)Restore control file from auto backup and mount database

RMAN> connect target /
connected to target database: database (not mounted)
RMAN> connect catalog database/rman_database@TAF_RCATNET
connected to recovery catalog database

RMAN> SET DBID 1127659667
executing command: SET DBID
database name is "database" and DBID is 1127659667

RMAN> run
{
set until time "to_date ('Jul 01 2014 14:31:00' , 'Mon DD YYYY HH24:MI:SS')";
allocate channel ch1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
RESTORE CONTROLFILE FROM AUTOBACKUP;
release channel ch1;
}2> 3> 4> 5> 6> 7>

executing command: SET until clause
allocated channel: ch1
channel ch1: sid=537 devtype=SBT_TAPE
channel ch1: Data Protection for Oracle: version 5.5.2.1
Starting restore at 14-JUL-14
channel ch1: looking for autobackup on day: 20140701
channel ch1: autobackup found: c-1127659667-20140701-13
channel ch1: control file restore from autobackup complete
output filename=+DATA_DG01/database/controlfile/current.263.709530565
Finished restore at 14-JUL-14

released channel: ch1

RMAN> sql 'alter database mount';

sql statement: alter database mount

[lwaipt01:oracle:/usr/app/oracle/products/10.2.0.4/db/dbs:] cat RESTORE_database-14072014.sh
rman cmdfile=/usr/app/oracle/products/10.2.0.4/db/dbs/RESTORE_database-14072014.rcv log=/usr/app/oracle/products/10.2.0.4/db/dbs/RESTORE_database-14072014.log
[lwaipt01:oracle:/usr/app/oracle/products/10.2.0.4/db/dbs:] cat RESTORE_database-14072014.rcv


6) Restore and Recover Database from Weekend RMAN Full Backup which was taken on tape (From Sunday Backup)

connect target sys/Lwaipt01_sys@database
connect catalog database/rman_database@TAF_RCATNET
run
{
set until time "to_date ('Jul 01 2014 14:31:00' , 'Mon DD YYYY HH24:MI:SS')";
allocate channel ch1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
allocate channel ch2 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
allocate channel ch3 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
allocate channel ch4 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
RESTORE DATABASE;
RECOVER DATABASE;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}

7) Monitor progress

cat alert_database1.log|grep "Full restore"|wc -l

[lwaipt01:oracle:/usr/app/oracle/products/10.2.0.4/db/dbs:]

8) start the database after recovery in resetlog mode

alter database open resetlog mode

9) Enable cluster 

ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=spfile sid='*';

10) put the Database in archive mode and add  tempfile

need to add temp file.take scipt from controlfile trace backup
18>
connected to target database: database (DBID=1127659667, not open)
connected to recovery catalog database
executing command: SET until clause
SQL> alter trigger NAMECHECK_BEFORE_DDL_DB_TRG disable;
Trigger altered.


If necessary, add new members to the redo log groups:
  
  SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 4 '+DATA' SIZE 500m;
  SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 5 '+DATA' SIZE 500m;
  SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 6 '+DATA' SIZE 500m;
  SQL> ALTER DATABASE ADD LOGFILE MEMBER '+RECO' TO GROUP 4;
  SQL> ALTER DATABASE ADD LOGFILE MEMBER '+RECO' TO GROUP 5;
  SQL> ALTER DATABASE ADD LOGFILE MEMBER '+RECO' TO GROUP 6;

SQL>
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG02/database/tempfile/temp01.dbf'
     SIZE 30000M REUSE AUTOEXTEND OFF;  2

Tablespace altered.

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG02/database/tempfile/temp.303.709934103'
     SIZE 20000M REUSE AUTOEXTEND OFF;  2
ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG02/database/tempfile/temp.303.709934103'
*
ERROR at line 1:
ORA-01276: Cannot add file +DATA_DG02/database/tempfile/temp.303.709934103.
File has an Oracle Managed Files file name.


SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG02/database/tempfile/temp02.dbf'
     SIZE 20000M REUSE AUTOEXTEND OFF;  2

Tablespace altered.

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG01/database/tempfile/temp03.dbf'
     SIZE 6534M REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;  2

Tablespace altered.

SQL> alter trigger NAMECHECK_BEFORE_DDL_DB_TRG enable;

Trigger altered.

SQL>

11) start the listener on both node

srvctl start listener -n lwaipt01
srvctl start listener -n lwaipt02

12) Health check (Verification)

select name, open_mode from v$database;
srvctl config database -d compdb
crsctl status resource -t
crs_stat -t

Name           Type           Target    State     Host
------------------------------------------------------------
ora....D1.inst application    ONLINE    ONLINE    lwaipt01
ora....D2.inst application    ONLINE    ONLINE    lwaipt02
ora....OD1.srv application    ONLINE    UNKNOWN   lwaipt01
ora....OD2.srv application    ONLINE    ONLINE    lwaipt02
ora....PROD.cs application    ONLINE    ONLINE    lwaipt02
ora.database.db application    ONLINE    ONLINE    lwaipt01
ora....T1.inst application    ONLINE    ONLINE    lwaipt01
ora....T2.inst application    ONLINE    ONLINE    lwaipt02
ora....ET1.srv application    ONLINE    ONLINE    lwaipt01
ora....ET2.srv application    ONLINE    ONLINE    lwaipt02
ora....TNET.cs application    ONLINE    ONLINE    lwaipt02
ora.RCATNET.db application    ONLINE    ONLINE    lwaipt01
ora....SM1.asm application    ONLINE    ONLINE    lwaipt01
ora....01.lsnr application    ONLINE    ONLINE    lwaipt01
ora....t01.gsd application    ONLINE    ONLINE    lwaipt01
ora....t01.ons application    ONLINE    OFFLINE
ora....t01.vip application    ONLINE    ONLINE    lwaipt01
ora....SM2.asm application    ONLINE    ONLINE    lwaipt02
ora....02.lsnr application    ONLINE    ONLINE    lwaipt02
ora....t02.gsd application    ONLINE    ONLINE    lwaipt02
ora....t02.ons application    ONLINE    ONLINE    lwaipt02
ora....t02.vip application    ONLINE    ONLINE    lwaipt02

RMAN> connect target sys/Lwaipt01_sys@database
connected to target database: database (DBID=1127659667)
RMAN> connect catalog database/rman_database@TAF_RCATNET
RMAN>  LIST INCARNATION OF DATABASE database
RMAN> RESET DATABASE;

Note

New incarnation of database will be registered in recovery catalog

13) Starting full resync of recovery catalog

full resync complete

Purpose

To reset the target database in the RMAN repository, which means to do either of the following actions:

    Inform RMAN that the SQL statement ALTER DATABASE OPEN RESETLOGS has been executed and that a new incarnation of the target database has been created. Note that if you run the RMAN command ALTER DATABASE OPEN RESETLOGS (not the SQL statement with the same keywords), then RMAN resets the target database automatically so that you do not have to run RESET DATABASE. By resetting the database, RMAN considers the new incarnation as the current incarnation of the database.
    To reset the database to a previous incarnation. Typically, you would reset the incarnation when performing incomplete recovery to a point before a RESETLOGS operation, or when attempting to undo the affects of a RESETLOGS by restoring backups taken before a RESETLOGS.

Restrictions and Usage Notes

    Execute RESET DATABASE only at the RMAN prompt.
    You must be connected to the target database and a recovery catalog.
    You must issue a RESET DATABASE command before you can use RMAN with a target database that has been opened with the SQL statement ALTER DATABASE OPEN RESETLOGS option. If you do not, then RMAN refuses to access the recovery catalog because it cannot distinguish between a RESETLOGS operation and an accidental restore of an old control file. The RESET DATABASE command informs RMAN that you issued a RESETLOGS command.
    You cannot specify TO INCARNATION unless the database is started NOMOUNT. If you mount a control file from an incarnation after the desired incarnation, then RESET DATABASE TO INCARNATION fails because of a control file mismatch. If you mount the control file from the desired incarnation and then run RESET DATABASE TO INCARNATION, then the connection to the target database and recovery catalog fails due to an incarnation mismatch.


13)Start WAS and web app and inform application team for health check

=====================End of Recovery ======================

===================Details===========

1)shutdown database and rename controlfile and redo log files
2) restore required RMAN backup from tape to server(from sunday backup)
3) recover the database till 14:31 on July 1st 2014
4) start the database



RMAN> connect target sys/Lwaipt01_sys@database

connected to target database: database (DBID=1127659667)

RMAN> connect catalog database/rman_database@TAF_RCATNET

connected to recovery catalog database

RMAN> run {

set until time "to_date ('Jul 01 2014 14:31:00' , 'Mon DD YYYY HH24:MI:SS')";
allocate channel ch1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
allocate channel ch2 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
allocate channel ch3 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
allocate channel ch4 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';

restore database preview;
}2> 3> 4> 5> 6> 7> 8> 9> 10>


select distinct media from v$backup_piece where trunc(start_time) in ('28-JUN-2014','29-JUN-2014','30-JUN-2014','01-JUN-2014') order by 1;
05:48:34 SQL> ALTER SESSION SET nls_date_format = 'DD-MON-YYYY HH24:MI:SS';

Session altered.

06:29:56 SQL> col next_change# format 999999999999999;
                         col first_change# format 999999999999999;

                         select sequence#, to_date(first_time,'DD-MON-YYYY HH24:MI:SS') first_time,
                                                  first_change#,
                                                  to_date(next_time,'DD-MON-YYYY HH24:MI:SS') next_time,
                                                  next_change# from v$archived_log
                         where completion_time between to_date('JUN-28-2014','MON-DD-YYYY') and to_date('JUL-01-2014','MON-DD-YYYY')06:30:18 SQL>

-rw-rw----    1 oracle   dba        27648000 Jul 14 17:03 RCANETARCHarch_2_7242_700750169.arc
[lwaipt02:oracle:/u01/oradata/archive:] tnsping
[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|grep tns
  oracle 11010072        1   0   Jun 26      -  8:09 /usr/app/oracle/products/10.2.0.4/asm/bin/tnslsnr LISTENER_LWAIPT02 -inherit
  oracle 21299220 11403498   0 18:25:06  pts/0  0:00 grep tns
[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|grep pmon
  oracle 11665542        1   0   Jun 26      -  4:09 asm_pmon_+ASM2
  oracle 14483542        1   0   Jun 26      -  5:08 ora_pmon_RCATNET2
  oracle 21299240 11403498   0 18:25:20  pts/0  0:00 grep pmon
  oracle 25100340        1   0   Jun 26      -  5:24 ora_pmon_database2
[lwaipt02:oracle:/u01/oradata/archive:] srvctl stop listener -n lwaipt02
[lwaipt02:oracle:/u01/oradata/archive:] srvctl start listener -n lwaipt02
[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|grep tns
  oracle 22020250        1   0 18:26:49      -  0:00 /usr/app/oracle/products/10.2.0.4/asm/bin/tnslsnr LISTENER_LWAIPT02 -inherit
  oracle 24117272 11403498   0 18:26:57  pts/0  0:00 grep tns
[lwaipt02:oracle:/u01/oradata/archive:]  srvctl stop listener -n lwaipt02
[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|grep tns
[lwaipt02:oracle:/u01/oradata/archive:] sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jul 14 18:36:09 2014

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


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

SQL>
SQL>
SQL>
SQL> alter system archive log current;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> exit
ERROR:
ORA-03135: connection lost contact

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options (with complications)
[lwaipt02:oracle:/u01/oradata/archive:] ps -e|grep pmon
[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|grep pmon
  oracle 11665542        1   0   Jun 26      -  4:09 asm_pmon_+ASM2
  oracle 13434952 11403498   0 18:39:41  pts/0  0:00 grep pmon
  oracle 14483542        1   0   Jun 26      -  5:09 ora_pmon_RCATNET2
[lwaipt02:oracle:/u01/oradata/archive:]
[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|grep pmon
  oracle  6946840        1   0 18:40:56      -  0:00 ora_pmon_database2
  oracle 11665542        1   0   Jun 26      -  4:09 asm_pmon_+ASM2
  oracle 14483542        1   0   Jun 26      -  5:09 ora_pmon_RCATNET2
[lwaipt02:oracle:/u01/oradata/archive:] sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jul 14 18:45:02 2014

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


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

SQL> show parameter cluster

NAME                                 TYPE
------------------------------------ --------------------------------
VALUE
------------------------------
cluster_database                     boolean
TRUE
cluster_database_instances           integer
2
cluster_interconnects                string

SQL>
SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=spfile sid='*';

System altered.

SQL>
SQL> SP2-0734: unknown command beginning "SQL> ALTER..." - rest of line ignored.
SQL> SQL> SP2-0734: unknown command beginning "System alt..." - rest of line ignored.
SQL> SQL> SP2-0042: unknown command "SQL>" - rest of line ignored.
SQL>
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount restrict
ORACLE instance started.

Total System Global Area 6291456000 bytes
Fixed Size                  2093392 bytes
Variable Size            1375735472 bytes
Database Buffers         4898947072 bytes
Redo Buffers               14680064 bytes
ORA-00201: control file version 10.2.0.4.0 incompatible with ORACLE version
10.2.0.3.0
ORA-00202: control file: '+DATA_DG01/database/controlfile/current.263.709530565'

SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[lwaipt02:oracle:/u01/oradata/archive:]
[lwaipt02:oracle:/u01/oradata/archive:]
[lwaipt02:oracle:/u01/oradata/archive:]
[lwaipt02:oracle:/u01/oradata/archive:] ps -e|grep asm
[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|greep pmon
ksh: greep:  not found
[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|grep pmon
  oracle 11665542        1   0   Jun 26      -  4:10 asm_pmon_+ASM2
  oracle 12583096 11403498   0 19:21:19  pts/0  0:00 grep pmon
  oracle 14483542        1   0   Jun 26      -  5:09 ora_pmon_RCATNET2
[lwaipt02:oracle:/u01/oradata/archive:] .
[lwaipt02:oracle:/u01/oradata/archive:] cat /etc/oratab
#
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
+ASM2:/usr/app/oracle/products/10.2.0.4/asm:N
database:/usr/app/oracle/products/10.2.0.4/db:N
RCATNET:/usr/app/oracle/products/10.2.0.4/db:N
[lwaipt02:oracle:/u01/oradata/archive:] ex
[lwaipt02:oracle:/u01/oradata/archive:] . oraenv
ORACLE_SID = [database2] ? ASM2
ORACLE_HOME = [/home/oracle] ? /usr/app/oracle/products/10.2.0.4/asm
[lwaipt02:oracle:/u01/oradata/archive:] export ORACLE_SID=+ASM2
[lwaipt02:oracle:/u01/oradata/archive:] asmcmd
ASMCMD> lsdg
State    Type    Rebal  Unbal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Name
MOUNTED  EXTERN  N      N         512   4096  1048576    786432   786160                0          786160              0  DATA_DG01/
MOUNTED  EXTERN  N      N         512   4096  1048576   1114112  1104056                0         1104056              0  DATA_DG02/
ASMCMD> cd DATA_DG01
ASMCMD> ls -ltr
Type  Redund  Striped  Time             Sys  Name
                                        Y    database/
ASMCMD> cd database/
ASMCMD> ls -ltr
Type           Redund  Striped  Time             Sys  Name
                                                 Y    CONTROLFILE/
                                                 Y    ONLINELOG/
                                                 Y    PARAMETERFILE/
                                                 N    spfiledatabase.ora => +DATA_DG01/database/PARAMETERFILE/spfile.353.710112849
ASMCMD> cd ..
ASMCMD> cd ..
ASMCMD> ls -ltr
State    Type    Rebal  Unbal  Name
MOUNTED  EXTERN  N      N      DATA_DG02/
MOUNTED  EXTERN  N      N      DATA_DG01/
ASMCMD> cd DATA_DG02
ASMCMD> ls -ltr
Type  Redund  Striped  Time             Sys  Name
                                        Y    RCATNET/
ASMCMD> exit
[lwaipt02:oracle:/u01/oradata/archive:]


srvctl start listener -n lwaipt01
srvctl start listener -n lwaipt02

[lwaipt01:oracle:/home/oracle:]
[lwaipt01:oracle:/home/oracle:] ps -ef|grep tns
  oracle  9765024        1   0   Mar 30      - 17:03 /usr/app/oracle/products/10.2.0.4/asm/bin/tnslsnr LISTENER_LWAIPT01 -inherit
[lwaipt01:oracle:/home/oracle:]
[lwaipt01:oracle:/home/oracle:]
[lwaipt01:oracle:/home/oracle:]
[lwaipt01:oracle:/home/oracle:] srvctl stop listener -n lwaipt01
[lwaipt01:oracle:/home/oracle:] ps -ef|grep tns
  oracle 32374938 16646340   0 18:24:26  pts/5  0:00 grep tns
[lwaipt01:oracle:/home/oracle:]

[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|grep tns
  oracle 11010072        1   0   Jun 26      -  8:09 /usr/app/oracle/products/10.2.0.4/asm/bin/tnslsnr LISTENER_LWAIPT02 -inherit
  oracle 21299220 11403498   0 18:25:06  pts/0  0:00 grep tns
[lwaipt02:oracle:/u01/oradata/archive:] ps -ef|grep pmon
  oracle 11665542        1   0   Jun 26      -  4:09 asm_pmon_+ASM2
  oracle 14483542        1   0   Jun 26      -  5:08 ora_pmon_RCATNET2
  oracle 21299240 11403498   0 18:25:20  pts/0  0:00 grep pmon
  oracle 25100340        1   0   Jun 26      -  5:24 ora_pmon_database2
[lwaipt02:oracle:/u01/oradata/archive:] srvctl stop listener

srvctl stop listener -n lwaipt01
srvctl stop listener -n lwaipt02
le:] srvctl stop database -d database -o immediate



RMAN> connect target /

connected to target database: database (not mounted)

RMAN> connect catalog database/rman_database@TAF_RCATNET

connected to recovery catalog database

RMAN> SET DBID 1127659667

executing command: SET DBID
database name is "database" and DBID is 1127659667



RMAN> run
{
set until time "to_date ('Jul 01 2014 14:31:00' , 'Mon DD YYYY HH24:MI:SS')";
allocate channel ch1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
RESTORE CONTROLFILE FROM AUTOBACKUP;
release channel ch1;
}2> 3> 4> 5> 6> 7>

executing command: SET until clause

allocated channel: ch1
channel ch1: sid=537 devtype=SBT_TAPE
channel ch1: Data Protection for Oracle: version 5.5.2.1

Starting restore at 14-JUL-14

channel ch1: looking for autobackup on day: 20140701
channel ch1: autobackup found: c-1127659667-20140701-13
channel ch1: control file restore from autobackup complete
output filename=+DATA_DG01/database/controlfile/current.263.709530565
Finished restore at 14-JUL-14

released channel: ch1

RMAN> sql 'alter database mount';

sql statement: alter database mount


-rw-------    1 oracle   dba              66 Jul 14 19:46 nohup.out
-rw-r--r--    1 oracle   dba             905 Jul 14 19:46 RESTORE_database-14072014.log
-rw-rw----    1 oracle   dba            1544 Jul 14 19:47 hc_RCATNET1.dat
[lwaipt01:oracle:/usr/app/oracle/products/10.2.0.4/db/dbs:] tail -200f RESTORE_database-14072014.log

Recovery Manager: Release 10.2.0.4.0 - Production on Mon Jul 14 19:46:49 2014

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

RMAN> connect target *
2> connect catalog *
3> run
4> {
5> set until time "to_date ('Jul 01 2014 14:31:00' , 'Mon DD YYYY HH24:MI:SS')";
6> allocate channel ch1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
7> allocate channel ch2 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
8> allocate channel ch3 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
9> allocate channel ch4 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/etc/tdpo.opt)';
10> RESTORE DATABASE;
11> RECOVER DATABASE;
12> release channel ch1;
13> release channel ch2;
14> release channel ch3;
15> release channel ch4;
16> }
17>
18>
connected to target database: database (DBID=1127659667, not open)

connected to recovery catalog database

executing command: SET until clause
SQL> alter trigger NAMECHECK_BEFORE_DDL_DB_TRG disable;

Trigger altered.

SQL>
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG02/database/tempfile/temp01.dbf'
     SIZE 30000M REUSE AUTOEXTEND OFF;  2

Tablespace altered.

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG02/database/tempfile/temp.303.709934103'
     SIZE 20000M REUSE AUTOEXTEND OFF;  2
ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG02/database/tempfile/temp.303.709934103'
*
ERROR at line 1:
ORA-01276: Cannot add file +DATA_DG02/database/tempfile/temp.303.709934103.
File has an Oracle Managed Files file name.


SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG02/database/tempfile/temp02.dbf'
     SIZE 20000M REUSE AUTOEXTEND OFF;  2

Tablespace altered.

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA_DG01/database/tempfile/temp03.dbf'
     SIZE 6534M REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;  2

Tablespace altered.

SQL> alter trigger NAMECHECK_BEFORE_DDL_DB_TRG enable;

Trigger altered.

SQL>


============alter log file==================

S: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
SUCCESS: diskgroup DATA_DG02 was mounted
SUCCESS: diskgroup DATA_DG02 was dismounted
Wed Jul 16 04:11:32 2014
alter database recover datafile list clear
Wed Jul 16 04:11:32 2014
Completed: alter database recover datafile list clear
Wed Jul 16 04:11:32 2014
alter database recover datafile list
 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20
Completed: alter database recover datafile list
 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20
Wed Jul 16 04:11:32 2014
alter database recover datafile list
 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40
Completed: alter database recover datafile list
 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40
Wed Jul 16 04:11:32 2014
alter database recover datafile list
 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60
Completed: alter database recover datafile list
 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60
Wed Jul 16 04:11:32 2014
alter database recover datafile list
 61 , 62 , 63 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80
Completed: alter database recover datafile list
 61 , 62 , 63 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80
Wed Jul 16 04:11:32 2014
alter database recover datafile list
 81 , 82 , 83 , 84 , 85 , 86 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100
Completed: alter database recover datafile list
 81 , 82 , 83 , 84 , 85 , 86 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100
Wed Jul 16 04:11:32 2014
alter database recover datafile list
 101 , 102 , 103 , 104 , 105 , 106 , 107 , 108 , 109 , 110 , 111 , 112 , 113 , 114 , 115 , 116 , 117 , 118 , 119 , 120
Completed: alter database recover datafile list
 101 , 102 , 103 , 104 , 105 , 106 , 107 , 108 , 109 , 110 , 111 , 112 , 113 , 114 , 115 , 116 , 117 , 118 , 119 , 120
Wed Jul 16 04:11:32 2014
alter database recover datafile list
 121 , 122 , 123 , 124 , 125 , 126 , 127 , 128 , 129 , 130 , 131 , 132 , 133 , 134 , 135 , 136 , 137 , 138 , 139 , 140
Completed: alter database recover datafile list
 121 , 122 , 123 , 124 , 125 , 126 , 127 , 128 , 129 , 130 , 131 , 132 , 133 , 134 , 135 , 136 , 137 , 138 , 139 , 140
Wed Jul 16 04:11:32 2014
alter database recover datafile list
 141 , 142 , 143 , 144 , 145 , 146 , 147 , 148 , 149 , 150 , 151 , 152 , 153 , 154
Completed: alter database recover datafile list
 141 , 142 , 143 , 144 , 145 , 146 , 147 , 148 , 149 , 150 , 151 , 152 , 153 , 154
Wed Jul 16 04:11:32 2014
alter database recover if needed
 start until time 'JUL 01 2014 14:31:00' using backup controlfile
Media Recovery Start
Wed Jul 16 04:11:33 2014
SUCCESS: diskgroup DATA_DG02 was mounted
Wed Jul 16 04:11:34 2014
 parallel recovery started with 7 processes
ORA-279 signalled during: alter database recover if needed
 start until time 'JUL 01 2014 14:31:00' using backup controlfile
...
Wed Jul 16 04:11:51 2014
Archivelog restore complete. Elapsed time: 0:00:05
Wed Jul 16 04:12:02 2014

No comments:

Post a Comment