Home » RDBMS Server » Backup & Recovery » what is best? backup set or image copy!!!!  () 1 Vote
what is best? backup set or image copy!!!! [message #142045] Thu, 13 October 2005 05:43 Go to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
i've read that image copies make the restoration process much faster than when using backup set for restoration. i ran a small test on both these methods. i backed up my whole DB first using backup set and then restored all the datafiles (*.dbf) using the backup set and kept time on how long it took to back up the DB and then to recover it. did the same task for image copy as well and the time difference i got between the two wasn't much. my DB doesn't even have that much data in it. there was only 1 additional datafile apart from the system datafiles and even that was about 10MB.

i think maybe this is the problem because DB was small and the time difference weren't so apart coz of it.
when we go in to production there will be tera bytes of data and we'll be using a RAC.
i want to know from experinced DBA what would be the best way to do back up and recovery in such a situation. in the production environment the recovery time is far more important (which use of image copy promises) than the space that will be saved if backup set was used.

secondly i want to know if incremental backups can be applied to image copy. i read so in the oracle press book (High availability with RAC, Flashback & Data Guard) but when i sheduled a backup using enterprise console manager it gave an error saying incrementals are only for backup sets

all the advice and help you give is greately appriciated.
thank you.

[Updated on: Thu, 13 October 2005 06:38]

Report message to a moderator

Re: what is best? backup set or image copy!!!! [message #142075 is a reply to message #142045] Thu, 13 October 2005 06:59 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
First document to read is Oracle Documentation
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96566/toc.htm

WIth your testing, I have no idea what you actually did.
An Image copy is just a copy of the file ( like CP datafile1 datafile2).
Documentation clearly says
Quote:


If you need to replace a current datafile, and if you have an image copy of the datafile, then you do not need to restore the copy. Instead, you can use the SWITCH command to point the control file at the copy and update the repository to indicate that the copy has been switched
.

Did you do the same procedure? This procedure is much faster.
Several cases needs to considered here.
Say with 10g you use Incremental merge

>>secondly i want to know if incremental backups can be applied to image copy.
In 10g, something like that is possible.

RECOVER COPY OF DATABASE WITH TAG 'xxx'
BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'xxxxx' DATABASE;


More details in documentation
http://download-east.oracle.com/docs/cd/B19306_01/backup.102/b14191/toc.htm

>> when i sheduled a backup using enterprise console
Me from old school, would try first with command line. No fancy thingies.
If everything works good, i would try with OEM.

[Updated on: Thu, 13 October 2005 07:00]

Report message to a moderator

Re: what is best? backup set or image copy!!!! [message #142080 is a reply to message #142075] Thu, 13 October 2005 07:16 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>>what is best? backup set or image copy
Do not rely on image copy.
Image copy is a secondary backup. Thats it.
Re: what is best? backup set or image copy!!!! [message #142082 is a reply to message #142045] Thu, 13 October 2005 07:21 Go to previous messageGo to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
thanks for ur help. yes now i see that they are simple cp of the datafile (with longer names like o1_mf_sysaux_1nwdnrqg_.dbf as i didn't use the tag with OEM)

instead of switch i used restore database that's why the time different wasn't much.

can you explain more why you say not to rely on image copy? what advantage backup set has over image copy
Re: what is best? backup set or image copy!!!! [message #142106 is a reply to message #142082] Thu, 13 October 2005 08:49 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>>why you say not to rely on image copy

Good catch.
The generalization was a consolidated result of my own paranoia.
Several administrative limitations and some internal bugs( in 9i).
But with 10g, it 'seems' very stable.
Still, i always do a regular backup along with an image copy (for faster restore).
As long as you use RMAN image copies, they are as good as backupsets.
Re: what is best? backup set or image copy!!!! [message #142240 is a reply to message #142106] Thu, 13 October 2005 22:26 Go to previous messageGo to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
we're using 10g so no worries about bugs. but still two sets of backups in the size of tere byte is too much even with faster recovery! so guess it's back to backupsets

thanks 4 ur help Cool
Re: what is best? backup set or image copy!!!! [message #142556 is a reply to message #142045] Sat, 15 October 2005 12:22 Go to previous message
nmacdannald
Messages: 460
Registered: July 2005
Location: Stockton, California - US...
Senior Member
We use hotbackups via scripts, and version them to have 5 sets.

Don't copy the control file or you will lose everything done after the control file was taking.

Here is how we do it.
>cat hotbackup_start.ksh
#!/bin/ksh
#@(#)hotbackup_start -- starts S2000 hotbackup
###
# Korn script to start hot backup of the S2000 database
#
# Autor: Neil MacDannald
# Date: 8/10/2005
###
#
# Inform operator what job they have requested
# Ask if they wish to continue
#
echo " "
echo "*****"
echo Starting hot backup of S2000 database
echo "Continue? (Y/N)"
read answer
echo " "
if [[ "$answer" = [Yy]* ]]
then
df -k /u26
echo `date`
thedir=`pwd`
echo " "
echo Enter password for S2000 ORADBA
sttyops=`stty -g`
stty -echo
echo "Password: "
read password
echo " "
stty $sttyops
#
# Start the hot backup job
#
sqlplus ORADBA/$password << EOF
@$thedir/hotbackup_start
exit
EOF
sleep 20
`cp /u01/oradata/os2p/ctl/*.ctl /u05/oradata/os2p/budir`
`cp /u01/oradata/os2p/ts/*.log /u05/oradata/os2p/budir/`
df -k
echo `date`
fi

which calls:
>cat hotbackup_start.sql
rem========================================================================
rem
rem Filename: hotbackup.sql
rem Purpose: Hot backup of Oracle database
rem Created: 8/10/2005
rem
rem It assumes :
rem - An underlying UNIX system
rem - The use of the 'cp' command to backup the files to a special
rem backup directory the name of which is prompted for in the
rem script
rem
rem Because of the high importance of backup procedures, due care is
rem given to the handling of errors. Any SQL or operating system error
rem will cause the script to exit and return a non-0 value to the
rem operating system.
rem
rem IT IS EXTREMELY IMPORTANT IN SUCH A CASE TO RUN THE ASSOCIATED
rem hotbackup_cancel.sql AS SOON AS POSSIBLE TO CANCEL THE
rem POSSIBLE 'BACKUP' STATE OF A TABLESPACE.
rem
rem========================================================================
set linesize 600
set pause off
set pagesize 0
set echo off
set feedback off
--
-- Hot-backup requires our running in ARCHIVELOG mode.
-- This is tested from the outset.
--
whenever sqlerror exit sql.sqlcode
declare
dummy char(1);
begin
select 'x'
into dummy
from v$database
where log_mode = 'ARCHIVELOG';
exception
when no_data_found then
raise_application_error(-20000, 'Database not in ARCHIVELOG mode !');
end;
/
set scan off
--
-- Interactively input the name of the directory (or device)
-- where to backup. This kind of dialogue is likely to prove
-- a hindrance in automated, daily operations.
-- You can either hard-code the directory name by using
-- define backup_dir = ...
-- or suppose it is passed as an argument to the current
-- script, in which case you should replace &&backup_dir by
-- &1 everywhere in this script and comment the following
-- 'accept' command
--
-- accept backup_dir prompt 'Backup directory : '
define backup_dir = /u05/oradata/os2p/budir/
--
set recsep off
set scan on
set verify off
--
-- You must absolutely check that everything goes according
-- to plans! If the backup fails because of, say, a
-- 'file system full' error, the script must exit with a
-- non-0 return code.
--
whenever sqlerror exit sql.sqlcode
whenever oserror exit 99
--
-- To be certain we have a consistent set of files which
-- we shall be able to recover, we also want to backup
-- all the redo log files generated during the backup,
-- and the final state of the control file.
-- Note that when recovering you normally must use the
-- current (i.e. at crash time) control file. However,
-- we want to be ready for the worst case scenario and
-- be able to use the current backup as if it were a
-- cold backup.
-- In order to know which redo log files have been generated
-- during the backup, we first identify which is, before
-- backup, the (current - 1) redo log file.
--
variable last_log varchar2(255)
begin
--
-- Format %S and %T (left-padded with zeros)
-- are not supported because length is OS-dependent.
-- Easy to support for a specific machine
--
select replace(pd.value, '?', '$ORACLE_HOME') ||
replace(replace(pf.value, '%s', rtrim(to_char(l.sequence#))),
'%t', rtrim(to_char(l.thread#)))
into :last_log
from v$parameter pd,
v$parameter pf,
v$log l
where pd.name = 'log_archive_dest'
and pf.name = 'log_archive_format'
and l.sequence# = (select max(sequence#)
from v$log
where status != 'CURRENT');
end;
/
--
-- Generate the backup script
--
-- online$ = 3 means a tablespace which once
-- existed but was dropped.
--
column dummy noprint
spool hbu_doit.sql
select ts# dummy,
1 dummy,
'alter tablespace ' || name || ' begin backup;'
from sys.ts$
where online$ != 3
and name not like 'TEM%'
union
select f.ts#,
2,
'host cp ' || d.name || ' &&backup_dir'
from sys.file$ f,
v$datafile d
where f.file# = d.file#
union
select ts#,
3,
'alter tablespace ' || name || ' end backup;'
from sys.ts$
where online$ != 3
and name not like 'TEM%'
order by 1, 2
/
spool off
--
-- Run the backup script just generated
--
set echo on
set feedback on
@hbu_doit
--
-- Take a backup of the control file for the worst-case scenario
-- Do not worry, parameter replacement is not echoed but done.
--
alter database backup controlfile to '&&backup_dir./control.ctl' reuse;
--
-- Trigger a redo log switch to close the current redo log file
--
alter system switch logfile;
set echo off
--
-- Force the archival of all the redo log files
--
declare
Stmt varchar2(100);
cid number;
dummy number;
nothing_to_archive exception;
PRAGMA EXCEPTION_INIT(nothing_to_archive, -271);
begin
Stmt := 'alter system archive log all';
cid := dbms_sql.open_cursor;
begin
dbms_sql.parse(cid, Stmt, dbms_sql.native);
dummy := dbms_sql.execute(cid);
exception
when nothing_to_archive then
null;
--
-- Unexpected errors
--
when others then
if (dbms_sql.is_open(cid))
then
dbms_sql.close_cursor(cid);
end if;
raise_application_error(-20000, Stmt || chr(10) || SQLERRM);
end;
dbms_sql.close_cursor(cid);
end;
/
set feedback off
--
-- Backup all the redo log files generated during hot backup
-- in ksh script when this completes until later
set echo on
--
-- All done!
--
exit 0
Previous Topic: restore on rman catalog database
Next Topic: RMAN expired backup policy
Goto Forum:
  


Current Time: Thu Mar 28 03:56:00 CDT 2024