Solved

oracle import script -how to build

Posted on 2006-11-03
4
4,541 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
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 47

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle query help 29 77
export Oracle diagram from Oracle DB including VIEWS 8 102
Converting a row into a column 2 43
Shredding xml into an oracle 11g Database 2 25
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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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 shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

910 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

21 Experts available now in Live!

Get 1:1 Help Now