Solved

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

Posted on 2007-12-03
5
938 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 47

Assisted Solution

by:schwertner
schwertner earned 20 total points
Comment Utility
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 34

Expert Comment

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

Accepted Solution

by:
Mark Geerlings earned 60 total points
Comment Utility
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
Comment Utility
thanks a lot
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

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
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…
This video shows how to recover a database from a user managed backup

763 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

9 Experts available now in Live!

Get 1:1 Help Now