Solved

Remove Oracle Schema

Posted on 2014-03-26
11
614 Views
Last Modified: 2014-04-01
Hi Experts,
 
   How to remove an Oracle schema from the Database ? ( Google search says - Empty the Schema and Delete . But Are there any DOS/SQL script for emptying a schema?)

  Alternatively , Following is good enough for me
   
     I have an Oracle database restored  from the .dmp file . After a few months client gives a new .dmp file . How can I restore this new  .dmp file now  to the existing Database?


Thanks

  Sam
0
Comment
Question by:Sam OZ
11 Comments
 
LVL 28

Expert Comment

by:Naveen Kumar
Comment Utility
you can drop the required schemas by logging into the database before importing right
0
 

Author Comment

by:Sam OZ
Comment Utility
Hi Nav_kum,

    But I tried Drop Schema command . it didn't work . Some say you have to empty the schema before deleting it . How to do that ?
0
 
LVL 28

Expert Comment

by:Naveen Kumar
Comment Utility
alternatively, you can select the schemas/tables which you want to import from the dmp file. check the below url and it lists down all options/parameters of impdp.

http://www.oracle-base.com/articles/10g/oracle-data-pump-10g.php

Thanks
0
 

Author Comment

by:Sam OZ
Comment Utility
BTW , Experts - I am using Oracle 10g
0
 
LVL 28

Expert Comment

by:Naveen Kumar
Comment Utility
hmmm.. login with the dba user and run the below command :

drop user <<user_name>> ;

In oracle, schema names are the same as the user names. For example, if you want to empty a schema SCOTT then run the below command :

drop user scott;

Thanks
0
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.

 
LVL 28

Expert Comment

by:Naveen Kumar
Comment Utility
https://community.oracle.com/thread/507126?tstart=0 ---> just give a read through to enhance your understanding of the users/schemas
0
 

Author Comment

by:Sam OZ
Comment Utility
Hi Nav,

   I got a fair idea of Schema and Users . The issue is when I try to drop user .. It says " Unable to drop a User  in use " .....  I am able to drop another users ...   But I don't really get an idea of what  really locks my user .. There is no application making use of the schema
0
 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 350 total points
Comment Utility
oh..ok. thanks. you need to check what sessions are currently there from the V$session dict view

Can you also please post the error along with the exact oracle error number to be precise for me to understand the exact cause.

check this - https://community.oracle.com/thread/2283912?tstart=0
0
 
LVL 13

Assisted Solution

by:Alexander Eßer [Alex140181]
Alexander Eßer [Alex140181] earned 150 total points
Comment Utility
You'd have to kill the session(s) beforehand (of the connected users) and then drop them, as shown here:

http://javaworks.wordpress.com/2009/10/29/oracle-how-to-drop-a-user-who-is-connected-forcefully/

Good luck ;-)
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
This might already be in some of the links above (I didn't open them).

You might also need to specify cascade on the drop user command when they own objects:
drop user some_user cascade;

You likely will then need to recreate the user before import if the export is just the schema.
0
 
LVL 23

Expert Comment

by:David
Comment Utility
To drop a user/schema requires that account to be not in use, and to have DBA privilege to execute the DROP command.  Is that true in your situation?

Does the dumpfile contain more than the one schema's tables and similar objects?  If you can provide the imp or impdp script, without the user/password.

The following is an example of using the SCHEMAS parameter. You can create the expdat.dmp file used in this example by running the example provided for the Export SCHEMAS parameter. See SCHEMAS.

> impdp hr/hr SCHEMAS=hr DIRECTORY=dpump_dir1 LOGFILE=schemas.log
DUMPFILE=expdat.dmp
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

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…
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 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 Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

772 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

16 Experts available now in Live!

Get 1:1 Help Now