Drop/delete tablespace

hi how can i delete table-spaces,but i what to delete those tablespace which are not been used how can i check if tabalespaces is been used and delete it if is not used

JohnSpencer wrote:
Ramin:
What about indexes, LOBS and partitions?  All of these could be in a tablspace without showing in dba_tables.  It would be more accurate to use dba_segments instead.
John
oooohh
absolutely right ))))
hmmm ... why i did stupid error like this?
Friday And 18-00  maybe i am very tired, I must go to Home ....

Similar Messages

  • Deleted undo datafile before dropping the tablespace.

    i had accidently deleted a undo datafile which was no more needed before dropping the tablespace.
    i started up the database in mount stage by making that datafile offline.
    now while dropping the database it is giving an error.
    SQL> drop tablespace UNDOTBS1 ;
    drop tablespace UNDOTBS1
    ERROR at line 1:
    ORA-01548: active rollback segment '_SYSSMU1$' found, terminate dropping tablespace
    Do someone have a resolution. I dnt need this tablespace anymore.

    http://www.my-whiteboard.com/oracle-dba/how-to-drop-and-recreate-oracle-undo-tablespace-and-its-data-files.html may be helpful to you.

  • Cannot drop a tablespace

    Hi,
    A datafile of my database has been deleted from the OS and cannot be recovered. The related tablespace exits in the database.
    I want to drop this tablespace, but oracle does not allow me to do so. I dont have the backup of the datafile.
    Can something be done.
    Regards
    ANiL.

    Hi
    If your database is in archivelog mode and u have all the archive files than u can recover this datafile
    no need to drop it or create the controlfile also.
    steps are ...
    [SUNSHINE ~]$ sqlplus
    SQL*Plus: Release 10.1.0.3.0 - Production on Wed Oct 11 16:14:20 2006
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Enter user-name: sys as sysdba
    Enter password:
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    Total System Global Area 209715200 bytes
    Fixed Size 778432 bytes
    Variable Size 191897408 bytes
    Database Buffers 16777216 bytes
    Redo Buffers 262144 bytes
    Database mounted.
    ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
    ORA-01110: data file 6: '/home/oracle/orcl/data/abc.dbf'
    SQL> alter database create datafile '/home/oracle/orcl/data/abc.dbf' as '/home/oracle/orcl/data/abc.dbf';
    Database altered.
    SQL> alter database open;
    alter database open
    ERROR at line 1:
    ORA-01113: file 6 needs media recovery
    ORA-01110: data file 6: '/home/oracle/orcl/data/abc.dbf'
    SQL> recover database;
    Media recovery complete.
    SQL> alter database open;
    Database altered.
    SQL>
    Regards,
    Symal

  • Drop huge Tablespace

    Hi Everybody,
    Here there are some steps that leaded me into a dead end, where I would like and greatly appreciate some help.
    1. We have a tablespace FONC, dictionary managed, 136Gb spliced in 11 datafiles
    FONC1 to FONC11.
    2. There it is a huge table in this tblsp, T1, 70GB, having BLOBs.
    3. Some other tables are in it also.
    My plan is to move all objects in this tblsp in a 2 new tblsp, one for the
    BLOBS, one for the rest. And to drop this tablespace at the end.
    I do not have enough disk space in order to have both tablespaces present in the
    same time.
    What I did.
    0. ArchiveLog off.
    1. Export the T1 table, the huge one (splitting the export in 24 files, placed
    in all free spaces I found).
    2. alter table move tablespace for the other tables.
    3. start the Drop table T1.
    4. after 6 hours, I stopped the drop, being short in time.
    5. start drop tablespace FONC.
    6. after another 5 hours, I cancelled this drop also.
    7. tblsp FONC contains nothing else but a 67GB temporary segment.
    8. took the tblsp FONC offline.
    9. shutdown db abort.
    10. delete datafiles FONC1 to FONC11.
    11. startup db - no errors except a message in SMON Log - timeout waiting for a
    tablespace management resource.
    12. Create new tablespace.
    13. Import table T1.
    14. Archivelog ON - error ORA-265 - instance needs recovery.
    15. Shutdown Abort.
    16. Startup Open.
    17. Shutdown Immediate.
    18. startup mount.
    19. ALter database datafile fonc1...11 offline drop.
    20. Recover database - everything ok.
    21. Alter ... ARCHIVELOG - same error.
    22. Other trials - same results ...
    No indications in any oracle log that SMON did an instance recovery, or other
    error message.
    Finally, the DB is operational, but ARCHIVELOG is OFF.
    My problem is how to get rid of the FONC tablespace without loosing another xxxx
    hours. A normal DROP tablsp including contents did not finished after 24 hours.
    I need a way just to invalidate the temporary segment in the FONC tblsp, to get
    rid of it, to be able to get rid of the tblsp FONC also. I guess that the
    missing datafiles impede the instance recovery. An solution to be done when the
    DB is online and in use is of course the most desirable one ...
    using DBMS_SPACE_ADMIN can be more helpfull ?
    Manually edit the controlfiles ?
    Using RMAN ?
    Thanks in advance, I appreciate what you are doing,
    Dan

    No I did not tried with Nologging.
    On the other hand, what I see that takes long are the updates on the tables fet$ and uet$. More than that, a system session is issuing all the time blocking locks on this tables, that makes the drop to take so much time. Releasing 67GB in extents is quite challenging ...
    So I need a way to lead only to delete on the fet$ and uet$ tables, and, a way to avoid the blocking locks. I thought that using DBMS_SPACE_ADMIN and invalidating the temporary segment first can be a solution.
    The real problem here is that I can not do try-and-see, I can not stop the exploitation of the DB so I was hoping that somebody went through the same experience and has a working solution.
    Thanks,
    Dan

  • Dropping a tablespace

    Hi ,
    DB version is 10.2.0.4 . Trying to drop tablespace it throws error as
    SQL> drop tablespace APPS_TS_SUMMARY including contents and datafiles;
    drop tablespace APPS_TS_SUMMARY including contents and datafiles
    ERROR at line 1:
    ORA-23515: materialized views and/or their indices exist in the tablespace
    SQL> !oerr ora 23515
    23515, 00000, "materialized views and/or their indices exist in the tablespace"
    // *Cause:  An attempt was made to drop a tablespace which contains
    //          materialized views and/or their indices.
    // *Action: Drop the materialized views in this tablespace. Also,
    //          find indices belonging to materialized views in this
    //          tablespace and drop then.  Then try dropping the tablespace.
    //So dropped the MV in the tablespace using,
    select 'drop materialized view '||owner||'.'||name||' ;' from dba_registered_snapshots where name in (select table_name from dba_tables where tablespace_name='APPS_TS_SUMMARY');Then too it showed the same error. How do i drop this tablespace?
    baskar.l

    select ‘drop materialized view ‘||owner||’.'||name||’ PRESERVE TABLE;’ from dba_registered_snapshots where name in  (select table_name from dba_tables where tablespace_name = ‘your_tablespace_name’);use this command to generate command , and use this commands to delete your m view on this tablespace
    and delete constraints also
    drop tablespace your_tablespace_name  including contents and datafiles CASCADE CONSTRAINTS;Edited by: Adigozalov Gurban on Jan 23, 2011 6:15 PM

  • Dropping Undo Tablespace 9i

    Hey Folks,
    I really need some help here.
    I'm trying to drop/recreate the undo tablespace (currently 25gig) Oracle 9i
    When I try to drop the undo tablespace 'UNDOTBS1' I get the following error:
    “ORA-01548: active rollback segment '_SYSSMU1$' found, terminate dropping tablespace”
    Here's what I have tried so far:
    - Bounced the DB several times hoping to get rid of the reference to the active rollback segment. No luck.
    - Created a new undo table space
    - Tried 'Alter system set undo_tablespace=new_one' (noticed that 10 new rollback segs were created '_SYSMU11$..SYSMU20$' pointing to the new undo tablespace)
    - I then performed an offline drop of the undo tablespace data file. After the offline drop, the system rollback segs SYSMU01$..SYSMU10$ went offline as would be expected.
    - Even with the new undo tablespace, all other application tablespaces still use the old undo which due to the offline drop, no inserts, deletes, etc. will work.
    After all the above, I still get the same error when trying to drop the undo tablespace.
    Any ideas? Ideally I would like to be able to drop the undo tablespace and recreate it, but at this point I'd be happy to bring back the undo tablespace datafile so we can at least use the database again.
    Thanks in advance!!
    Colin

    SQL> show parameters undo
    undo_retention integer
    10800
    undo_suppress_errors boolean
    FALSE
    undo_tablespace string
    UNDOTBS03
    r.- The undo tablespace which the database is looking for is this one ( UNDOTBS03 )
    What is strange about the lines above is that I have
    all those params above commented out in my
    \pfile\init.ora file (and have bounced the db).
    I’m not sure why they are still showing up.
    r.- Perhaps your instance is started with the spfile instead of the init file
    Here's what we did after the UNDOTBS1 tablespace
    caused the disk to run out of space during a large
    import (from now on we are going to use commit = y):
    1. Created a new undo tablespace UNDOTBS03 - got
    errors so instead we to created it as a temp
    tablespace UNDOTBS03 which worked. r.- Yes, but that tablespace was created as a UNDO TABLESPACE ?
    2. Tried to drop UNDOTBS1 got the following error
    msg:
    ORA-01548: active rollback segment '_SYSSMU1$' found,
    terminate dropping tablespacer.- Of course, the database did not allow to drop it beacause there were pending transactions
    3. SQL> alter system set undo_tablespace =
    'UNDOTBS03' scope = both. Tried dropping UNDOTBS1.
    Same error as in #2 above.r.- There were still pending transactions with the older undo tablespace
    4. We then offline dropped the datafile associated
    with UNDOTBS1 hoping that would then allow us to drop
    UNDOTBS1. Same error as #2.r.- That was the worst you did. You can not drop a tablespace so...
    5. Then tried creating a undo tablespace again:
    Create UNDO tablespace undo_temp
    datafile 'D:\oracle\oradata\usbperf\undo_temp.DBF'
    size 25m autoextend on;
    Error on line 0
    Create UNDO Tablespace undo_temp
    datafile 'D:\oracle\oradata\usbperf\undo_temp.
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00376: file 2 cannot be read at this time
    ORA-01110: data file 2:
    'D:\ORACLE\ORADATA\USBPERF\UNDOTBS01.DBF'
    So that’s where we are. I'm guessing that the
    original undo tablespace corrupted when it tried to
    extend and ran of disk space?
    Thanks again for the help.
    Colin ok I can guide to solve this but you have to do what I am going to tell you step by step. Is this a production database ?
    Joel Pérez
    http://www.oracle.com/technology/experts

  • Delete tablespace

    Hi,
    i have try this command :
    SVRMGR> drop tablespace dexem including contents cascade constraints;
    drop tablespace dexem including contents cascade constraints
    ORA-01116: error in opening database file 8
    ORA-01110: data file 8: '/ora8/m02/oradata/ora8/dexem01.dbf'
    ORA-27041: unable to open file
    Linux Error: 2: No such file or directory
    Additional information: 3
    It s normal i have delete the file (a big error i know but..) now is it possible to drop the tablespace anywhere?
    thanks for help
    null

    Remi, if tablespace dexem does NOT contain any rollback segments, try the folowing:
    ALTER DATABASE DATAFILE 8 OFFLINE DROP;
    DROP TABLESPACE dexem;
    If the tablespace does contain rollback segments, you will have to drop them first. If your database is down, you will have to modify your init.ora, and add the following parameter: offlinerollback_segments=(RBS1, RBS2, etc)
    After that you have to do the following:
    ALTER DATABASE DATAFILE 8 OFFLINE DROP;
    DROP ROLLBACK SEGMENT RBS1;
    DROP ROLLBACK SEGMENT RBS2;
    etc
    DROP TABLESPACE dexem;
    After that, you will have to recreate the rollback segments
    Good luck.

  • Deleting tablespace (is ok in this forum?)

    First of all is this the okey forum for this question?
    - I had a disk failure - I recovered the DB - I tried to delete the tablespace with the error but I got this message, I looked up in the manual and it says this but I don't know how to do it:
    ORA-29857 domain indexes and/or secondary objects exist in the tablespace
    Cause: An attempt was made to drop a tablespace which contains secondary
    objects and/or domain indexes.
    Action: Drop the domain indexes in his tablespace. Also, find the domain
    indexes which created secondary objects in this tablespace and drop them. Then
    try dropping the tablespace.
    thanks for any kind of clue
    bye
    hector

    How many members is there in this forum? Your user ID is 898414. But that probably doesn't
    mean the number of members is approaching a
    million... does it? Maybe it does. There are a lot of
    people who get a user ID and ask us to post the code
    for face recognition or something like that, then are
    never heard from again.and interestingly based on the id's the first member to have registered and who did post atleast one message posted his first message on Jul 21, 2005 2:16 AM
    while he registered on Registered:
    Jun 12, 1997 2:00 AM

  • Can you really delete tablespaces in offline/recovery 10gR2

    Guru's,
    I just migrated my 9.2.0.6 to 10.2.0.2 and in the process of moving my datafiles I messed up one of the names. I added the right datafile to the tablespace and the database started no problem. Now I have an extra datafile on the tablespace identified as offline needing recovery. I read that in 10gR2 you can delete datafiles from tablespaces so after mounting the database I ran -
    SQL> alter database datafile '/data/ordata/prod/.dbf' offline drop;
    Database altered.
    SQL> alter database open;
    Database altered.
    When I select name from v$datafile it's still there. Am I missing something?
    Thanks,
    Kirk

    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14231/dfiles.htm#i1006556
    You need to make the datafile online.
    Restrictions for Dropping Datafiles
    The following are restrictions for dropping datafiles and tempfiles:
    The database must be open.
    If a datafile is not empty, it cannot be dropped.
    If you must remove a datafile that is not empty and that cannot be made empty by dropping schema objects, you must drop the tablespace that contains the datafile.
    You cannot drop the first or only datafile in a tablespace.
    This means that DROP DATAFILE cannot be used with a bigfile tablespace.
    You cannot drop datafiles in a read-only tablespace.
    You cannot drop datafiles in the SYSTEM tablespace.
    If a datafile in a locally managed tablespace is offline, it cannot be dropped.

  • Drop Temp tablespace hangs...

    I have created a new TEMP tablespace and made it default TEMP one.
    Now I want to drop TEMP3 tablespace, because it has become fulll...
    when I drop it through EM, it hangs...
    Once a tablespace has been dropped, the objects and data in it will no longer be available. To recover them can be a time consuming process. Oracle recommends a backup before and after dropping a tablespace.
    Are you sure you want to delete Tablespace TEMP3?
    Delete associated datafiles from the OS
    When I checked at EM, there are locks too..
    SMON has locked the system
    What should I do now?

    The_Rock wrote:
    I have created a new TEMP tablespace and made it default TEMP one.
    Now I want to drop TEMP3 tablespace, because it has become fulll...
    when I drop it through EM, it hangs...
    Once a tablespace has been dropped, the objects and data in it will no longer be available. To recover them can be a time consuming process. Oracle recommends a backup before and after dropping a tablespace.
    Are you sure you want to delete Tablespace TEMP3?
    Delete associated datafiles from the OS
    When I checked at EM, there are locks too..
    SMON has locked the system
    What should I do now?Refer
    Drop Temp Tablespace Command Hangs [ID 214371.1]
    How to Drop Temporary Tablespace Having Enteries in V$SORT_USAGE [ID 285993.1]

  • Where do the segments belong after the drop of tablespace...?????

    Hi ,
    After a tablespace drop solely .... what is happening with its included segments....., i mean where would they belong to.... to SYSTEM tablespace...?????
    NOTE: I use Oracle10g on Windows XP platform......
    Thanks , a lot
    Simon

    Hi ,
    The following portion of document is from an Oracle documentation :
    "To drop a tablespace, use the DROP TABLESPACE statement. The following statement drops the users tablespace, including the segments in the tablespace:
    DROP TABLESPACE users INCLUDING CONTENTS;
    If the tablespace is empty (does not contain any tables, views, or other structures), you do not need to specify the INCLUDING CONTENTS clause. Use the CASCADE CONSTRAINTS clause to drop all referential integrity constraints from tables outside the tablespace that refer to primary and unique keys of tables inside the tablespace.
    To delete the datafiles associated with a tablespace at the same time that the tablespace is dropped, use the INCLUDING CONTENTS AND DATAFILES clause. The following statement drops the users tablespace and its associated datafiles:
    DROP TABLESPACE users INCLUDING CONTENTS AND DATAFILES;
    "So , from the above , i understand that :
    1) if i specify DROP TABLESPACE USERS.... then the tablespace db object is dropped only.... not datafiles , not segments......So , my question is where these segments belong to ....afterwards????
    2) if i specify DROP TABLESPACE users INCLUDING CONTENTS ... then the tablespace db object is dropped as well as the segments included in it.....Not the datafiles....
    3) if i specify DROP TABLESPACE users INCLUDING CONTENTS AND DATAFILES... then the tablespace db object is dropped , the segments and datafiles ,as well ....
    Are the above considerations correct...?????
    Many thanks ,
    Simon
    Message was edited by:
    sgalaxy

  • Why I got error ORA-02429 when I tried to drop a tablespace?

    I use the following command to drop the tablespace:
    drop tablespace users including contents and datafiles;The error message is below:
    Error report:
    SQL Error: ORA-00604: error occurred at recursive SQL level 1
    ORA-02429: cannot drop index used for enforcement of unique/primary key
    00604. 00000 -  "error occurred at recursive SQL level %s"
    *Cause:    An error occurred while processing a recursive SQL statement
               (a statement applying to internal dictionary tables).
    *Action:   If the situation described in the next error on the stack
               can be corrected, do so; otherwise contact Oracle Support.However, I have removed all the tables and indexes in this tablespace.
    Nothing found when I issued the following enquiries.
    select index_name from user_indexes where TABLESPACE_NAME = 'USERS';
    select table_name from user_tables where TABLESPACE_NAME = 'USERS';Is there anything I missed?
    Thanks in advance.

    999274 wrote:
    Could you please let me know how to purge recyclebin ?It's bad form to hijack someone else's thread for your own questions.
    As for your question
    =================================================
    Learning how to look things up in the documentation is time well spent investing in your career. To that end, you should drop everything else you are doing and do the following:
    Go to [url tahiti.oracle.com]tahiti.oracle.com.
    Locate the link for your Oracle product and version, and click on it.
    You are now at the entire documentation set for your selected Oracle product and version.
    <b><i><u>BOOKMARK THAT LOCATION</u></i></b>
    Spend a few minutes just getting familiar with what is available here. Take special note of the "books" and "search" tabs. Under the "books" tab (for 10.x) or the "Master Book List" link (for 11.x) you will find the complete documentation library.
    Spend a few minutes just getting familiar with what <b><i><u>kind</u></i></b> of documentation is available there by simply browsing the titles under the "Books" tab.
    Open the Reference Manual and spend a few minutes looking through the table of contents to get familiar with what <b><i><u>kind</u></i></b> of information is available there.
    Do the same with the SQL Reference Manual.
    Do the same with the Utilities manual.
    You don't have to read the above in depth. They are <b><i><u>reference</b></i></u> manuals. Just get familiar with <b><i><u>what</b></i></u> is there to <b><i><u>be</b></i></u> referenced. Ninety percent of the questions asked on this forum can be answered in less than 5 minutes by simply searching one of the above manuals.
    Then set yourself a plan to dig deeper.
    - Read a chapter a day from the Concepts Manual.
    - Take a look in your alert log. One of the first things listed at startup is the initialization parms with non-default values. Read up on each one of them (listed in your alert log) in the Reference Manual.
    - Take a look at your listener.ora, tnsnames.ora, and sqlnet.ora files. Go to the Network Administrators manual and read up on everything you see in those files.
    - When you have finished reading the Concepts Manual, do it again.
    Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.
    =================================

  • Reaction at Standby Database in 10g for alter , addtion, deletion tablespac

    Deal All,
    I want to know that what will be reaction on standby database (10g) if i alter , add , delete tablespace or datafile at primary database.

    depends on the parameter STANDBY_FILE_MANAGEMENT . please check
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14239/manage_ps.htm#i1010428

  • Drop empty tablespaces after OATM in 11.5.9

    Hi All,
    In 11.5.9 we don't have the option of "Generate script to drop empty tablespaces". Could you suggest a best way to generate this in 11.5.9?
    Thanks

    Hussein,
    Could you please confirm the steps for moving the below objects from APPLSYSD after OATM
    SQL> select segment_name, segment_type from dba_segments
    where tablespace_name ='APPLSYSD'; 2
    SEGMENT_NAME
    SEGMENT_TYPE
    SYS_IL0002020632C00006$$
    LOBINDEX
    SYS_LOB0002020632C00006$$
    LOBSEGMENT
    SQL>
    SQL> select OWNER, TABLE_NAME, COLUMN_NAME, SEGMENT_NAME from dba_lobs where SEGMENT_NAME like '%SYS_LOB0002020632C00006$$%';
    OWNER TABLE_NAME
    COLUMN_NAME
    SEGMENT_NAME
    APPLSYS AQ$_WF_CONTROL_D
    RSUBS
    SYS_LOB0002020632C00006$$
    SQL>
    SQL> select OWNER, TABLE_NAME, COLUMN_NAME, SEGMENT_NAME from dba_lobs where INDEX_NAME like '%SYS_IL0002020632C00006$$%';
    OWNER TABLE_NAME
    COLUMN_NAME
    SEGMENT_NAME
    APPLSYS AQ$_WF_CONTROL_D
    RSUBS
    SYS_LOB0002020632C00006$$
    SQL>
    SQL> select OWNER, TABLESPACE_NAME from dba_tables where TABLE_NAME like '%AQ$_WF_CONTROL_D%';
    OWNER TABLESPACE_NAME
    APPLSYS
    SQL>
    alter table AQ$_WF_CONTROL_D move tablespace APPLSYSD
    lob(RSUBS) store as SYS_LOB0002020632C00006$$(tablespace APPS_TS_QUEUES);
    Thanks

  • Cannot drop undo tablespace with Active extents but no active sessions

    Hi all,
    I am running on 10gr2 oracle database in a Linux 32 bit environment.
    I have a corrupted undo datafile. I've been able to recover the datafile but still the alert logs is still showing that it is corrupted.
    Now what I'm trying to do is to drop the old undo tablespace like the one discussed here Change undo tablespace in Oracle - Switch Oracle's Undo tablespace.
    My problem is I have an Active extent but no active session corresponding to it:
    SYS@ccasdb AS SYSDBA > SELECT a.name,b.status
    FROM   v$rollname a,v$rollstat b
    WHERE  a.usn = b.usn
    AND    a.name IN (
                      SELECT segment_name
                      FROM dba_segments
                      WHERE tablespace_name = 'UNDOTBS1'
                     );  2    3    4    5    6    7    8
    NAME                           STATUS
    _SYSSMU18$                     PENDING OFFLINE
    SYS@ccasdb AS SYSDBA > SELECT a.name,b.status , d.username , d.sid , d.serial#
      2  FROM   v$rollname a,v$rollstat b, v$transaction c , v$session d
      3  WHERE  a.usn = b.usn
      4  AND    a.usn = c.xidusn
      5  AND    c.ses_addr = d.saddr
      6  AND    a.name IN (
      7               SELECT segment_name
      8               FROM dba_segments
      9               WHERE tablespace_name = 'UNDOTBS1'
    10              );
    no rows selected
    but still cannot drop the undotablespace.
    SYS@ccasdb AS SYSDBA > drop tablespace UNDOTBS1 including contents and datafiles;
    drop tablespace UNDOTBS1 including contents and datafiles
    ERROR at line 1:
    ORA-30013: undo tablespace 'UNDOTBS1' is currently in use
    Regards,
    Tim

    Yes i was able to recover the datafile but the alert_log kept on prompting that it is still corrupted. The datafile's status is online.
    I want to kill the session/s contributing to the PENDING OFFLINE status of the rollback segment so I can already drop the undotablespace and so
    that the alert log will stop prompting for that corrupted datafile in that UNDOTABLESPACE.
    Can i Just alter the tablespace's datafiles to offline drop then just drop it. Then I drop the tablespace?

Maybe you are looking for