COLD BACKUP & RECOVERY SCENARIOS.pdf

download COLD BACKUP &  RECOVERY SCENARIOS.pdf

of 33

Transcript of COLD BACKUP & RECOVERY SCENARIOS.pdf

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    1/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    DATABASE RECOVERY

    Database Recovery having 2 types.

    COMPLETE - NO DATA LOSS

    INCOMPLETE- DATA LOSS (CAN RECOVER TO A CERTAIN TIME OR SCN).

    We can perform complete recovery, if we lost only datafiles.

    We can perform incomplete recovery, if we lost either redolog files, control files, archivelog

    files.

    INCOMPLETE RECOVERY is possible in 3 ways.

    UNTIL SCN

    UNTIL TIME

    UNTIL CANCEL (Always we can use this method).

    RECOVER CRD FILES IN NOARCHIVELOG MODE

    SYS>select name, log_mode, open_mode from v$database;

    NAME LOG_MODE OPEN_MODE

    --------- ------------ ----------

    ROSE NOARCHIVELOGREAD WRITE

    SYS> shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u03/coldbkp/

    SQL> startup

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    SYS> conn sham/sham

    Connected.

    SHAM>create table tab2 as select * from tab1;

    Table created.

    SHAM>select count(*) from tab2;

    COUNT(*)----------524288

    $cd /u01/app/oracle/oradata/rose/

    $rm *.*

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    2/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS>shut abort;

    ORACLE instance shut down.

    $cd /u03/coldbkp/

    [oracle@oel5 coldbkp]$ cp */u01/app/oracle/oradata/rose/

    SYS>startup

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    SYS>conn sham/sham

    Connected.

    SHAM>select count(*) from tab2;

    select count(*) from tab2

    *

    ERROR at line 1:

    ORA-00942: table or view does not exist

    RECOVER CRD FILES IN ARCHIVELOG MODE

    SYS>select status from v$instance;

    STATUS

    ------------

    OPEN

    SYS>alter database close;

    Database altered.

    SYS>alter database archivelog;

    Database altered.

    SYS>startup

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    SYS> select name, log_mode, open_mode from v$database;

    NAME LOG_MODE OPEN_MODE

    --------- ------------ ----------

    ROSE ARCHIVELOG READ WRITE

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    3/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u03/coldbkp/

    SYS>startup

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    SYS>archive log list;

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 88Next log sequence to archive 90

    Current log sequence 90

    SYS>conn sham/sham

    Connected.

    SHAM>create table tab2 as select * from tab1;

    Table created.

    SHAM>insert into tab2 select * from tab1;

    524288 rows created.

    SHAM> /

    524288 rows created.

    SHAM> /

    524288 rows created.

    SHAM> /

    524288 rows created.

    SHAM>commit;

    Commit complete.

    SHAM>select count(*) from tab2;

    COUNT(*)

    ----------

    4718592

    SYS>archive log list;

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 104

    Next log sequence to archive 106

    Current log sequence 106

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    4/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    $cd /u01/app/oracle/oradata/rose/

    [oracle@oel5 rose]$rm -rf *

    [oracle@oel5 rose]$ls -l

    total 0

    SYS> shut immediate;

    ORA-00210: cannot open the specified control file

    ORA-00202: control file: '/u01/app/oracle/oradata/rose/control01.ctl'

    ORA-27041: unable to open file

    Linux Error: 2: No such file or directory

    Additional information: 3

    SYS>shut abort;

    ORACLE instance shut down.

    $cd /u03/coldbkp/[oracle@oel5 coldbkp]$cp* /u01/app/oracle/oradata/rose/

    SYS>startup mount;

    ORACLE instance started.

    ..

    [Trimmed]

    Database mounted.

    SYS>select file#, checkpoint_change# from v$datafile;

    FILE# CHECKPOINT_CHANGE#

    --------- ------------------

    1 714338

    2 714338

    3 714338

    4 714338

    5 714338

    SYS>alter database recover automatic using backup controlfile until cancel;

    alter database recover automatic using backup controlfile until cancel

    *

    ERROR at line 1:

    ORA-00279: change 736465 generated at 09/22/2014 19:48:08 needed for thread 1

    ORA-00289: suggestion:

    /u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_09_22/o1_mf_1_106_%u_.arc

    ORA-00280: change 736465 for thread 1 is in sequence #106

    ORA-00278: log file

    '/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_09_22/o1_mf_1_106_%u_.arc'

    no longer needed for this recovery

    ORA-00308: cannot open archived log

    '/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_09_22/o1_mf_1_106_%u_.arc'

    ORA-27037: unable to obtain file status

    Linux Error: 2: No such file or directory

    Additional information: 3

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    5/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS>recover cancel;

    Media recovery complete.

    SYS>@df.sql;

    FILE# CHECKPOINT_CHANGE#

    ---------- -----------------

    1 736465

    2 736465

    3 736465

    4 736465

    5 736465

    SYS>select open_resetlogs from v$database;

    OPEN_RESETL

    -----------REQUIRED

    SYS>alter database open resetlogs;

    Database altered.

    SYS>archive log list;

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 1

    Next log sequence to archive 1

    Current log sequence 1

    SHAM>conn sham/sham

    Connected.

    SHAM>select count(*) from tab2;

    COUNT(*)

    ----------

    3670016

    NOTE: We performed recovery, but it is Incomplete Recovery.

    LOSS OF NON SYSTEM DATAFILE

    SYS>select name, log_mode, open_mode from v$database;

    NAME LOG_MODE OPEN_MODE

    --------- ------------ ----------

    ROSE ARCHIVELOGREAD WRITE

    SYS>conn sham/sham

    Connected.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    6/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SHAM>select count(*) from tab1;

    COUNT(*)

    ----------

    150000

    SHAM>select count(*) from tab2;

    COUNT(*)

    ----------

    150000

    SYS>archive log list

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 67

    Next log sequence to archive 69

    Current log sequence 69

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u02/coldbkp/

    SYS> startupORACLE instance started.

    ..

    [Trimmed]

    Database opened.

    SHAM> insert into tab1 select * from tab1;

    150000 rows created.

    SHAM>/

    300000 rows created.

    SHAM>/600000 rows created.

    SHAM>insert into tab2 select * from tab1;

    600000 rows created.

    SHAM>/

    1200000 rows created.

    SHAM>/

    1200000 rows created.

    SHAM>select count(*) from tab1;

    COUNT(*)

    ----------

    1200000

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    7/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SHAM>select count(*) from tab2;

    COUNT(*)

    ----------

    2400000

    SHAM>commit;

    Commit complete.

    SYS>archive log list;

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 90

    Next log sequence to archive 92

    Current log sequence 92

    SYS>select name from v$datafile;

    NAME

    --------------------------------------------

    /u01/app/oracle/oradata/rose/system01.dbf

    /u01/app/oracle/oradata/rose/undotbs01.dbf

    /u01/app/oracle/oradata/rose/sysaux01.dbf

    /u01/app/oracle/oradata/rose/users01.dbf

    /u01/app/oracle/oradata/rose/example01.dbf

    SYS> !rm -rf /u01/app/oracle/oradata/rose/users01.dbf

    SYS>create table tab3 as select * from tab2;

    create table tab3 as select * from tab2

    *

    ERROR at line 1:

    ORA-01116: error in opening database file 4

    ORA-01110: data file 4: '/u01/app/oracle/oradata/rose/users01.dbf'

    ORA-27041: unable to open file

    Linux Error: 2: No such file or directory

    Additional information: 3

    SYS>alter database datafile 4 offline;

    Database altered.

    SYS> select file#, status from v$datafile where file#=4;

    FILE# STATUS

    -------- -----

    4 RECOVER

    SYS>select * from v$recover_file;

    FILE# ONLINE_STATUS ERROR

    ------ ------------ -------------

    4 OFFLINE FILE NOT FOUND

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    8/33

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    9/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS>archive log list;

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 1Next log sequence to archive 1

    Current log sequence 1

    SHAM>select * from tab;

    TNAME TABTYPE CLUSTERID

    ------------------------------ ------- ----------

    TAB1 TABLE

    TAB2 TABLE

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u02/coldbkp/

    SYS>startup

    ORACLE instance started.

    ..

    ...

    [Trimmed]

    Database opened.

    SYS>conn sham/sham

    Connected.

    SHAM>create table tab3 as select * from tab1;

    Table created.

    SHAM>create table tab4 as select * from tab1;

    Table created.

    SHAM>update tab4 set name='ROSELIN';

    1200000 rows updated.

    SHAM>update tab3 set name='ROSELIN';

    1200000 rows updated.

    SYS>archive log list;

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 23

    Next log sequence to archive 25

    Current log sequence 25

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    10/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    $pwd

    /u01/app/oracle/oradata/rose

    $rm *.ctl

    $ls *.ctl

    ls: *.ctl: No such file or directory

    SQL>select name from v$datafile;

    select name from v$datafile

    *

    ERROR at line 1:

    ORA-00210: cannot open the specified control file

    ORA-00202: control file: '/u01/app/oracle/oradata/rose/control01.ctl'

    ORA-27041: unable to open file

    Linux Error: 2: No such file or directory

    Additional information: 3

    SQL>shut abort;

    ORACLE instance shut down.

    $ cd /u02/coldbkp/

    $cp *.ctl /u01/app/oracle/oradata/rose/

    SYS>startup mount;

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database mounted.

    SYS>recover database using backup controlfile until cancel;

    auto

    ...

    ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below

    ORA-01194: file 1 needs more recovery to be consistent

    ORA-01110: data file 1: '/u01/app/oracle/oradata/rose/system01.dbf'

    SYS>recover cancel;

    SYS>select member from v$logfile;

    MEMBER

    -----------------------------------------

    /u01/app/oracle/oradata/rose/redo03.log

    /u01/app/oracle/oradata/rose/redo02.log

    /u01/app/oracle/oradata/rose/redo01.log

    SYS>recover database using backup controlfile until cancel;

    ORA-00279: change 1544063 generated at 09/24/2014 15:23:22 needed for thread 1ORA-00289: suggestion:

    /u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_09_24/o1_mf_1_25_%u_.arc

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    11/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    ORA-00280: change 1544063 for thread 1 is in sequence #25

    Specify log: {=suggested | filename | AUTO | CANCEL}

    /u01/app/oracle/oradata/rose/redo01.log

    Log applied.

    Media recovery complete.

    SYS> recover cancel;

    SYS>alter database open resetlogs;

    Database altered.

    SHAM>select * from tab;

    TNAME TABTYPE CLUSTERID

    ------------------------------ ------- ----------

    TAB4 TABLE

    TAB1 TABLE

    TAB2 TABLE

    TAB3 TABLE

    LOSS OF REDOLOG FILES IN ARCHIVELOG MODE

    SYS>select name, log_mode from v$database;

    NAME LOG_MODE--------- ------------ROSE ARCHIVELOG

    SYS>archive log list;Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 1

    Next log sequence to archive 1

    Current log sequence 1

    SYS>select member from v$logfile;

    MEMBER

    -----------------------------------------/u01/app/oracle/oradata/rose/redo03.log

    /u01/app/oracle/oradata/rose/redo02.log

    /u01/app/oracle/oradata/rose/redo01.log

    SYS>select group#, thread#, sequence#, members, archived, status from v$log;

    GROUP# THREAD# SEQUENCE# MEMBERS ARC STATUS

    ---------- ------- ---------- ---------- --- --------

    1 1 1 1 NO CURRENT

    2 1 0 1 YES UNUSED

    3 1 0 1 YES UNUSED

    SYS>conn sham/sham

    Connected.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    12/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SHAM>select * from tab;

    TNAME TABTYPE CLUSTERID

    ------------------------------ ------- ----------

    TAB1 TABLE

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u02/coldbkp/

    SYS>startup

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    SYS>conn sham/sham

    Connected.

    SHAM>create table tab2 as select * from tab1;

    Table created.

    SHAM>create table tab3 as select * from tab1;Table created.

    SHAM>create table tab4 as select * from tab1;

    Table created.

    SHAM>update tab1 set name='JO' where id >= 1 and id update tab2 set name='JOE' where id >=1 and id update tab3 set name='JYO_JO' where id >= 1 and id commit;

    Commit complete.

    SHAM>select name from tab4 where id=1 or id=2;

    NAME

    Jo

    Jo

    SHAM>update tab4 set name='rosalin' where id>=1 and id

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    13/33

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    14/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    STEPS TO RECOVER REDO LOG FILES IN NOARCHIVE MODE

    STEP 1: SQL> shut immediate;

    STEP 2: SQL>! cp /u03/coldbkp/*.dbf /u01/app/oracle/product/oradata/sham/

    STEP 3: SQL>! cp /u03/coldbkp/*.ctl /u01/app/oracle/product/oradata/sham/Step 4: SQL> recover database until cancel;

    STEP 5: SQL> alter database open resetlogs;

    LOSS OF REDO LOG FILES IN NOARCHIVE MODE

    SYS>select name, log_mode from v$database;

    NAME LOG_MODE

    --------- ------------

    ROSE NOARCHIVELOG

    SYS>conn sham/sham

    Connected.

    SHAM>select * from tab;

    TNAME TABTYPE CLUSTERID

    ------------------------------ ------- ----------

    TAB1 TABLE

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u02/coldbkp/

    SYS> startup

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    SYS>conn sham/sham

    Connected.

    SHAM>create table tab2 as select * from tab1;

    Table created.

    SHAM>create table tab3 as select * from tab1;

    Table created.

    SHAM>create table tab4 as select * from tab1;

    Table created.

    $cd /u01/app/oracle/oradata/rose/

    [oracle@oel5 rose]$rm -rf *.log

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    15/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS>shut abort;

    ORACLE instance shut down.

    $cd /u02/coldbkp/

    [oracle@oel5 coldbkp]$cp *.dbf /u01/app/oracle/oradata/rose/

    [oracle@oel5 coldbkp]$cp *.ctl /u01/app/oracle/oradata/rose/

    SYS>startup mount;

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database mounted.

    SYS>recover database until cancel;

    SYS>alter database open resetlogs;

    SYS>conn sham/sham

    Connected.

    SHAM>select * from tab2;

    select * from tab2

    *

    ERROR at line 1:

    ORA-00942: table or view does not exist

    LOSS OF SYSTEM TABLESPACE

    SQL>select name, log_mode from v$database;

    NAME LOG_MODE

    --------- ------------

    ROSE ARCHIVELOG

    SQL>select name from v$datafile;

    NAME

    --------------------------------------------

    /u01/app/oracle/oradata/rose/system01.dbf

    /u01/app/oracle/oradata/rose/undotbs01.dbf

    /u01/app/oracle/oradata/rose/sysaux01.dbf

    /u01/app/oracle/oradata/rose/users01.dbf

    /u01/app/oracle/oradata/rose/example01.dbf

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u02/coldbkp/

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    16/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS>startup

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    LOS S OF DATA FILE WHICH WAS NOT IN THE BACKUP

    SQL>select name, log_mode from v$database;

    NAME LOG_MODE

    --------- ------------

    ROSE ARCHIVELOG

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u03/coldbkp/rose

    SYS>startup

    ORACLE instance started.

    Total System Global Area 746586112 bytes

    Fixed Size 1275920 bytes

    Variable Size 197134320 bytes

    Database Buffers 545259520 bytes

    Redo Buffers 2916352 bytes

    Database mounted.

    Database opened.

    SYS>archive log list;

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 2

    Next log sequence to archive 4

    Current log sequence 4

    SYS>select name from v$datafile;

    NAME

    ------------------------------------------

    /u01/app/oracle/oradata/rose/system01.dbf

    /u01/app/oracle/oradata/rose/undotbs01.dbf

    /u01/app/oracle/oradata/rose/sysaux01.dbf

    /u01/app/oracle/oradata/rose/users01.dbf

    /u01/app/oracle/oradata/rose/example01.dbf

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    17/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS>create tablespace sample datafile '/u01/app/oracle/oradata/rose/test01.dbf' size 10m;

    Tablespace created.

    SYS>grant connect, resource to rose identified by rose;

    Grant succeeded.

    SYS>alter user rose default tablespace sample;

    User altered.

    SYS>select username, default_tablespace from dba_users where username='ROSE'

    USERNAME DEFAULT_TABLESPACE

    ------------------------------ ----------------------

    ROSE SAMPLE

    SYS>conn rose/rose

    Connected.

    ROSE>create table tab1(id number ,

    name varchar2(15),

    qual varchar2(15),

    city varchar2(15),

    mobile number);

    Table created.

    ROSE>begin

    for i in 1..400000 loop

    insert into tab1 values(i,'rosalin','m.sc','chennai',1234554321);

    commit;

    end loop;

    end;

    /

    PL/SQL procedure successfully completed.

    ROSE>select count(*) from tab1;

    COUNT(*)

    -------

    4000000

    SYS> !rm /u01/app/oracle/oradata/rose/sample01.dbf

    SYS> !ls /u01/app/oracle/oradata/rose/sample01.dbf

    ls: /u01/app/oracle/oradata/rose/sample01.dbf: No such file or directory

    SYS>conn rose/rose

    Connected.

    ROSE>update tab1 set name='JO' where id>=1 and id

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    18/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    ROSE>update tab1 set name='JYO' where id >= 5001 and id update tab1 set name='JYOTIKA' where id >= 10001 and id commit;

    Commit complete.

    ROSE>create table tab2 as select * from tab1;

    create table tab2 as select *from tab1

    *

    ERROR at line 1:

    ORA-01116: error in opening database file 6

    ORA-01110: data file 6: '/u01/app/oracle/oradata/rose/sample01.dbf'

    ORA-27041: unable to open file

    Linux Error: 2: No such file or directory

    Additional information: 3

    SYS>alter tablespace sample offline immediate; or

    Tablespace altered.

    SYS>alter database datafile 6 offline;

    Database altered

    SYS>alter database create datafile '/u01/app/oracle/oradata/rose/sample01.dbf'; (or)

    SYS>alter database create datafile '/u01/app/oracle/oradata/rose/sample01.dbf' as/u01/app/oracle/oradata/rose/sample01.dbf';

    Database altered.

    SYS>alter tablespace sample online;

    alter tablespace sample online

    *

    ERROR at line 1:

    ORA-01113: file 6 needs media recovery if it was restored from backup, or END

    BACKUP if it was not

    ORA-01110: data file 6: '/u01/app/oracle/oradata/rose/sample01.dbf'

    SYS>recover tablespace sample;

    ORA-00279: change 417154 generated at 10/01/2014 01:52:59 needed for thread 1

    ORA-00289: suggestion :

    /u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_10_01/o1_mf_1_4_b2p6cf6q_.arc

    ORA-00280: change 417154 for thread 1 is in sequence #4

    Specify log: {=suggested | filename | AUTO | CANCEL}

    auto

    ..

    ...

    [Trimmed]

    Log applied.

    Media recovery complete.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    19/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS>altter tablespace sample online;

    Tablespace altered.

    SYS>select * from tab1 where id=1001 or id=1002;

    ID NAME QUAL CITY MOBILE

    ------ ------- ------- --------- ----------

    1001 JO m.sc chennai 1234554321

    1002 JO m.sc chennai 1234554321

    LOSS OF SINGLE CONTROL FILE

    SYS>select name, log_mode from v$database;

    NAME LOG_MODE

    --------- ------------ROSE ARCHIVELOG

    SYS> select name from v$controlfile;

    NAME

    --------------------------------------------

    /u01/app/oracle/oradata/rose/control01.ctl

    /u02/app/oracle/oradata/rose/control02.ctl

    /u03/app/oracle/oradata/rose/control03.ctl

    $cd /u03/app/oracle/oradata/rose/

    $rm control03.ctl

    SYS>update rose.tab1 set name='ORACLE';

    400000 rows updated.

    SYS>select current_scn from v$database;

    select current_scn from v$database

    *

    ERROR at line 1:

    ORA-00210: cannot open the specified control file

    ORA-00202: control file: '/u03/app/oracle/oradata/rose/control03.ctl'

    ORA-27041: unable to open file Linux Error: 2: No such file or directory

    SYS> shut abort;

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp control01.ctl /u03/app/oracle/oradata/rose/control03.ctl

    SYS>startup

    ORACLE instance started.

    ..

    ....[Trimmed]

    Database opened.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    20/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS> select * from rose.tab1 where id=1 or id=2;

    ID NAME QUAL CITY MOBILE

    --- ------- ---------- ---------- -------------

    1 ORACLE m.sc chennai 1234554321

    2 ORACLE m.sc chennai 1234554321

    LOSS OF UNDO TABLESPACE

    SYS> select name, log_mode from v$database;

    NAME LOG_MODE

    --------- ------------

    ROSE ARCHIVELOG

    SYS> select name from v$datafile;

    NAME

    -------------------------------------------

    /u01/app/oracle/oradata/rose/system01.dbf

    /u01/app/oracle/oradata/rose/untbs01.dbf

    /u01/app/oracle/oradata/rose/sysaux01.dbf

    /u01/app/oracle/oradata/rose/users01.dbf

    /u01/app/oracle/oradata/rose/example01.dbf

    SYS> show parameter undo;

    NAME TYPE VALUE

    ------------------------------------ ----------- ----------

    undo_management string AUTO

    undo_retention integer 900

    undo_tablespace string UNDOTBS1

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u03/coldbkp/rose

    SYS>startup

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    SYS> conn rose/rose

    Connected.

    ROSE> update tab1 set name='JO_JYO';

    1000000 rows updated.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    21/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    $rm /u01/app/oracle/oradata/rose/undotbs01.dbf

    $ls /u01/app/oracle/oradata/rose/undotbs01.dbf

    ls: /u01/app/oracle/oradata/rose/undotbs01.dbf: No such file or directory

    ROSE> update rose.tab1 set name='JO';

    update tab1 set name='JO'*

    ERROR at line 1:

    ORA-01116: error in opening database file 2

    ORA-01110: data file 2: '/u01/app/oracle/oradata/rose/undotbs01.dbf'

    ORA-27041: unable to open file

    Linux Error: 2: No such file or directory

    Additional information: 3

    SYS> alter database datafile 2 offline;

    alter database datafile 2 offline

    *

    ERROR at line 1:

    ORA-00603: ORACLE server session terminated by fatal error

    SYS> select file#, name , status from v$datafile;

    FILE# NAME STATUS

    1 /u01/app/oracle/oradata/rose/system01.dbf SYSTEM

    2 /u01/app/oracle/oradata/rose/undotbs01.dbf RECOVER

    3 /u01/app/oracle/oradata/rose/sysaux01.dbf ONLINE

    4 /u01/app/oracle/oradata/rose/users01.dbf ONLINE

    5 /u01/app/oracle/oradata/rose/example01.dbf ONLINE

    $cd /u03/coldbkp/rose/

    $cp undotbs01.dbf /u01/app/oracle/oradata/rose/

    ROSE> update rose.tab3 set name='JYO_JO';

    update rose.tab3 set name='JYO_JO'

    *

    ERROR at line 1:

    ORA-01122: database file 2 failed verification check

    ORA-01110: data file 2: '/u01/app/oracle/oradata/rose/undotbs01.dbf'

    ORA-01208: data file is an old version - not accessing current version

    SYS> recover datafile 2;

    ORA-00279: change 412728 generated at 10/10/2014 22:59:32 needed for thread 1

    ORA-00289: suggestion:

    /u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_10/o1_mf_1_2_b3j64mkm_.arc

    ORA-00280: change 412728 for thread 1 is in sequence #2

    Specify log: {=suggested | filename | AUTO | CANCEL}

    auto

    ..

    [Trimmed]

    Log applied.

    Media recovery complete.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    22/33

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    23/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    $mv undotbs01.dbf undotbs01.dbfx

    [oracle@oel5 sham]$ ls -l undo*

    -rw-r----- 1 oracle oinstall 293609472 Oct 12 19:59 undotbs01.dbfx

    SYS> startup;

    ORACLE instance started.

    .

    ..

    [Trimmed]

    Database mounted.

    ORA-01157: cannot identify/lock data file 2 - see DBWR trace file

    ORA-01110: data file 2: '/u01/app/oracle/oradata/sham/undotbs01.dbf'

    SYS> alter system set undo_management='manual' scope=spfile;

    System altered.

    SYS> shut immediate;

    ORA-01109: database not open

    Database dismounted.

    ORACLE instance shut down.

    SYS> startup

    ORACLE instance started.

    .

    ..

    [Trimmed]

    Database mounted.

    ORA-01157: cannot identify/lock data file 2 - see DBWR trace file

    ORA-01110: data file 2: '/u01/app/oracle/oradata/sham/undotbs01.dbf'

    SYS> show parameter undo;

    NAME TYPE VALUE

    ------------------------------------ ----------- --------

    undo_management string MANUAL

    undo_retention integer 900

    undo_tablespace string UNDOTBS1

    SYS>alter database datafile'/u01/app/oracle/oradata/rose/undotbs01.dbf' offline drop; (or)

    SYS> alter database datafile 2 offline drop;

    Database altered.

    SYS> alter database open;

    Database altered.

    SYS> drop tablespace undotbs1;

    Tablespace dropped.

    SYS>create undo tablespace undotbs datafile '/u01/app/oracle/oradata/sham/untbs01.dbf' size 50m;

    Tablespace created.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    24/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS> alter system set undo_tablespace='undotbs' scope=spfile;

    System altered.

    SYS> alter system set undo_management='auto' scope=spfile;

    System altered.

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    SYS> startup;

    ORACLE instance started.

    Total System Global Area 746586112 bytes..

    [Trimmed]

    Database mounted.Database opened.

    SYS> show parameter undo;

    NAME TYPE VALUE

    ------------------------------------ ----------- ------------------------------

    undo_management string AUTO

    undo_retention integer 900

    undo_tablespace string undotbs

    SYS> select name from v$datafile;

    NAME

    --------------------------------------------

    /u01/app/oracle/oradata/sham/system01.dbf

    /u01/app/oracle/oradata/sham/untbs01.dbf

    /u01/app/oracle/oradata/sham/sysaux01.dbf

    /u01/app/oracle/oradata/sham/users01.dbf

    /u01/app/oracle/oradata/sham/example01.dbf

    LOSS OF SYSAUX TABLESPACE

    SYS> select name, log_mode from v$database;

    NAME LOG_MODE

    --------- ------------

    ROSE ARCHIVELOG

    SYS> archive log list;

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 2Next log sequence to archive 2

    Current log sequence 4

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    25/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS> select name from v$datafile;

    NAME

    --------------------------------------------

    /u01/app/oracle/oradata/rose/system01.dbf

    /u01/app/oracle/oradata/rose/undotbs01.dbf

    /u01/app/oracle/oradata/rose/sysaux01.dbf

    /u01/app/oracle/oradata/rose/users01.dbf

    /u01/app/oracle/oradata/rose/example01.dbf

    SYS>shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u03/coldbkp/rose

    SYS>startup

    ORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    SHAM> update tab1 set name='JO';

    100000 rows updated.

    SHAM> update tab2 set name='JYO';

    100000 rows updated.

    $mv sysaux01.dbf sysaux01.dbfx

    $ls -l sysaux01.dbfx

    -rw-r----- 1 oracle oinstall 251666432 Oct 12 22:27 sysaux01.dbfx

    SYS> alter tablespace sysaux offline;

    alter tablespace sysaux offline

    *

    ERROR at line 1:ORA-01116: error in opening database file 3

    ORA-01110: data file 3: '/u01/app/oracle/oradata/rose/sysaux01.dbf'

    ORA-27041: unable to open file

    Linux Error: 2: No such file or directory

    Additional information: 3

    $cd /u03/coldbkp/rose/

    [oracle@oel5 sham]$cp sysaux01.dbf /u01/app/oracle/oradata/rose/

    SYS> recover datafile 3;

    ORA-00283: recovery session canceled due to errors

    ORA-01124: cannot recover data file 3 - file is in use or recovery

    ORA-01110: data file 3: '/u01/app/oracle/oradata/rose/sysaux01.dbf'

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    26/33

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    27/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS> grant connect, resource to sham identified by sham;

    Grant succeeded.

    SYS> conn sham/sham

    Connected.

    SHAM> set time on;

    17:29:44SHAM> @sample.sql;

    Table created.

    PL/SQL procedure successfully completed.

    17:32:12SHAM> select * from tab1 where id=1;

    ID NAME QUAL CITY MOBILE

    -- -------- -------- ------- ----------

    1 rosalin m.sc chennai 1234554321

    17:32:57 SHAM> update tab1 set name='oracle';

    100000 rows updated.

    17:33:27 SHAM> commit;

    Commit complete.

    17:33:32 SHAM>update tab1 set name='ORACLEDB' where id=1000;

    1 row updated.

    17:34:23 SHAM> conn / as sysdbaConnected.

    17:35:06 SYS>alter system switch logfile;

    System altered.

    17:35:12 SYS> /

    System altered.

    17:35:12 SYS> /

    System altered.

    17:35:18 SYS> drop user sham cascade;

    User dropped.

    17:35:57 SYS> shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $mv *.dbf /u01/

    $ls -l *.dbf

    ls: *.dbf: No such file or directory

    $cd /u03/coldbkp/rose/

    [oracle@oel5 rose]$cp *.dbf /u01/app/oracle/oradata/rose/

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    28/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    17:36:24 SYS>startup mount

    ORACLE instance started.

    ..

    ....

    [Trimmed]Database mounted.

    17:44:32 SYS>recover automatic database until time '2014-10-15 17:35:10';

    Media recovery complete.

    17:52:50 SYS> alter database open resetlogs;

    Database altered.

    17:53:35 SYS> conn sham/sham

    Connected.

    SHAM> select * from tab;

    TNAME TABTYPE CLUSTERID

    ------------------------------ ------- ----------

    TAB1 TABLE

    SHAM> select * from tab1 where id=1 or id=1000;

    ID NAME QUAL CITY MOBILE

    ---- ------ --------------- ------- -----------

    1 oracle m.sc chennai 1234554321

    1000 ORACLEDB m.sc chennai 1234554321

    POINTS TO NOTE

    To recover to a past point in time you have to RESTORE the database from a backup older than the

    recovery point in time. Make a new complete backup, as the database is open in a new incarnation

    and previous archived log are not relevant.

    LOSS OF TEMPORARY TABLESPACE

    SYS> select name, log_mode from v$database;

    NAME LOG_MODE

    --------- ------------

    ROSE ARCHIVELOG

    SYS> select * from v$tablespace;

    TS# NAME INC BIG FLA ENC

    ---------- ------------------------------ --- --- --- ---

    0 SYSTEM YES NO YES

    1 UNDOTBS1 YES NO YES

    2 SYSAUX YES NO YES

    4 USERS YES NO YES

    3 TEMP NO NO YES

    6 EXAMPLE YES NO YES

    6 rows selected.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    29/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS> select name from v$tempfile;

    NAME

    ----------------------------------------

    /u01/app/oracle/oradata/rose/temp01.dbf

    SYS> shut immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    $cd /u01/app/oracle/oradata/rose/

    $cp *.* /u03/coldbkp/rose

    $rm /u01/app/oracle/oradata/rose/temp01.dbf

    SYS>startupORACLE instance started.

    ..

    ....

    [Trimmed]

    Database opened.

    $ tail -f /u01/app/oracle/admin/rose/bdump/alert_rose.log

    ...

    Re-creating tempfile /u01/app/oracle/oradata/rose/temp01.dbf

    From 10g, Oracle is able to detect the missing temporary file and recreate it on the same location.

    SCENARIO II

    SYS> select file#, name, status from v$tempfile;

    FILE# NAME

    ------ -----------------------------------------

    1 /u01/app/oracle/oradata/rose/temp01.dbf

    $ rm /u01/app/oracle/oradata/rose/temp01.dbf

    SYS> conn sham/sham

    Connected.

    SHAM> select * from tab1 order by id DESC;

    ..

    ...

    more rows are displayed

    $ tail -f /u01/app/oracle/admin/rose/bdump/alert_rose.log

    ORA-01116: error in opening database file 201

    ORA-01110: data file 201: '/u01/app/oracle/oradata/rose/temp01.dbf'

    ORA-27041: unable to open file

    Linux Error: 2: No such file or directory

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    30/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    SYS> create temporary tablespace temptbs tempfile

    '/u01/app/oracle/oradata/rose/temp01.dbf' size 10m;

    Tablespace created.

    SYS> alter database default temporary tablespace temptbs;

    Database altered.

    SYS> drop tablespace temp;

    Tablespace dropped.

    SYS> select * from v$tablespace;

    TS# NAME INC BIG FLA ENC

    ---------- ----- ---- ----- -----

    0 SYSTEM YES NO YES

    1 UNDOTBS1 YES NO YES2 SYSAUX YES NO YES

    4 USERS YES NO YES

    6 EXAMPLE YES NO YES

    7 TEMPTBS NO NO YES

    6 rows selected.

    SYS> select name from v$tempfile;

    NAME

    -----------------------------------------

    /u01/app/oracle/oradata/rose/temp01.dbf

    POINTS TO NOTE

    UNIX/LINUX provide us with a command that does a safer remove.

    $rm -i

    $rm -i undotbs01.dbfx

    rm: remove regular file `undotbs01.dbfx'?

    RECOVERY COMMANDS POINTS TO NOTE

    SQL> alter database recover automatic using backup controlfile until cancel;

    SQL> recover database using backup controlfile until cancel;

    SQL> recover database until cancel;

    ALTER DATABASE is the basic SQL command to recover. RECOVER is an SQL command that automates

    that, asking for the next archivelog. It is the recommended way (from sqlplus or rman).

    USING BACKUP CONTROLFILE tells Oracle to assume that there are transactions and redo beyond the

    controlfile that is used. i.e. It tells to oracle that you don't have the current control file.

    So the recovery should continue beyond what is recorded in the control file. And you will need

    to open resetlogs at the end to restart a redo log sequence.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    31/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    STEPS TO RECOVER NON SYSTEM TABLESPACE IS MISSING

    Recovery of a missing datafile that has no backups (DB is up and running )

    Pre Requisites: All relevant archived logs.

    STEP 1 alter tablespace offline immediate;

    STEP 2 alter database create datafile '/path/filename.dbf';

    STEP 3 recover tablespace ;

    STEP 4 alter tablespace online;

    If the create datafile command needs to be executed to place the datafile on a location different

    than the original always use following query given below.

    SQL>alter database create datafile '/u01/data/newdata01.dbf' as '/u02/data/newdata01.dbf

    If aNON SYSTEMdatafile that was not backed up since the last backup is missing, recovery can

    be performed if allarchived logs since the creation of the missing datafile exist.

    Complete Open Database Recovery (Database is Initially closed)

    If NON SYSTEM is missing or corrupted and the database crashed, recovery can be performed after

    the database is open. Pre requisites: A closed or open database backup and archived logs.

    When startup database we would get ora-1157 & ora-1110and the name of the missing datafile, the

    database will be remained in mount phase, then use OS command cpto restore the missing datafile

    to its original location,

    STEP 1 $cp -p /u03/coldbkp/rose/users01.dbf /u01/app/oracle/ordata/rose/

    STEP 2 alter database datafile3 offline;

    STEP 3 alter database open;

    STEP 4 recover datafile 3;

    STEP 5 alter tablespace online;

    In step 2 Tablespace name cannot be used because the database is not opened.

    Complete Open Database Recovery

    If a NON SYSTEM tablespace is missing or corrupted while the database is open, recovery can be

    performed while the database is up and running. Pre requisites are, a closed or open database

    backup and archived logs.

    Use OS command cp to restore the missing or corrupted datafile to its original location.

    STEP 1 $cp -p /u03/coldbkp/rose/users01.dbf /u01/app/oracle/oradata/rose/users01.dbf

    STEP 2 alter tablespace offline immediate;

    STEP 3 recover tablespace ;

    STEP 4 alter tablespace online;

    Restore &Recovery of a Datafile to a different location.

    If a NON SYSTEM datafile is missing and its original location not available, restore can be made

    to a different location and recovery performed. Pre requisites are all relevant archived logs.

    Use OS commands to restore the missing or corrupted datafile to the new location.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    32/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    Exploring the Oracle DBA Technology by Gunasekaran , Thiyagu

    STEP 1 $ cp -p /u03/coldbkp/rose/users01.dbf /u02/app/oracle/oradata/rose/users01.dbf

    STEP 2 alter tablespace offline immediate;

    STEP 3 alter tablespace rename datafile '/old_path/user01.dbf' to

    '/new_path/users01.dbf';

    STEP 4 recover tablespace ;STEP 5 alter tablespace online;

    Control File Recovery

    If control files are missing, database crash. Pre requisites: A backup of your control file and

    all relevant archived logs. Database startup gives us (ora-205, missing controlfile, instance start

    but database is not MOUNTED. Use OS command cp to restore the missing control file to its

    original location:

    STEP 1 $cp -p /u03/coldbkp/rose/*.ctl /u01/app/oracle/oradata/rose/

    STEP 3 alter database mount;

    STEP 4 recover automatic database using backup controlfile;

    STEP 5 alter database open resetlogs;

    NOTE:Take a new complete backup, as the database is open in a new incarnation and previous archived

    log are not relevant.

    Incomplete Recovery, Until Time/Sequence/Cancel

    Incomplete recovery means when an archived log is missing, so recovery can only be made until the

    previous sequence, or when an important object was dropped, and recovery needs to be made until

    before the object was dropped.

    Pre requisites are a closed or open database backup and archived logs, the timeor sequencethat

    the 'until' recovery needs to be performed. If the database is open follow given steps,

    STEP 1 shutdown abort;

    Use OS command cp to restore all datafiles to its original locations:

    STEP 2 $cp -p /u03/coldbkp/rose

    STEP 3 startup mount;

    STEP 4 recover automatic database until time '2014-01-31:14:40:45';

    STEP 5 alter database open resetlogs;

    NOTE:Take a new complete backup, as the database is open in a new incarnation and previous

    archived log are not relevant. Alternatively we can use instead of until time, until sequence or

    until cancel.

    STEPS TO RECOVER SYSTEM TABLESPACE IS MISSING

    If the system tablespace is missing or corrupted the database cannot be started up so a complete

    closed database recovery must be performed. Pre requisites are a closed or open database backup

    and archived logs.

    Use OS command cp to restore the missing or corrupted system datafile to its original

    location.

  • 8/10/2019 COLD BACKUP & RECOVERY SCENARIOS.pdf

    33/33

    BACKUP AND RECOVERY USING COLD BACKUP | ARCHIVELOG Vs NOARCHIVELOG

    STEP 1 $cp -p /u03/coldbkp/rose/system01.dbf /u01/app/oracle/oradata/rose/system01.dbf

    STEP 2 startup mount;

    STEP 3 recover datafile 1;

    STEP 4 alter database open;

    IF UNDO TABLESPACE BECOMES UNAVAILABLE

    If you receive ORA-01110, follow given steps:

    STEP 1 Startup your database in mount mode only.

    STEP 2 Change the undo_management parameter to manual and bounce your database in mount mode again.

    STEP 3 Drop the undo datafile using the offline option.

    STEP 4 Open the database now.

    STEP 5 Drop the Undo Tablespace.

    STEP 6 Create a new undo tablespaceSTEP 7 Change the undo_management parameter to auto:

    STEP 8 Bounce(restart)your database.