How to a drop tablespace ?????

Hi Expert !!
I am living my life in ORA errors. To describe the complete picture:
1) We have a partitioned table whose partitions reside in multiple tablespaces.
2) One of the datafiles got corrupted where one old partition resides.
3) We are not interested in restoring the corrupt datafile and no more require that partition.
4) How do I drop the partition or tablespace?
Well, I have tried the following but no success:
startup mount
alter database datafile 'C:\MYDB\DATA\SALES_2005_TS1.DBF' offline;
alter database open;
conn sales/sales
SQL> ALTER TABLE sales_range DROP PARTITION sales_2005 update global indexes;
ALTER TABLE sales_range DROP PARTITION sales_2005 update global indexes
ERROR at line 1:
ORA-00376: file 7 cannot be read at this time
ORA-01110: data file 7: 'C:\MYDB\DATA\SALES_2005_TS1.DBF'
SQL> conn /as sysdba
Connected.
SQL> drop tablespace sales_2005_ts including contents;
drop tablespace sales_2005_ts including contents
ERROR at line 1:
ORA-14404: partitioned table contains partitions in a different tablespace
SQL> alter tablespace SALES_2005_TS offline;
alter tablespace SALES_2005_TS offline
ERROR at line 1:
ORA-01191: file 7 is already offline - cannot do a normal offline
ORA-01110: data file 7: 'C:\MYDB\DATA\SALES_2005_TS1.DBF'
SQL> alter tablespace SALES_2005_TS offline immediate;
Tablespace altered.
SQL> drop tablespace SALES_2005_TS including contents;
drop tablespace SALES_2005_TS including contents
ERROR at line 1:
ORA-14404: partitioned table contains partitions in a different tablespace
I did search on net and metalink but unfortunately couldn't find anything useful. I did try metalink note 267125.1 but again no luck.
Could any of you shed some light on this?
Regards

What about the following :
SQL> create tablespace test1 datafile 'E:\oracle\oradata\DEMO102\test01.dbf' size 1m;
Tablespace created.
SQL> create tablespace test2 datafile 'E:\oracle\oradata\DEMO102\test02.dbf' size 1m;
Tablespace created.
SQL> create table x ( x number not null, y number not null ) partition by list (y) ( partition p1 va
lues (1,2,3) tablespace test1, partition p2 values (4,5,6) tablespace test2);
Table created.
SQL> insert into x values (1,3);
1 row created.
SQL> insert into x values (2,6);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from x;
         X          Y
         1          3
         2          6
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> host del E:\oracle\oradata\DEMO102\test02.dbf
SQL> startup
ORACLE instance started.
Total System Global Area  272629760 bytes
Fixed Size                  1290084 bytes
Variable Size             234881180 bytes
Database Buffers           29360128 bytes
Redo Buffers                7098368 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 10 - see DBWR trace file
ORA-01110: data file 10: 'E:\ORACLE\ORADATA\DEMO102\TEST02.DBF'
SQL> alter database datafile 'E:\oracle\oradata\DEMO102\test02.dbf' offline;
Database altered.
SQL> alter database open;
Database altered.
SQL> select * from x;
ERROR:
ORA-00376: file 10 cannot be read at this time
ORA-01110: data file 10: 'E:\ORACLE\ORADATA\DEMO102\TEST02.DBF'
no rows selected
--At this point, I reproduced your problem
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area  272629760 bytes
Fixed Size                  1290084 bytes
Variable Size             239075484 bytes
Database Buffers           25165824 bytes
Redo Buffers                7098368 bytes
Database mounted.
SQL> alter database datafile 'E:\oracle\oradata\DEMO102\test02.dbf' offline drop;
Database altered.
SQL> alter database open;
Database altered.
SQL> drop tablespace test2 including contents;
drop tablespace test2 including contents
ERROR at line 1:
ORA-14404: partitioned table contains partitions in a different tablespace
SQL> alter table x drop partition p2;
Table altered.
SQL> drop tablespace test2;
Tablespace dropped.
SQL> create table x1 as select * from x;
Table created.
SQL> select * from x;
         X          Y
         1          3
SQL> Nicolas.

