Sunday, March 23, 2008

Oracle : Backup recovery : Session 1

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            E:\redo_mirror
Oldest online log sequence     9
Next log sequence to archive   12
Current log sequence           12

SQL> select member from v$logfile;
MEMBER
----------------------------------------------
E:\10G\ORADATA\LOCAL\REDO03.LOG
E:\10G\ORADATA\LOCAL\REDO02.LOG
E:\10G\ORADATA\LOCAL\REDO01.LOG
E:\REDO_MIRROR\REDO01A.LOG
E:\REDO_MIRROR\REDO01B.LOG
E:\REDO_MIRROR\REDO01C.LOG
6 rows selected.
SQL> select name from v$controlfile;
NAME
----------------------------------------------
E:\10G\ORADATA\LOCAL\CONTROL01.CTL
E:\10G\ORADATA\LOCAL\CONTROL02.CTL
E:\10G\ORADATA\LOCAL\CONTROL03.CTL

The following query displays which datafiles are currently included in a
tablespace that has been placed in backup mode:

SELECT t.name AS "TB_NAME", d.file# as "DF#", d.name AS "DF_NAME", b.status
FROM V$DATAFILE d, V$TABLESPACE t, V$BACKUP b
WHERE d.TS#=t.TS#
AND b.FILE#=d.FILE#
AND b.STATUS='ACTIVE';


SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination E:\redo_mirror
Oldest online log sequence 9
Next log sequence to archive 12
Current log sequence 12
To make a consistent whole database backup:
1. If the database is open, use SQL*Plus to shut down the database with the NORMAL,
IMMEDIATE, or TRANSACTIONAL options.
2. Use an operating system utility to make backups of
a.all datafiles
b.control files specified by the CONTROL_FILES parameter of the initialization parameter file.
c. Also, back up the initialization parameter file and other Oracle product initialization files.
To find these files, do a search for *.ora starting in
your Oracle home directory and recursively search all of its subdirectories.
For example, you can back up the datafiles, control files and archived logs to
/disk2/backup as follows:
% cp $ORACLE_HOME/oradata/trgt/*.dbf /disk2/backup
% cp $ORACLE_HOME/oradata/trgt/arch/* /disk2/backup/arch
For Cold backup or offline backup : backup up of the online redo log file.
For Hot backup or online backup : do not backup of the online redo log file, because it is a inconsistent backup.
For inconsistent backup when you restore the backup you should open the database with reset logs "which creates the online redo log file" starting with sequence number 1.
Create Readable trace:

Option 1
SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE as 'E:\local_trace.ora';
Database altered.

Result file:

-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=ARC%S_%R.%T
--
-- DB_UNIQUE_NAME="local"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=%ORACLE_HOME%\RDBMS
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_2='LOCATION=E:\redo_mirror'
-- LOG_ARCHIVE_DEST_2='MANDATORY REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_2='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_2='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_2='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_2='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_2=ALTERNATE
--
-- LOG_ARCHIVE_DEST_1='LOCATION=E:\10g\oradata\local'
-- LOG_ARCHIVE_DEST_1='MANDATORY REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='REGISTER'
-- LOG_ARCHIVE_DEST_1='ALTERNATE=LOG_ARCHIVE_DEST_2'
-- LOG_ARCHIVE_DEST_1='NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE

--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
--     Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "LOCAL" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    'E:\10G\ORADATA\LOCAL\REDO01.LOG',
    'E:\REDO_MIRROR\REDO01C.LOG'
  ) SIZE 50M,
  GROUP 2 'E:\10G\ORADATA\LOCAL\REDO02.LOG'  SIZE 50M,
  GROUP 3 'E:\10G\ORADATA\LOCAL\REDO03.LOG'  SIZE 50M,
  GROUP 4 (
    'E:\REDO_MIRROR\REDO01A.LOG',
    'E:\REDO_MIRROR\REDO01B.LOG'
  ) SIZE 16M
-- STANDBY LOGFILE

DATAFILE
  'E:\10G\ORADATA\LOCAL\SYSTEM01.DBF',
  'E:\10G\ORADATA\LOCAL\UNDOTBS01.DBF',
  'E:\10G\ORADATA\LOCAL\SYSAUX01.DBF',
  'E:\10G\ORADATA\LOCAL\USERS01.DBF',
  'E:\10G\ORADATA\LOCAL\EXAMPLE01.DBF'
CHARACTER SET WE8MSWIN1252
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE 'E:\10G\ORADATA\LOCAL\ARC00001_0567697796.001';
-- ALTER DATABASE REGISTER LOGFILE 'E:\10G\ORADATA\LOCAL\ARC00001_0633948701.001';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE

-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;

-- Database can now be opened normally.
ALTER DATABASE OPEN;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'E:\10G\ORADATA\LOCAL\TEMP01.DBF'
     SIZE 22020096  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
--
--     Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "LOCAL" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    'E:\10G\ORADATA\LOCAL\REDO01.LOG',
    'E:\REDO_MIRROR\REDO01C.LOG'
  ) SIZE 50M,
  GROUP 2 'E:\10G\ORADATA\LOCAL\REDO02.LOG'  SIZE 50M,
  GROUP 3 'E:\10G\ORADATA\LOCAL\REDO03.LOG'  SIZE 50M,
  GROUP 4 (
    'E:\REDO_MIRROR\REDO01A.LOG',
    'E:\REDO_MIRROR\REDO01B.LOG'
  ) SIZE 16M
-- STANDBY LOGFILE

DATAFILE
  'E:\10G\ORADATA\LOCAL\SYSTEM01.DBF',
  'E:\10G\ORADATA\LOCAL\UNDOTBS01.DBF',
  'E:\10G\ORADATA\LOCAL\SYSAUX01.DBF',
  'E:\10G\ORADATA\LOCAL\USERS01.DBF',
  'E:\10G\ORADATA\LOCAL\EXAMPLE01.DBF'
CHARACTER SET WE8MSWIN1252
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE 'E:\10G\ORADATA\LOCAL\ARC00001_0567697796.001';
-- ALTER DATABASE REGISTER LOGFILE 'E:\10G\ORADATA\LOCAL\ARC00001_0633948701.001';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE

-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'E:\10G\ORADATA\LOCAL\TEMP01.DBF'
     SIZE 22020096  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
--

Option 2
SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE as 'E:\local_trace_NORESETLOGS.ora' NORESETLOGS;
Database altered.

-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=ARC%S_%R.%T
--
-- DB_UNIQUE_NAME="local"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=%ORACLE_HOME%\RDBMS
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_2='LOCATION=E:\redo_mirror'
-- LOG_ARCHIVE_DEST_2='MANDATORY REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_2='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_2='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_2='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_2='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_2=ALTERNATE
--
-- LOG_ARCHIVE_DEST_1='LOCATION=E:\10g\oradata\local'
-- LOG_ARCHIVE_DEST_1='MANDATORY REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='REGISTER'
-- LOG_ARCHIVE_DEST_1='ALTERNATE=LOG_ARCHIVE_DEST_2'
-- LOG_ARCHIVE_DEST_1='NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE

--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "LOCAL" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    'E:\10G\ORADATA\LOCAL\REDO01.LOG',
    'E:\REDO_MIRROR\REDO01C.LOG'
  ) SIZE 50M,
  GROUP 2 'E:\10G\ORADATA\LOCAL\REDO02.LOG'  SIZE 50M,
  GROUP 3 'E:\10G\ORADATA\LOCAL\REDO03.LOG'  SIZE 50M,
  GROUP 4 (
    'E:\REDO_MIRROR\REDO01A.LOG',
    'E:\REDO_MIRROR\REDO01B.LOG'
  ) SIZE 16M
-- STANDBY LOGFILE

DATAFILE
  'E:\10G\ORADATA\LOCAL\SYSTEM01.DBF',
  'E:\10G\ORADATA\LOCAL\UNDOTBS01.DBF',
  'E:\10G\ORADATA\LOCAL\SYSAUX01.DBF',
  'E:\10G\ORADATA\LOCAL\USERS01.DBF',
  'E:\10G\ORADATA\LOCAL\EXAMPLE01.DBF'
CHARACTER SET WE8MSWIN1252
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE 'E:\10G\ORADATA\LOCAL\ARC00001_0567697796.001';
-- ALTER DATABASE REGISTER LOGFILE 'E:\10G\ORADATA\LOCAL\ARC00001_0633948701.001';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE

-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;

-- Database can now be opened normally.
ALTER DATABASE OPEN;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'E:\10G\ORADATA\LOCAL\TEMP01.DBF'
     SIZE 22020096  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
--

Option 3
SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE as 'E:\local_trace_RESETLOGS.ora' RESETLOGS;
Database altered.

-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=ARC%S_%R.%T
--
-- DB_UNIQUE_NAME="local"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=%ORACLE_HOME%\RDBMS
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_2='LOCATION=E:\redo_mirror'
-- LOG_ARCHIVE_DEST_2='MANDATORY REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_2='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_2='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_2='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_2='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_2=ALTERNATE
--
-- LOG_ARCHIVE_DEST_1='LOCATION=E:\10g\oradata\local'
-- LOG_ARCHIVE_DEST_1='MANDATORY REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='REGISTER'
-- LOG_ARCHIVE_DEST_1='ALTERNATE=LOG_ARCHIVE_DEST_2'
-- LOG_ARCHIVE_DEST_1='NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE

--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "LOCAL" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    'E:\10G\ORADATA\LOCAL\REDO01.LOG',
    'E:\REDO_MIRROR\REDO01C.LOG'
  ) SIZE 50M,
  GROUP 2 'E:\10G\ORADATA\LOCAL\REDO02.LOG'  SIZE 50M,
  GROUP 3 'E:\10G\ORADATA\LOCAL\REDO03.LOG'  SIZE 50M,
  GROUP 4 (
    'E:\REDO_MIRROR\REDO01A.LOG',
    'E:\REDO_MIRROR\REDO01B.LOG'
  ) SIZE 16M
-- STANDBY LOGFILE

DATAFILE
  'E:\10G\ORADATA\LOCAL\SYSTEM01.DBF',
  'E:\10G\ORADATA\LOCAL\UNDOTBS01.DBF',
  'E:\10G\ORADATA\LOCAL\SYSAUX01.DBF',
  'E:\10G\ORADATA\LOCAL\USERS01.DBF',
  'E:\10G\ORADATA\LOCAL\EXAMPLE01.DBF'
CHARACTER SET WE8MSWIN1252
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE 'E:\10G\ORADATA\LOCAL\ARC00001_0567697796.001';
-- ALTER DATABASE REGISTER LOGFILE 'E:\10G\ORADATA\LOCAL\ARC00001_0633948701.001';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE

-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'E:\10G\ORADATA\LOCAL\TEMP01.DBF'
     SIZE 22020096  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
--

 

  1* select * from v$logfile order by group#
SQL> /

    GROUP#    STATUS    TYPE            MEMBER                                      
---------- ------- ------- --------------------------------------
         1                        ONLINE        E:\10G\ORADATA\LOCAL\REDO01.LOG             
         1                        ONLINE        E:\REDO_MIRROR\REDO01C.LOG                  
         2          STALE     ONLINE        E:\10G\ORADATA\LOCAL\REDO02.LOG             
         3          STALE     ONLINE        E:\10G\ORADATA\LOCAL\REDO03.LOG             
         4                        ONLINE        E:\REDO_MIRROR\REDO01B.LOG                  
         4                        ONLINE        E:\REDO_MIRROR\REDO01A.LOG                  

6 rows selected.

E:\10G\ORADATA\LOCAL\REDO01.LOG
E:\REDO_MIRROR\REDO01C.LOG          
E:\10G\ORADATA\LOCAL\REDO02.LOG -- stale ; no miiror copy
E:\10G\ORADATA\LOCAL\REDO03.LOG -- stale ; no miiror copy
E:\REDO_MIRROR\REDO01B.LOG          
E:\REDO_MIRROR\REDO01A.LOG

 

Add mirrors tp each group:

 

SQL> ALTER DATABASE ADD LOGFILE MEMBER 'E:\redo_mirror\REDO01B2.LOG' TO GROUP 2;

Database altered.

SQL> ALTER DATABASE ADD LOGFILE MEMBER 'E:\redo_mirror\REDO01C2.LOG' TO GROUP 3;

Database altered.

SQL> select * from v$logfile order by group#;

    GROUP# STATUS  TYPE    MEMBER                                                                      
---------- ------- ------- -------------------------------------------------------------------------
         1         ONLINE  E:\10G\ORADATA\LOCAL\REDO01.LOG                                             
         1         ONLINE  E:\REDO_MIRROR\REDO01C.LOG                                                  
        2 INVALID ONLINE  E:\REDO_MIRROR\REDO01B2.LOG   -- newly added ones                                              
         2 STALE   ONLINE  E:\10G\ORADATA\LOCAL\REDO02.LOG                                             
         3 INVALID ONLINE  E:\REDO_MIRROR\REDO01C2.LOG   -- newly added ones                                              
         3 STALE   ONLINE  E:\10G\ORADATA\LOCAL\REDO03.LOG                                             
         4         ONLINE  E:\REDO_MIRROR\REDO01B.LOG                                                  
         4         ONLINE  E:\REDO_MIRROR\REDO01A.LOG                                                  

8 rows selected

 

Keep on altering the log sq by issueing :

alter system archive log current;
and keep on checking the log sq with "archive log list" unless you see:
 

SQL> select * from v$logfile order by group#;

    GROUP# STATUS  TYPE    MEMBER                                                                      
---------- ------- ------- -------------------------------------------------------------------------
         1         ONLINE  E:\10G\ORADATA\LOCAL\REDO01.LOG                                             
         1         ONLINE  E:\REDO_MIRROR\REDO01C.LOG                                                  
         2         ONLINE  E:\REDO_MIRROR\REDO01B2.LOG                                                 
         2         ONLINE  E:\10G\ORADATA\LOCAL\REDO02.LOG                                             
         3         ONLINE  E:\REDO_MIRROR\REDO01C2.LOG                                                 
         3         ONLINE  E:\10G\ORADATA\LOCAL\REDO03.LOG                                             
         4         ONLINE  E:\REDO_MIRROR\REDO01B.LOG                                                  
         4         ONLINE  E:\REDO_MIRROR\REDO01A.LOG                                                  


 
Test:
Physically corrupt one redo member of a group

Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            E:\redo_mirror
Oldest online log sequence     12
Next log sequence to archive   15
Current log sequence           15

 

Find out which group is active :

SQL> SELECT THREAD#,SEQUENCE#,NAME   FROM V$ARCHIVED_LOG;

   THREAD#  SEQUENCE# NAME
---------- ---------- --------------------------------------------------
         1         12 E:\10G\ORADATA\LOCAL\ARC00012_0633948701.001
         1         13 E:\10G\ORADATA\LOCAL\ARC00013_0633948701.001
         1         14 E:\10G\ORADATA\LOCAL\ARC00014_0633948701.001

 


 


Thread # 1 means group #1


So take any one of the files mentioned below:


 


   GROUP# STATUS  TYPE    MEMBER                                                                      
---------- ------- ------- -------------------------------------------------------------------------
         1         ONLINE  E:\10G\ORADATA\LOCAL\REDO01.LOG                                             
         1         ONLINE  E:\REDO_MIRROR\REDO01C.LOG    


After shutting down the db I opened "E:\10G\ORADATA\LOCAL\REDO01.LOG" and cleared some contents.


Then restarted the db.


 


SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            E:\redo_mirror
Oldest online log sequence     12
Next log sequence to archive   15
Current log sequence           15
SQL> SELECT THREAD#,SEQUENCE#,NAME
  2  FROM V$ARCHIVED_LOG;

   THREAD#  SEQUENCE#
---------- ----------
NAME
--------------------------------------------------------------------------------
         1         12
E:\10G\ORADATA\LOCAL\ARC00012_0633948701.001

         1         13
E:\10G\ORADATA\LOCAL\ARC00013_0633948701.001

         1         14
E:\10G\ORADATA\LOCAL\ARC00014_0633948701.001

SQL> set pagesize 999
SQL> set linesize 999
SQL> SELECT THREAD#,SEQUENCE#,NAME
  2  FROM V$ARCHIVED_LOG;

   THREAD#  SEQUENCE# NAME
---------- ---------- ------------------------------------------------------------------------------
         1         12 E:\10G\ORADATA\LOCAL\ARC00012_0633948701.001
         1         13 E:\10G\ORADATA\LOCAL\ARC00013_0633948701.001
         1         14 E:\10G\ORADATA\LOCAL\ARC00014_0633948701.001

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1247876 bytes
Variable Size              83887484 bytes
Database Buffers           75497472 bytes
Redo Buffers                7139328 bytes
Database mounted.
Database opened.
SQL> select * from v$logfile order by group#;

    GROUP# STATUS  TYPE    MEMBER                                                                                                      
---------- ------- ------- -------------------------------------------------------------------------
         1         ONLINE  E:\10G\ORADATA\LOCAL\REDO01.LOG                                                                             
         1         ONLINE  E:\REDO_MIRROR\REDO01C.LOG                                                                                  
         2         ONLINE  E:\REDO_MIRROR\REDO01B2.LOG                                                                                 
         2 INVALID ONLINE  E:\10G\ORADATA\LOCAL\REDO02.LOG                                                                             
         3         ONLINE  E:\REDO_MIRROR\REDO01C2.LOG                                                                                 
         3         ONLINE  E:\10G\ORADATA\LOCAL\REDO03.LOG                                                                             
         4         ONLINE  E:\REDO_MIRROR\REDO01B.LOG                                                                                  
         4         ONLINE  E:\REDO_MIRROR\REDO01A.LOG                                                                                  

8 rows selected.

SQL> /

    GROUP# STATUS  TYPE    MEMBER                                                                                                      
---------- ------- ------- -------------------------------------------------------------------------
         1         ONLINE  E:\10G\ORADATA\LOCAL\REDO01.LOG                                                                             
         1         ONLINE  E:\REDO_MIRROR\REDO01C.LOG                                                                                  
         2         ONLINE  E:\REDO_MIRROR\REDO01B2.LOG                                                                                 
         2 INVALID ONLINE  E:\10G\ORADATA\LOCAL\REDO02.LOG                                                                             
         3         ONLINE  E:\REDO_MIRROR\REDO01C2.LOG                                                                                 
         3         ONLINE  E:\10G\ORADATA\LOCAL\REDO03.LOG                                                                             
         4         ONLINE  E:\REDO_MIRROR\REDO01B.LOG                                                                                  
         4         ONLINE  E:\REDO_MIRROR\REDO01A.LOG                                                                                  

8 rows selected.

SQL> SELECT THREAD#,SEQUENCE#,NAME   FROM V$ARCHIVED_LOG;

   THREAD#  SEQUENCE# NAME
---------- ---------- ------------------------------------------------------------------------------
         1         12 E:\10G\ORADATA\LOCAL\ARC00012_0633948701.001
         1         13 E:\10G\ORADATA\LOCAL\ARC00013_0633948701.001
         1         14 E:\10G\ORADATA\LOCAL\ARC00014_0633948701.001

SQL> alter system archive log current;

System altered.

SQL>  select * from v$logfile order by group#;

    GROUP# STATUS  TYPE    MEMBER                                                                                                      
---------- ------- ------- -------------------------------------------------------------------------
         1         ONLINE  E:\10G\ORADATA\LOCAL\REDO01.LOG                                                                             
         1         ONLINE  E:\REDO_MIRROR\REDO01C.LOG                                                                                  
         2         ONLINE  E:\REDO_MIRROR\REDO01B2.LOG                                                                                 
         2 INVALID ONLINE  E:\10G\ORADATA\LOCAL\REDO02.LOG                                                                             
         3         ONLINE  E:\REDO_MIRROR\REDO01C2.LOG                                                                                 
         3         ONLINE  E:\10G\ORADATA\LOCAL\REDO03.LOG                                                                             
         4         ONLINE  E:\REDO_MIRROR\REDO01B.LOG                                                                                  
         4         ONLINE  E:\REDO_MIRROR\REDO01A.LOG                                                                                  

8 rows selected.

No comments:

Post a Comment