Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Q:Copy production database to Q/A or test environment

Re: Q:Copy production database to Q/A or test environment

From: Yury Velikanov <>
Date: Mon, 18 Apr 2005 22:45:40 +0300
Message-ID: <>


It is easy if you need to copy whole database.

If the requirements are to copy just DB structure with empty (SMALL) tables + some data, then it can be bit complex. I would like to highlight requirement so have SMALL tables. Using suggested exp/imp (rows=3Dn) method, Oracle creates initial extend for each segment within export file. If objects sized properly in production, initial extend for BIG tables can be 10-100-500MB. Imp for such DB creates not really SMALL empty tables.

If you would like to get really small copy of production DB, you have to use method which allows you to set initial extend for segments. There are couple of methods you can use to achieve this goal:

  1. You can try to hack DMP file and change value of INITIAL parameter for each segment. Use PERL/SED/VI/WORD :), whatever you want, but be careful, the size of whole DMP file has to be the same after editing. If INITIAL parameter for some table is 26571432, you have to change it 000 32768 or " 32768".
  2. You can try to extract TABLE/INDEXES/CLUSTERS definitions. Change storage cause and create these manually.
  3. full export
  4. create target db.
  5. full imp, for types creation. You can need types to create type based tables (prevent TBS creation, to not allow Oracle to create initial extends for segments, create users before full imp)
  6. create segments manually (tables, indexes, clusters, iot whatever you ha= ve)
  7. full imp for triggers creation.

Extracting segments definitions not trivial. You have tree options here:

1. Try to extract DDLs from binary DMP file
2. Try to extract DDLs from imp log files created by imp show=3Dy
3. Try to extract DDLs from imp log files created by imp indexfile=3D<file =

May be you have to don't care how much takes you target database, then will forget all I described above and use just exp rows=3Dn + imp full=3Dy

+371 9268222 (+2 GMT)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Thank you for teaching me.

On 4/18/05, Amihay Gonen <> wrote:
> Hi ,

> I've a requirement to develop a process to copy production database (3Tb =
> above) at customer site to QA or test environment (Vendor side).


> The requirements are :
> * Database structures - This include tables,indexes , code
> (package,trigger ...) , views ...(select count(*) from DBA_objects =3D 15=
> )
> * Data of main configurations tables. (total size of all tables is
> less then 200M).

> This copy is done in order to investigate problem in customer sites and t=
> verify that patches which will be release , will run well.

> I'm thinking on two ways to developer such process :
> 1. Full exp without data + A list of tables to export with data. Zip=
> those files , transfer them to vendor site , import those files into a cl=
> database.
> 2. Take a hot backup of system and undo tablespaces and the
> configurations tablespace (let's assume that all the configurations tabl=
> are in the same tablespace).Zipped those files , transfer them to vendor
> site , create a new instance , recover and open the database

> What do you think it , it's the best way to go ? Please note that this
> process should be done with minimal DBA resource in the process. (DBA is =
> rare resource :) )

> Amihay Gonen
> DBA,
> 972-3-9268280

> Be there ... -> http://golan/Forum%20DBA/default.aspx
> <http://golan/Forum%20DBA/default.aspx>

> --
Received on Mon Apr 18 2005 - 15:49:49 CDT

Original text of this message