Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: clone database by copying datafiles

Re: clone database by copying datafiles

From: Howard J. Rogers <hjr_at_dizwell.com>
Date: Fri, 13 Feb 2004 18:38:06 +1100
Message-ID: <402c7ee0$0$28869$afc38c87@news.optusnet.com.au>

"hrishy" <hrishys_at_yahoo.co.uk> wrote in message news:4ef2a838.0402122246.55ea3e6_at_posting.google.com...
> Hi
>
> Placing tablespace's in backup mode would cause the headers of the
> datafile to be frozen.Enabling us to copy the underlying
> datafiles.While the writes to the datafile continues during the first
> change to a block during this period the entire block is recorded into
> the online redolog.Since the online redolog would anyway go into the
> archived log after my backup i was just wundering..can we clone a
> databse something like this..
>
> copy all the datafiles of the database without putting the tablespace
> in backup mode.

Nope. It's a non-starter. If you don't put the files into hot backup mode, then two things happen. First the contents of the files change, but because the header of the data file doesn't get locked, by the time it gets copied, the header will look newer than the actual contents are. That will stuff up a recovery mechanism royally. Second, because you're not dumping entire blocks of redo into the redo stream when they are first modified, each block had better not be copied by the O/S when it's actually undergoing modification in the database. Because at that point you have a fractured block in your copy, and nothing in the redo to repair it with.

You cannot copy ANYTHING hot in Oracle, without the output being an inconsistent mess, unless Oracle has provided a mechanism to sort the mess out. The mechanism for messy datafiles is redo and locked datafile headers. If you don't put things into hot backup mode, you don't have that mechanism available to you. Therefore, your copy will just be an inconsistent and unusable mess.

>And then switch the online logfiles archive them and
> copy them over too.Now use the usual procedure to clone the
> database..will this work ?
> if not can somebody explain me why..

I hope I have. Let me put it this way: the fractured block issue is actually quite hard to demonstrate when you've got one user (namely the instructor of the moment) doing pathetic "update emp" statements. So it is theoretically possible to get lucky and take a copy of a datafile without it happening. But it is *hugely* unlikely in any production database, where the volume of transactions taking place whilst the O/S is copying practically guarantees you fracturing. So whilst you *might* get away with it on a good Thursday with a following wind and a rabbit's foot in your trouser pocket, it is not something you would do in a production environment confident of success.

If you want to clone a database without putting tablespaces into hot backup mode, and without swamping your redo subsystem with block-sized redo, use RMAN. It does it for breakfast.

> regards
> Hrishy

Ditto,
HJR

-- 
--------------------------------------------
Oracle Insights: www.dizwell.com
--------------------------------------------
Received on Fri Feb 13 2004 - 01:38:06 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US