Solved

oracle import script -how to build

Posted on 2006-11-03
4
4,539 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
  • 2
4 Comments
 
LVL 47

Expert Comment

by:schwertner
Comment Utility
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
Comment Utility
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 47

Expert Comment

by:schwertner
Comment Utility
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 34

Accepted Solution

by:
Mark Geerlings earned 500 total points
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
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 how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now