Similar Messages

  • How to drop Tablespace containg materilized views

    Hi friends,
    I am trying to drop a tablespace but gives an error
    SQL> drop tablespace tabs_name including contents and datafiles cascade constraints;
    drop tablespace tabs_name including contents and datafiles cascade constraints
    ERROR at line 1:
    ORA-23515: materialized views and/or their indices exist in the tablespace
    Please tell me the solution
    Regards,
    Neeraj Goel

    ORA-23515: 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.
    Examples
    Dropping a Materialized View: Examples The following statement drops the materialized view emp_data in the sample schema hr:
    DROP MATERIALIZED VIEW emp_data;
    The following statement drops the sales_by_month_by_state materialized view and the underlying table of the materialized view, unless the underlying table was registered in the CREATE MATERIALIZED VIEW statement with the ON PREBUILT TABLE clause:
    DROP MATERIALIZED VIEW sales_by_month_by_state;
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8019.htm

  • Undable to drop tablespace ORA-01561: failed to remove all objects in the

    hi,
    i am unable to drop table tablespace how can i do that??
    please advise
    DROP TABLESPACE tbs_tp2 INCLUDING CONTENTS AND datafiles
    ERROR at line 1:
    ORA-01561: failed to remove all objects in the tablespace specified
    Thanks in advance
    siva
    chennai

    Have you tried dropping the objects individually? You can see which objects still belong to this tablespace by using the DBA_SEGMENTS view as shown below:
    SELECT OWNER, SEGMENT_NAME, SEGMENT_TYPE, TABLESPACE_NAME
    FROM DBA_SEGMENTS
    WHERE TABLESPACE_NAME=tbs_tp2;HTH!

  • Drop tablespace in Oracle 8i

    I want to know how to drop tablespace in Oracle 8i.
    Actually i read on internet that we cannot drop tablespace in oracle 8i.
    Is that true?
    How can i drop the tablespace in 8i?
    Thanks,

    8i does have a DROP TABLESPACE command. What it does not have is the "AND DATAFILES" clause. Thus, it will not remove the datafiles at the OS layer (eg filesystem).

  • Snapshot too old error during drop tablespace

    Hi Experts
    When we are doing BW reorg and steps followed are
    1. created a newtablespace with source tablespace TABART class reference.
    2. Export the source tablespace to the filesystem level.
    3. DROP the source tablespace now.
    4. Rename the new tablespace to source tablespace name.
    5. Import
    Here in the third step i have received snapshot too old error.
    BR0301E SQL error -604 at location BrSqlExecute-1, SQL statement:
    '/* BRSPACE */ drop tablespace PSAPADSOLD including contents and datafiles cascade constraints'
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01555: snapshot too old: rollback segment number 0 with name "SYSTEM" too small
    BR1017E Execution of SQL statement 'drop tablespace PSAPADSOLD including contents and datafiles cascade constraints' failed
    so i tried to rename the tablespace and set to offline and tried to import only 240 tables were imported compared to 24057 tables.Still the PSAPADS - Source tablespace shows 65000 elements.
    my queries:
    1. After Export of the tablespace how come the Source tablespace retain the tables.
    2. why i could not able to drop the tablespace
    I had increased the UNDO_RETENTION to 86400 my oracle version is 10.2.04.
    Source table space PSAPADS is 80 GB and has only 30 GB data and the remaining are free.
    PSAPUNDO was 17GB in size.
    Kinldy suggest
    Regards
    Bala

    Hi Stefa
    Thanks for your reply.
    how to find the System undo is still active.How to track which Undo which is active and their steps.
    As per the metalink note our PSAPUNDO is Locally Managed Tablepsace hence the second workaround is applicable..
    How to validate this will not give a problem again while i am doing reorganization.
    When i checked a sap note 1039060 this note is applicable to windows i dont how it can be impleneted.
    Whether any merge fix will help on this
    Regards
    Bala

  • How i can change tablespace of a table in oracle 8.04

    Dear I want to move tablespace of a table in oracle 8.04 version but it is not working my statement is
    ALTER TABLE ACCOUNTING_ENTRY MOVE TABLESPACE EDI_TSPACE;
    and got the following error message:
    ORA-14004: missing PARTITION keyword
    how i can change tablespace of a table

    Hi,
    It seems that the move tablespace feature is available on 8.1 or higher versions of Oracle. In your case you can try one of the foll....
    Option 1:
    Step 1:CREATE TABLE T1
    TABLESPACE NEWTBS
    AS(SELECT * FROM T);
    Step 2: Rename or Drop the old table.
    Step 3: Rename the new table to the old table name.
    Option 2:
    Step 1: Export the old table.
    Step 2: Rename or Drop the old table.
    Step 3: Create the table in the new tablespace. You may use the INDEXFILE from the imp command here.
    Step 4: Import the old table and use IGNORE=Y
    Reply back if you need assistance on syntax.
    Regards.

  • Dropping Tablespaces  ORA 23515 Error

    Hi
    I am trying to drop a tablespace
    DROP TABLESPACE EXAMPLE INCLUDING CONTENTS AND DATAFILES;
    I get ORA 23515 Error " Materialized Views and /or their indices exist in the Tablespace"
    How to find out which Materialized views and /or indices are to be dropped? Is there a way to find them?

    You can find materialized views from the database using the following select
    select object_name,object_type from dba_objects where owner='xxxxx' and object_type='MATERIALIZED VIEW';
    and then drop the MV using command
    drop materialized view xxxxx;

  • How can i drop datafile

    I have dropped a tablespace with drop tablespace incliding contents command
    Now how can i remove the datafile for that tablespace?

    I have dropped a tablespace with drop tablespace incliding contents command
    Now how can i remove the datafile for that tablespace?Whats the oracle version?
    If you used, drop tablespace tsname including contents, would drop the tablespace from the database.
    You have to manually remove the datafiles from OS.
    If could've used, drop tablespace tsname including contents and datafiles, would have dropped the tablespace as well as removed the datafiles from OS.

  • How can i drop a tablescpace without your dbf ?

    Hi,
    My problem is..
    A have a tablespace and this tablespace has 70 dbf in the past, but someone delete that tablespaces with winscp ... dont use any script to do this, now when i try drop that tablespace return a erro that dont found a dbf. i need drop that tablescpace and delete her dbf files but the FISIC dbf files was deleted, but in sql developer show's the dbf files.
    How i can DROP ALL DBF FILES AND THE TABLESPACE ?
    Thx !

    try
    drop tablespace <tbs> including contents and datafiles;post the exact error message and also verison
    or
    select file_name, tablespace_name from dba_data_files WHERE tablespace_name = <TBS>;
    and do like
    alter database datafile 'file_name' offline drop;and then drop the tablespace
    Edited by: CKPT on Oct 28, 2010 8:03 PM

  • Drop tablespace Example in Oracle 9i

    I have used Oracle 9i (9.2) database in my P.C. Today my database(ORCL) not open due to corruption of
    EXAMPLE01.dbf datafile. Now I want to drop the tablespace EXAMPLE associated with EXAMPLE01.dbf
    file. My database now in mount stage, so i can not drop this tablespace using the following command.
    'DROP TABLESPACE EXAMPLE' ;
    message comes 'DATABASE NOT OPEN'.
    how could i solve this problem.

    Hi,
    Is this your test database?
    I recommend you backup your database in a state what it is now before procedding to any of the mentioned solution here.
    And before procedding below do you like to post where it shows that datafiles got corrupted?
    You need to offline your datafile at the mount stage.
    alter database datafile 'datafile name' offline
    alter database open
    drop tablespace <tablespace name> drop including contentsRegards
    Anurag
    PS: All the above commands are irrecoverable if you do not have a backup.

  • How to Shrink UNDO Tablespace

    Hello,
    We had a UNDO Tablespace of 22Gb but it is using just 2GB. How to shrink undo tablespace. we are using clustered 3 node production database 10.2.0.4
    Is there is way that we can shrink UNDO Tablespace or do i need to create a UNDO tablespace and assign the undo tablespace to DB and drop the old UNDO?
    How to ensure that transactions are done and free to drop the old UNDO?
    Is it something we need to restart all the three nodes as each node has its own UNDO Tablespace.
    Need Help on this issue.
    would appreciate your quick response.
    Thanks

    if i am in your place i will do the following:
    <pre class="jive-pre">1-Query DBA_DATA_FILES to determine the name of the datafiles of the UNDO</pre>
    2. Create a new UNDO tablespace.
    <pre class="jive-pre">CREATE UNDO TABLESPACE undo_ts2 DATAFILE '/directory/undo_ts2_01.dbf' SIZE xxxM;</pre>
    3. Modify the database parameter to use the new UNDO tablespace.
    <pre class="jive-pre"> ALTER SYSTEM SET undo_tablespace=undo_ts2 SCOPE=BOTH; </pre>
    4-The Drawback:
    <pre class="jive-pre">New transactions will begin using the new undo tablespace. After some time passes (at least the number of seconds specified by the UNDO_RETENTION initialization parameter), you can drop the old UNDO tablespace. The downside to this approach is that for a short time period, your database will have two UNDO tablespaces</pre>
    Regards
    Mohamed

  • Drop tablespace

    Dear all,
    I want to know that how long (estimate) am I need to drop a tablespace for about 15G datafile with Sun Solaris E450. Will it need a very long time to do it?
    Thank you
    Kwan
    21 April 2003

    Droping of tablespace mainly depends how many objects in the tablespace and no of extents created for each objects.
    It is least affected by the size of the datafile. Time required to delete the file can be avoided.
    drop tablespace <tablespace_name> including contents;
    (please do not use "including contents and files" clause here. You can manually delete the datafiles);

  • Automatic deleting of datafiles after DROP TABLESPACE

    Lazy junior dba question. How can i order oracle to delete files automaticly after deleting them from control file (like drop tablespace command)?
    What technology/approach should I use? Can ASM help me?
    Thnaks.

    Well, ideally after issuing
    DROP TABLESPACE <TBS_NAME> INCLUDING CONTENTS AND DATAFILES; the datafiles corresponding to that tablespace should get deleted automatically. Although, in my case, sometimes it gets deleted automatically, but sometimes it doesn't(Windows Server).
    Comments from others will be useful.
    Regards,
    Anand

  • Drop tablespace and recreate a new one!

    Hello All,
    One of my database(oracle 10g, aix server ) has a tablespace called tools for xample. its size is nearly 16g, but current usage is around 170 mb only. So i want to resize the tablespace size to 2G
    So what i did is, took export of tools tablespace and full database export backup separately. so in my hand i have, tools tablespace backup(export file) and whole database backup(took using again exp utility)
    Now i tried to drop the tools tablespace and got this error
    SQL> DROP TABLESPACE TOOLS INCLUDING CONTENTS AND DATAFILES;
    DROP TABLESPACE TOOLS INCLUDING CONTENTS AND DATAFILES
    ERROR at line 1:
    ORA-29857: domain indexes and/or secondary objects exist in the tablespace.
    so i also planned, instead of dropping the tablespace, i thought of removing objects in the tablespace and resize it and import using the backup what i have.
    when i query the tablespace, i got 4 object. index, tables, lobindex and lobsegment.
    i wrote script to drop indexes and tables.but dint execute yet.
    how to remove/move lobindex and lobsegment, so that i can resize the tools tablespace?
    anyone has come across this issue? or any other method is there to over come this issue?
    Please provide detailed step if you have so.
    Regards,
    Pradeep. V

    Hi Nicolas,
    Kindly explain this point
    Step 2 above, move lob... check USER_LOBS to get the corresponding table/column from your lob_Segment...
    what query i need to use to find user_lobs,
    is this the query you saying about?
    select * from user_lobs where tablespace_name='TOOLS';
    it dint return any rows

  • How to put drop down in table control ?

    Hi All,
    I m writing one module pool program to edit table.
    I want dropdown to one field so that user can select the appropriate value. And also I want to save that record.
    So how to get the dropdown list and after editing that record how to save that in the database?
    Thanx in advance.
    -Umesh

    Hi Umesh,
    Please check this demo program RSDEMO_TABLE_CONTROL on how to add drop down list in table control. Also check this program DEMO_DYNPRO_TABCONT_LOOP_AT as well.
    To save to database you can code something like this in PAI.
    MODULE USER_COMMAND_0100 INPUT.
      SAVE_OK = OK_CODE.
      CLEAR OK_CODE.
      CASE SAVE_OK.
        WHEN 'SAVE'.
          MODIFY <database table> FROM TABLE <table control>.
          IF SY-SUBRC = 0.
          ELSE.
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Hope this will help.
    Regards,
    Ferry Lianto

Maybe you are looking for