Solved

Importing new schema to database where such schema already exists , fails

Posted on 2007-12-03
5
943 Views
Last Modified: 2013-12-18
Dear  Experts,
I try to reimport shema in order to replace already exiting schema. However, after I issue the following command:
imp user/passsid FROMUSER=user TOUSER=user ignore=y compile=y destroy=y grants=y rows=n buffer=10000000 constraints=y file=my_dump.dmp log=imp.log

with set destroy=y (so the tablespace should be replaced) the tables from the my_dump.dmp are not recreated in the destination schema (my database). Where can be the problem?

Thanks for any advice

Adam
0
Comment
Question by:adamgasior
[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
  • 2
5 Comments
 
LVL 48

Assisted Solution

by:schwertner
schwertner earned 20 total points
ID: 20396562
FROMUSER=user TOUSER=user  is a very bad combination.
The PL/SQl code in the triggers (if any) will not be changed and will be
in his original state. So you have to avoid this.

If you would like to recreate the user using clasical Oracle import
the best practice is to drop all user objects before this (be careful!):

drop user scott cascade;
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 20396759
I've used FROMUSER and TOUSER many times successfully, so I would not say that this is a bad idea in all cases.  It depends on which objects are being imported, and for PL\SQL objects it depends on whether the schema name is hard-code into any PL\SQL objects or not.

An import will not usually destroy any existing objects.
0
 

Author Comment

by:adamgasior
ID: 20398408
I have two small additionals questions:

--> If I issue "drop user scott cascade" will it delete tablespace, stored procedures, triggers associated with that prqaticular user?

-->why import does not delete original objects? I set the option destroy=y?

Adam
0
 
LVL 35

Accepted Solution

by:
Mark Geerlings earned 60 total points
ID: 20398720
If you do a "drop user [username] cascade]" command that will drop the entire schema of that user, so yes, all tables, indexes, triggers, stored procedures, views, etc. owned by that schema/user will be dropped or deleted.  Will that empty a tablespace?  Maybe but maybe not, depending on whether other schemas also had objects in the same tablespace(s) that this user's objects were in.

Why doesn't import delete objects?  Oracle's classic import utility (imp) has never had the ability to drop or delete objects or data as far as I know (and I've never seen the "destroy" option before - are you sure it is valid?)  The new DataPump import (impdp) of Oracle10 can replace objects though, if you use the correct parameters.
0
 

Author Comment

by:adamgasior
ID: 20398835
thanks a lot
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PL/SQL More than one element associated with another element 7 55
Oracle encryption 12 59
DECLARATION OF CURSOR IS INCOMPLETE OR MALFORMED 5 40
return value based on substr 10 45
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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to recover a database from a user managed backup

735 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