?
Solved

oracle import script -how to build

Posted on 2006-11-03
4
Medium Priority
?
4,558 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 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

719 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