Home » RDBMS Server » Server Utilities » Automating export and import (Urgent)
Automating export and import (Urgent) [message #72007] Thu, 20 February 2003 09:27 Go to next message
scott
Messages: 73
Registered: September 1999
Member
Hi All,
My company runs Oracle 8 on Windows NT server.I have been asked to achieve the following task
(1) Do an export of a database using exp80 user/password@database-name........
(2) Run a procedure delete.sql (I have written this) which drops all tables from the database
(3)Do an import using imp80.......
(4) Run a procedure called CreateTables.sql (I have written this)which actually reads the data from imported tables and creates tables for seven different schemas.

Doing it separately is a piece of cake.It runs flawlessly.Now my Boss wants me to automate the entire process from start to finish and wants to run it as a scheduled task every Friday night 12.00 Midnight.
I have no clue as to where to start from.
Help will be sincerely apprecaited.
Thanks in advance.

Scott.....
Re: Automating export and import (Urgent) [message #72008 is a reply to message #72007] Thu, 20 February 2003 09:45 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
-- sample session ..execution of the batch job
C:>e

Export: Release 8.1.6.0.0 - Production on Thu Feb 20 11:28:48 2003

(c) Copyright 1999 Oracle Corporation.  All rights reserved.

Connected to: Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production
Export done in WE8ISO8859P1 character set and WE8ISO8859P1 NCHAR character set

About to export specified tables via Conventional Path ...
. . exporting table                            EMP         14 rows exported
. . exporting table                           DEPT          4 rows exported
Export terminated successfully without warnings.

Table dropped.

Table dropped.

Table dropped.

Table dropped.

Import: Release 8.1.6.0.0 - Production on Thu Feb 20 11:28:54 2003

(c) Copyright 1999 Oracle Corporation.  All rights reserved.

Connected to: Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production

Export file created by EXPORT:V08.01.06 via conventional path
import done in WE8ISO8859P1 character set and WE8ISO8859P1 NCHAR character set
. importing MAG's objects into MAG
. . importing table                          "EMP"         14 rows imported
. . importing table                         "DEPT"          4 rows imported
Import terminated successfully without warnings.

Table created.

Table created.

--
-- this is batch script.
-- call this in your scheduler.
-- steps
--     do export
--     login to database and drop the objects (drop.sql)
--     do the import
--     login to database and create the objects(create.sql)

C:>type e.bat
@echo off
exp mag/mag tables=(emp,dept) file = s.dmp
sqlplus -s mag/mag  @drop.sql
imp mag/mag file=s.dmp tables=(emp,dept)
sqlplus -s mag/mag @create.sql

C:>type drop.sql
drop table dept;
drop table emp;
drop table dept_dept;
drop table emp_emp;
exit;
/
C:>type create.sql
create table emp_emp
as select * from emp;
create table dept_dept
as select * from dept;
exit;
/

Re: Automating export and import (Urgent) [message #72011 is a reply to message #72007] Fri, 21 February 2003 06:35 Go to previous message
scott
Messages: 73
Registered: September 1999
Member
Perfecto,
Thanks a bunch Mahesh.I will be done with a small C# module by evening and then need to kickstart the Oracle stuff. Deadline is Tuesday. With your help,looks like I will be done.
Thanks again.
I hope your country wins the criket world cup.

Regards

Scott Allen
Previous Topic: Import Error !!!
Next Topic: dbca java exception 9i/er2 solaris
Goto Forum:
  


Current Time: Wed May 15 02:35:51 CDT 2024