Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2007-12-03
5
Medium Priority
?
947 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
  • 2
  • 2
5 Comments
 
LVL 48

Assisted Solution

by:schwertner
schwertner earned 80 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 240 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

971 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