Solved

oracle import script -how to build

Posted on 2006-11-03
4
4,547 Views
Last Modified: 2007-11-27
folks

below is a database export script

@echo off

 

exp 'sys/Sr20072006@MAXDEMO as sysdba' full=Y file=D:\Backup\MAXDEMO\exp_maxdemo.dmp log=D:\Backup\MAXDEMO\exp_maxdemo.log grants=y indexes=y compress=y direct=n rows=y

how can i convert this so i get a database import script?
0
Comment
Question by:rutgermons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 48

Expert Comment

by:schwertner
ID: 17865185
imp 'sys/Sr20072006@MAXDEMO as sysdba' full=Y file=D:\Backup\MAXDEMO\exp_maxdemo.dmp log=D:\Backup\MAXDEMO\exp_maxdemo.log grants=y indexes=y compress=y direct=n rows=y


Another example:

c:>imp parfile =imp.par

where the file is:

USERID="sys/reks@test as sysdba"
FILE=d:\ora10g\m\main\imp\07_15_2005_m.dmp
SHOW=n
IGNORE=y
GRANTS=y
ROWS=y
FULL=y
LOG=d:\ora10g\m\main\imp\imp.log
0
 

Expert Comment

by:cgilbert78fr
ID: 17865292
FYI, compress and direct are not imp options...

Prior to the import, you should clear the data you need to reimport, that is dropping the tables/indexes or truncating them to avoid ORA-0001 (unique contraint violated) and things like that.

If your aim is to rebuild your DB frol scratch using dump file, you should include in your script the create database statement.

The only parameters that are usefull to you are :
full=y
file=...
log=.../imp.log


If tables already exist when importing, you should set the ignore=Y parameter.
ignore=y will also allow you to reuse the existing DB files...

More information here (on tahiti) :
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14215/exp_imp.htm#i1023560

Regards

0
 
LVL 48

Expert Comment

by:schwertner
ID: 17865597
Another trap:

You have to set NLS_LANG environment (registry) parameter to a good value if you use letters that aren't english. On bot sites - export and import.
Because the defaulut is US7ASCII and the dump will loose all not english letters ...
0
 
LVL 35

Accepted Solution

by:
Mark Geerlings earned 500 total points
ID: 17869988
If you plan to use export and import to copy data from one Oracle database to another, this can work (and I use that technique each weekend in an automated job that reloads our test database with current, production data) but you need to do some work in the import database first!  Before running import, you need to:
1. disable (or drop) all constraints on tables that will be loaded by the import
2. truncate every table that will be loaded by the import
3. disable any/all triggers on tables that will be loaded by the import

Then you run the import (with "ignore=Y") and that will recreate/re-enable the constraints and triggers after it loads the data.

It looks to me like you a Maximo system that uses an Oracle database.  We also have a small Maximo system here, but Maximo is certainly not optimized for Oracle, and the folks at MRO don't know Oracle all that well.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question