Export data from SOURCE DB
Make sure machine can be connected to both databases ( SOURCE and LOCAL)
Start SQL*PLUS session for SOURCE
Run:
SQL>@C:\Exp_Data\Exp_script.sql
Where Exp_script.sql is
---------------------------
/*
How to run under SQL*Plus:
SQL>@C:\Exp_Data\Exp_script.sql
**separated by "rec_creation_date"**
*/
host del C:\Exp_Data\ExpSpool.log
SPOOL C:\Exp_Data\\ExpSpool.log
--Cleanup existing dump files
host del C:\Exp_Data\record_in_year_2001.dmp
host del C:\Exp_Data\record_in_year_2002.dmp
host del C:\Exp_Data\record_in_year_2003.dmp
host del C:\Exp_Data\record_in_year_2004.dmp
--Cleanup existing log files
host del C:\Exp_Data\record_in_year_2001.log
host del C:\Exp_Data\record_in_year_2002.log
host del C:\Exp_Data\record_in_year_2003.log
host del C:\Exp_Data\record_in_year_2004.log
--create 2001 dump file
drop table
create table
host exp username/password@SOURCE parfile=C:\Exp_Data\record_in_year_2001.dat
drop table
--create 2002 dump file
drop table
create table
host exp username/password@SOURCE parfile=C:\Exp_Data\record_in_year_2002.dat
drop table
--create 2003 dump file
drop table
create table
host username/password@SOURCE parfile=C:\Exp_Data\record_in_year_2003.dat
drop table
--create 2004 dump file
drop table
create table
host exp username/password@SOURCE parfile=C:\Exp_Data\record_in_year_2004.dat
drop table
SPOOL OFF
---------------------------------
dat file example:
------------------------
CONSTRAINTS=N
DIRECT=Y
FEEDBACK=0
FILE=C:\Exp_Data\record_in_year_2001.dmp
GRANTS=N
INDEXES=N
LOG=C:\Exp_Data\record_in_year_2001.log
TRIGGERS=N
ROWS=Y
TABLES=
--------------------------
Import data into LOCAL database
Run “cmd” to get command prompt
Run following commands sequentially:
imp username/password file=record_in_year_2001.dmp full=yes
imp username/password file=record_in_year_2002.dmp full=yes
imp username/password file=record_in_year_2003.dmp full=yes
imp username/password file=record_in_year_2004.dmp full=yes
Note: If “ORACLE error 12560 encountered”, try to add the tnsname:
imp username/password@SOURCE file=<***>.dmp full=yes
Consolidate data into one table
Start SQL*PLUS session for local database (GEMSORCL)
Run following scripts:
create table
insert into
insert into
insert into
drop table
drop table
drop table
drop table
Verify restored data against SOURCE DB
Start SQL*PLUS session for both databases (SOURCE and LOCAL)
Run following scripts for PE0047:
select count(*) from
select count(*) from
select count(*) from
select count(*) from
select count(*) from
select count(*) from
Run following scripts for GEMSORCL:
select count(*) from
select count(*) from
select count(*) from
select count(*) from
select count(*) from
select count(*) from
All counts should match accordingly.
No comments:
Post a Comment