sql - How best can I recreate an Oracle database? -



sql - How best can I recreate an Oracle database? -

oracle 11gr2 (x86 windows):

i have db 250 tables indexes , constraints. need re-create these tables, indexes , constraints in new db , load data. need know how next in sql plus and/or sql developer, unless there's magical utility can automate of this. in advance!

unload (export) info 250 tables.

create sql script file containing create table statements 250 tables.

create sql script file containing create index statements 250 tables.

create sql script file containing alter table add together constraint statements 250 tables.

run script create tables in new db.

load exported info tables in new db.

run script create indexes.

run script add together contraints.

edit: i'm connected remote desktop links source db on windows server 2008. remote has oracle client installed. security reasons, i'm not allowed link straight local computer win server, can dump whole source db remote zip local target machine? i'm trying replicate entire db on computer.

starting oracle 10g, utilize data pump command-line clients expdb , impdb export/import info and/or schema 1 db other. matter of fact, 2 command-line utilities wrappers "use procedures provided in dbms_datapump pl/sql bundle execute export , import commands, using parameters entered @ command line." (quoted oracle's documentation)

given needs, have create directory generate total dump of database using expdb:

sql> create or replace directory dump_dir '/path/to/dump/folder/'; sh$ expdp system@db10g full=y directory=dump_dir dumpfile=db.dmp logfile=db.log

as dump written using binary format, have utilize corresponding import utility (re)import db. replacing expdb impdb in above command:

sh$ impdp system@db10g full=y directory=dump_dir dumpfile=db.dmp logfile=db.log

for simple table dump, utilize version instead:

sh$ expdp sylvain@db10g tables=dept,emp directory=dump_dir dumpfile=db.dmp logfile=db.log

as noticed, can utilize standard user account, provided have access given directory (grant read, write on directory dump_dir sylvain;).

detailed usage explanations, see

http://www.oracle-base.com/articles/10g/oracle-data-pump-10g.php.

sql oracle sqlplus ddl

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -