Solved

Remove Oracle Schema

Posted on 2014-03-26
11
623 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
ID: 39955332
you can drop the required schemas by logging into the database before importing right
0
 

Author Comment

by:Sam OZ
ID: 39955337
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
ID: 39955338
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
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.

 

Author Comment

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

Expert Comment

by:Naveen Kumar
ID: 39955342
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
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 39955343
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
ID: 39955365
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
ID: 39955372
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
ID: 39955384
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)
ID: 39956967
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
ID: 39957577
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

856 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