Solved

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

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

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.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

776 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