HOT BACKUP
INCONSISTENT BACKUP
OFFLINE BACKUP
PHYSICAL BACKUPS
Cold backup can be taken after you shutdown the database, now database is unavailable for database
users. To perform cold backup, that database can be in ARCHIVELOG or NOARCHIVELOG mode.
Hot backup is active backup, it can be done when the database is running and data is being updated
or read by database users. We can perform online backup and HOT BACKUP does NOT require downtime
and database MUST be in ARCHIVELOG mode, because the archiver (ARCH) background process will make
a copy of online redo log files to archive destination FRA by default.
WHY HOT BACKUP IS INCONSISTENT ?
Once put your database in backup mode, Oracle only freezes the datafile headers, but it keep
updating the blocks inside the datafile. So their headers are at the same SCN, but the database
blocks are not. The database writer (DBWR) is updating the file.
During hot backup, when we are copying a data file meanwhile, the database is writing to the data
file by DBWR. Oracle database is also writing to the redo. So the split is in the copied data
file.
Later, when a recovery occurs, the redo is used to reconcile the split block.
DBWRn writes
The first change to a data block, the entire block is copied to the redo log buffer (part of SGA)
as redo entry which is later moved to the redo log file. i.e. (The entire block is brought into
the redo log buffer. Oracle writes the first DML for the block. Consecutive (repeated) changes to
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
the same block will NOT cause the entire block to be logged into redo log buffer, but just the
change vectors. i.e. (Subsequent transactions to that block are written as normal. Hot backup
generates huge amount of redo data, it is dramatically slows down your database.
Redo_Info.txt
Normally, Oracle logs an entry in the redologs for every change in the database, but it does NOT
log the whole image of the database block. But during the HOT backup process the first time a block
is changed, Oracle is logging of full images of changed DB blocks to the redologs. So excessive
redo log generation is huge rather than normal mode and also depends on amount of block changes
during hot backup. If we keep our entire database in begin backup mode for longer duration,
Excessive redo leads to more number of log switches and more number of archives in the archive
destination. If archive destination is full, Database goes to hung state.
In case of redo log generation, already i said, each block will be recorded into the redo log files
from RLBC, the first time if the block is changed in hot backup. Whole transaction information is
recorded in redolog, thats why entire block is written to redo the first time you modify it.
FRACTURED BLOCK IN ORACLE
Typically, Oracle database blocks are a multiple of O/S blocks. Oracle default block size is 8k
and OS block size is 4k, Let it be Oracle is writing to the data files at 8kb block size, while
the OS backup copy is reading 4k. The order in which 4k block is read is determined by the OS and
it is completely independent of oracle.
In user managed backup, an operating system utility can back up a data file at the same time DBWR
is updating the file. It is possible the OS utility (cp) command
state, so that the block that is copied to the backup media and that block is updated in its first
half, while the second half contains older data. In this case, the block is that is not consistent
with an SCN.
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
The OS copy could read first or second 4k (half of the oracle block) just consider before dbwr
updates the data in that block) Once the block gets updated with new image subsequently the os
utility copy reads the remaining first or second half of the block.(First 4k block is written at
one point time while the second 4k
that particular block now contains two splits from different point in time, perhaps with different
SCNs this is fractured block or split block.
Now you can understand in begin backup mode, why SCN of the datafile header does NOT change. The
current SCN is recorded in redo but not in datafile. This is ensure oracle will recover the datafile
contents with redo entries.
When we restore the file which contains (fractured blocks) require recovery because once oracle
read those blocks then the blocks considered as corrupt. We cannot do simple restore and must
perform recovery. During recovery, the fractured block will be replaced by the complete block from
redo and just we can apply the change vectors.
Fractured blocks can be prevented during backups by using Recovery Manager. Rman never copies a
fractured block Rman knows the correct order to read the blocks and it continuously rereads the
block until it gets a consistent image.
Usually Oracle logs an entry in the redologs for each and every change in the database, but it
does NOT log the whole image of the database block. But during the hot backup oracle brings the
entire block is copied to the redo log buffer. Fracture block can occur when backup/copy utility
reads at smaller block size than oracle blocks.
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
LOG_MODE
--------- -----------SHAM
NOARCHIVELOG
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Once a hot backup is started, the database cannot be shutdown with the NORMAL or IMMEDIATE option.
An error message will indicate the database is in backup mode.
LOG_MODE
OPEN_MODE
ARCHIVELOG
READ WRITE
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
CHANGE#
TIME
ACTIVE
432768
29-OCT-14
ACTIVE
432768
29-OCT-14
ACTIVE
432768
29-OCT-14
ACTIVE
432768
29-OCT-14
ACTIVE
432768
29-OCT-14
$ cd /u01/app/oracle/oradata/sham/
$ cp *.dbf *.ctl /u03/hotbkp/sham/
SYS> grant connect, resource to sham identified by sham;
Grant succeeded.
SYS> conn sham/sham
Connected.
SHAM> @sample.sql;
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
SHAM> update tab3 set name='ORACLE';
936000 rows updated.
SHAM> create table tab4 as select * from tab1;
Table created.
SHAM> commit;
Commit complete.
SYS> update sham.tab5 set name=FINAL;
192000 rows updated.
SYS> alter database end backup;
Database altered.
SYS> alter system archive log current;
System altered.
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
$ cd /u01/app/oracle/oradata/sham/
[oracle@oel5 sham]$ rm -f *
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
SYS> startup mount;
ORACLE instance started.
..
[Trimmed]
Database mounted
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 440398 generated at 10/30/2014 02:15:29 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_30/o1_mf_1_8_%u_.arc
ORA-00280: change 440398 for thread 1 is in sequence #8
ORA-00278: log file
'/u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_30/o1_mf_1_8_%u_.arc' no longer
needed for this recovery
ORA-00308: cannot open archived log
'/u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_30/o1_mf_1_8_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SYS> recover cancel;
Media recovery complete.
SYS> alter database open resetlogs;
Database altered.
LOG_MODE
OPEN_MODE
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
SYS> alter database begin backup;
Database altered.
SYS> select current_scn from v$database;
CURRENT_SCN
----------432810
SYS> select * from v$backup;
FILE# STATUS
CHANGE#
TIME
ACTIVE
554855
29-OCT-14
ACTIVE
554855
29-OCT-14
ACTIVE
554855
29-OCT-14
ACTIVE
554855
29-OCT-14
ACTIVE
554855
29-OCT-14
$ cd /u01/app/oracle/oradata/sham/
$ cp *.dbf *.ctl /u03/hotbkp/sham/
SYS> grant connect, resource to sham identified by sham;
Grant succeeded.
SHAM>@sample.sql;
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfuly completed.
Table created.
PL/SQL procedure successfully completed.
SHAM> update tab3 set name='ORACLE';
886000 rows updated.
SHAM> create table tab4 as select * from tab1;
Table created.
SHAM> commit;
Commit complete.
SYS> update sham.tab5 set name=FINAL;
190000 rows updated.
SYS> alter database end backup;
Database altered.
SYS> alter system archive log current;
System altered.
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
$ mv users01.dbf users01.dbf.tmp
$ ls -l users*
-rw-r----- 1 oracle oinstall 26222592 Oct 30 03:27 users01.dbf.tmp
SYS> conn sham/sham
Connected.
SHAM> create table sample as select * from tab1;
create table sample as select * from tab1
*
ERROR at line 1:
ORA-01116: error in opening database file 4
ORA-01110: data file 4: '/u01/app/oracle/oradata/sham/users01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
$ cd /u03/hotbkp/sham/
[oracle@oel5 sham]$ cp users01.dbf /u01/app/oracle/oradata/sham/
SYS> recover datafile 4;
ORA-00283: recovery session canceled due to errors
ORA-01124: cannot recover data file 4 - file is in use or recovery
ORA-01110: data file 4: '/u01/app/oracle/oradata/sham/users01.dbf'
SYS> alter database datafile 4 offline;
Database altered.
SYS> recover datafile 4;
ORA-00279: change 432814 generated at 10/30/2014 03:09:15 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_30/o1_mf_1_3_b52qwycz_.arc
ORA-00280: change 432814 for thread 1 is in sequence #3
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
..
...
[Trimmed]
Log applied.
Media recovery complete.
SYS> alter database datafile 4 online;
Database altered.
SYS> conn sham/sham
Connected.
SQL> select name from tab5 where id=1;
NAME
----FINAL
LOSS OF SYSTEM DATAFILE
SQL> select name, log_mode from v$database;
NAME
LOG_MODE
--------- -----------SHAM
ARCHIVELOG
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
STATUS
CHANGE#
TIME
ACTIVE
433660
30-OCT-14
ACTIVE
433660
30-OCT-14
ACTIVE
433660
30-OCT-14
ACTIVE
433660
30-OCT-14
ACTIVE
433660
30-OCT-14
$ cd /u01/app/oracle/oradata/sham/
$ cp *.dbf *.ctl /u03/hotbkp/sham/
SYS> grant connect ,resource to rose identified by rose;
Grant succeeded.
SYS> conn rose/rose
Connected.
SYS>@sample.sql;
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
SYS> create table tab4 as select * from tab1;
Table created.
SYS> insert into tab4 select * from tab4;
1500 rows created.
SYS> update tab1 set name='ORACLE';
256 rows updated.
SYS> commit;
Commit complete.
$ mv system01.dbf system01.dbf.tmp
-rw-r----- 1 oracle oinstall 461381632 Oct 30 05:01 system01.dbf.tmp
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
/u01/app/oracle/oradata/sham/
LOG_MODE
--------- -----------SHAM
ARCHIVELOG
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
/u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_30/o1_mf_1_4_b54k52nj_.arc
ORA-00280: change 439145 for thread 1 is in sequence #4
ORA-00278: log file
'/u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_30/o1_mf_1_3_b54k4r4n_.arc' no
longer needed for this recovery
Log applied.
Media recovery complete.
SYS> alter database datafile 3 online;
Database altered.
SYS> select name from v$datafile;
NAME
------------------------------------------/u01/app/oracle/oradata/sham/system01.dbf
/u01/app/oracle/oradata/sham/undotbs01.dbf
/u01/app/oracle/oradata/sham/sysaux01.dbf
/u01/app/oracle/oradata/sham/users01.dbf
/u01/app/oracle/oradata/sham/example01.dbf
LOG_MODE
--------- -----------SHAM
ARCHIVELOG
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
DEFAULT_TABLESPACE
------------------------------ ---------------------ROSE
SAMPLE
ROSE>@sample.sql;
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
ROSE> create table tab4 as select * from tab1;
Table created.
ROSE> insert into tab4 select * from tab4;
192000 rows created.
ROSE> update tab4 set name='ORACLE';
192000 rows updated.
ROSE> commit;
Commit complete.
SYS> alter database end backup;
*
ERROR at line 1:
ORA-01260: warning: END BACKUP succeeded but some files found not to be in backup mode
SYS> select * from v$backup;
FILE# STATUS
CHANGE# TIME
432854 30-OCT-14
2 NOT ACTIVE
432854 30-OCT-14
3 NOT ACTIVE
432854 30-OCT-14
4 NOT ACTIVE
432854 30-OCT-14
5 NOT ACTIVE
432854 30-OCT-14
6 NOT ACTIVE
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
TABTYPE
CLUSTERID
TABLE
TAB3
TABLE
TAB4
TABLE
TAB5
TABLE
BIN$BqdD7PLiyBbgUKjAg/FVJg==$0 TABLE
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
********
STATUS
CHANGE#
TIME
ACTIVE
412111
30-OCT-14
ACTIVE
412111
30-OCT-14
ACTIVE
412111
30-OCT-14
ACTIVE
412111
30-OCT-14
ACTIVE
412111
30-OCT-14
$ cd /u01/app/oracle/oradata/sham
$ cp *.dbf *.ctl /u03/hotbkp/sham/
SYS> grant connect, resource to sham identified by sham;
Grant succeeded.
SYS> conn sham/sham
Connected.
SHAM>@sample.sql
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
$ mv users01.dbf users01.dbf.tmp
[oracle@oel5 sham]$ ls -l users*
-rw-r----- 1 oracle oinstall 32776192 Oct 30 23:49 users01.dbf.tmp
SYS> alter database datafile 4 resize 100m;
alter database datafile 4 resize 100m
*
ERROR at line 1:
ORA-01565: error in identifying file '/u01/app/oracle/oradata/sham/users01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
$ cd /u03/hotbkp/sham/
[oracle@oel5 sham]$ cp users01.dbf /u02/app/oracle/oradata/sham/
SYS> alter tablespace users rename datafile
'/u01/app/oracle/oradata/sham/users01.dbf' to '/u02/app/oracle/oradata/sham/users01.dbf';
Tablespace altered.
SYS> recover tablespace users;
ORA-00279: change 412411 generated at 10/31/2014 14:19:20 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_31/o1_mf_1_2_b56mo459_.arc
ORA-00280: change 412411 for thread 1 is in sequence #2
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
..
...
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
[Trimmed]
ORA-00279: change 424679 generated at 10/31/2014 14:26:29 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_31/o1_mf_1_4_b56mpcbg_.arc
ORA-00280: change 424679 for thread 1 is in sequence #4
ORA-00278: log file
'/u01/app/oracle/flash_recovery_area/SHAM/archivelog/2014_10_31/o1_mf_1_3_b56moy70_.arc'
no longer needed for this recovery
Log applied.
Media recovery complete.
SYS> alter tablespace users online;
Tablespace altered.
SYS> alter tablespace users online;
Tablespace altered.
$ cd /u01/app/oracle/oradata/sham/
$ mv control01.ctl control01.ctl.tmp
-rw-r----- 1 oracle oinstall 7061504 Oct 31 18:58 control01.ctl.tmp
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
$ cd /u01/app/oracle/oradata/rose
$ cp *.dbf *.ctl /u03/hotbkp/rose/
SYS> grant connect, resource to sham identified by sham;
Grant succeeded.
SHAM>@sample.sql
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
SHAM> create table tab4 as select * from tab1;
Table created.
SHAM> update tab4 set name='UPDATE_ORACLEDB';
336000 rows updated.
SHAM> commit;
Commit complete.
SYS> alter database end backup;
Database altered.
SYS> archive log list;
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
[Trimmed]
ORA-00279: change 428023 generated at 10/31/2014 21:29:59 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_10_31/o1_mf_1_9_%u_.arc
ORA-00280: change 428023 for thread 1 is in sequence #9
ORA-00278: log file
'/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_10_31/o1_mf_1_8_b57dhz7q_.arc'
no longer needed for this recovery
ORA-00308: cannot open archived log
'/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_10_31/o1_mf_1_9_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
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'
# ON NEW TERMINAL
SYS> select * from v$log;
GROUP#
THREAD#
SEQUENCE#
BYTES
MEMBERS ARC
STATUS
FIRST_CHANGE# FIRST_TIME
--------
------------- -------------
52428800
YES
INACTIVE
52428800
YES
UNUSED
52428800
NO
CURRENT
383537
31-OCT-14
0
410135
31-OCT-14
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
LOG_MODE
---------ARCHIVELOG
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
CHANGE# TIME
412210 01-NOV-14
2 ACTIVE
412210 01-NOV-14
3 ACTIVE
412210 01-NOV-14
4 ACTIVE
412210 01-NOV-14
$ cd /u01/app/oracle/oradata/rose
$ cp *.dbf *.ctl /u03/hotbkp/rose/
SYS> grant connect, resource to rose identified by rose;
Grant succeeded.
SYS> conn rose/rose
Connected.
ROSE>@sample.sql;
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
ROSE> create table tab4 as select * from tab1;
Table created.
ROSE> insert into tab4 select * from tab4;
216000 rows created.
ROSE> /
216000 rows created.
ROSE> update tab4 set name='UPDATE_FINAL';
432000 rows updated.
ROSE> commit;
Commit complete.
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
373293056 bytes
..
...
[Trimmed]
Database mounted.
SYS> recover database using backup controlfile until cancel;
ORA-00279: change 412210 generated at 11/01/2014 13:02:51 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_11_01/o1_mf_1_2_b593fn8v_.arc
ORA-00280: change 412210 for thread 1 is in sequence #2
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
..
...
[Trimmed]
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
'/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_11_01/o1_mf_1_6_b593gz6q_.arc' no
longer needed for this recovery
ORA-00308: cannot open archived log
'/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_11_01/o1_mf_1_7_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01195: online backup of file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/rose/system01.dbf'
SYS> select * from v$log;
GROUP#
THREAD#
SEQUENCE#
BYTES
MEMBERS
ARC
STATUS
--- -------
FIRS
-------------
52428800
YES
INACTIVE
52428800
YES
UNUSED
52428800
NO
CURRENT
01-NOV-2014
01- NOV-2014
STATUS
TYPE
MEMBER
ONLINE
/u01/app/oracle/oradata/rose/redo03.log
ONLINE
/u01/app/oracle/oradata/rose/redo02.log
ONLINE
/u01/app/oracle/oradata/rose/redo01.log
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01195: online backup of file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/rose/system01.dbf'
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
STATUS
CHANGE#
TIME
ACTIVE
412315
01-NOV-14
ACTIVE
412315
01-NOV-14
ACTIVE
412315
01-NOV-14
ACTIVE
412315
01-NOV-14
ACTIVE
412315
01-NOV-14
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
$ cd /u01/app/oracle/oradata/rose/
$ cp *.dbf *.ctl /u03/hotbkp/rose/
SYS> grant connect, resource to rose identified by rose;
Grant succeeded.
SYS> conn rose/rose
Connected.
ROSE>@sample.sql
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
Table created.
PL/SQL procedure successfully completed.
ROSE> create table tab4 as select * from tab1;
Table created.
ROSE> insert into tab4 select * from tab4;
240000 rows created.
SYS> alter database end backup;
Database altered.
SYS> alter system archive log current;
System altered.
SYS> archive log list;
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
$ mv *.log
/home/oracle/
$ tail -f /u01/app/oracle/admin/rose/bdump/alert_rose.log
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Sat Nov 01 14:20:14 IST 2014
Errors in file /u01/app/oracle/admin/rose/bdump/rose_arc1_11845.trc:
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/rose/redo03.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SYS> shut abort;
ORACLE instance shut down.
$ cd /u03/hotbkp/rose
$ cp *.dbf /u01/app/oracle/oradata/rose/
$ cp *.ctl /u01/app/oracle/oradata/rose/
SYS> startup mount;
ORACLE instance started.
..
[Trimmed]
Database mounted.
SYS> recover database using backup controlfile until cancel;
ORA-00279: change 411602 generated at 11/01/2014 20:42:57 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_11_01/o1_mf_1_2_b59yd0t1_.arc
ORA-00280: change 411602 for thread 1 is in sequence #2
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
..
...
[Trimmed]
'/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_11_01/o1_mf_1_8_b59yj15s_.arc'
no longer needed for this recovery
ORA-00308: cannot open archived log
'/u01/app/oracle/flash_recovery_area/ROSE/archivelog/2014_11_01/o1_mf_1_9_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SYS> select open_resetlogs from v$database;
OPEN_RESETL
----------REQUIRED
SYS> alter database open resetlogs;
Database altered.
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
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
LOG_MODE
--------- -----------ROSE
ARCHIVELOG
string
AUTO
undo_retention
integer
900
undo_tablespace
string
UNDOTBS1
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
11
13
13
STATUS
CHANGE#
TIME
ACTIVE
2136548
02-NOV-14
ACTIVE
2136548
02-NOV-14
ACTIVE
2136548
02-NOV-14
ACTIVE
2136548
02-NOV-14
ACTIVE
2136548
02-NOV-14
$ cp *.dbf
*.ctl
/u03/hotbkp/rose
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
undotbs01.dbf.tmp
$ ls -l undotbs01.dbf
ls: undotbs01.dbf: No such file or directory
v$backup;
STATUS
CHANGE#
TIME
---------
ACTIVE
2136548 02-NOV-14
ACTIVE
2136548 02-NOV-14
ACTIVE
2136548 02-NOV-14
ACTIVE
2136548 02-NOV-14
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
22
24
24
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
STATUS
------------------------------------------- --------/u01/app/oracle/oradata/rose/system01.dbf
SYSTEM
/u01/app/oracle/oradata/rose/undotbs01.dbf
ONLINE
/u01/app/oracle/oradata/rose/sysaux01.dbf
ONLINE
/u01/app/oracle/oradata/rose/users01.dbf
ONLINE
/u01/app/oracle/oradata/rose/example01.dbf
ONLINE
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
this script for same database so REUSE NOT required to be 'SET' and NO need to change
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
$ cd /u01/app/oracle/oradata/sham
$ mv *.ctl /home/oracle/
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: '/u01/app/oracle/oradata/sham/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.
POINTS TO NOTE :
We need to add the undocumented parameter _allow_resetlogs_corruption=true in the init.ora file.
Otherwise, you cannot open the database using 'RESETLOGS' option. Without oracle support team Never
ever use oracle undocumented parameters.
$ pwd
/u01/app/oracle/product/10.2.0/db_1/dbs
$ vi initsham.ora
BACKUP AND RECOVERY USING HOT BACKUP | HOT BACKUP Vs COLD BACKUP
373293056 bytes
1273780 bytes
Variable Size
113246284 bytes
Database Buffers
255852544 bytes
Redo Buffers
2920448 bytes
SYS>@/home/oracle/trace.sql;
Control file created.
SYS> select open_resetlogs from v$database;
OPEN_RESETL
----------REQUIRED
SYS> alter database open resetlogs;
Database altered.
SYS> select name from v$controlfile;
NAME
------------------------------------------/u01/app/oracle/oradata/sham/control01.ctl
/u01/app/oracle/oradata/sham/control02.ctl
/u01/app/oracle/oradata/sham/control03.ctl