How to drop users tablespace

Hey to all
     I want to drop USER tablespace wid data file but as we know many oracle users Scott OE data reside in users. How can I protect their data. One method which I read on net to export and import once again is quite cumbersome I run this query
SELECT
owner
, segment_name
, segment_type
FROM
dba_segments
WHERE
tablespace_name='USERS'
it give me two user OE and SCOTT. How can I protect their data before drop the user tablespace

Hi..
As you said direct load takes place, then the rows which are inserted are always inserted above the HWM.So the datafile size size kept on increasing.
i read about segment advisor i run the advisor it shrink the segment but users tablespace size on OS still 200 GB could anyone tell why??You would have run alter table <table_name> shrink space; -- This statement will procede in two steps:
- The first step makes the segment compact by moving rows further down to free blocks at the beginning of the segment.
- The second step adjusts the high watermark. For this Oracle needs an exclusive table lock,but for a very short moment only.
The HWM goes below, and table are now more well organized.This command doesn't resize the datafile at the OS level.So, the datafile sizes will remain the same.One thing which you can do is resize(decrease) the datafile.
MINIMUM DATAFILE SIZE
COLUMN block_size NEW_VALUE v_block_size
SELECT TO_NUMBER(value) AS block_size
FROM   v$parameter
WHERE  name = 'db_block_size';
COLUMN tablespace_name FORMAT A20
COLUMN file_name FORMAT A50
COLUMN current_bytes FORMAT 999999999999999
COLUMN shrink_by_bytes FORMAT 999999999999999
COLUMN resize_to_bytes FORMAT 999999999999999
SET VERIFY OFF
SET LINESIZE 200
SELECT a.tablespace_name,
       a.file_name,
       a.bytes/1024/1024 AS current_MB,
       (a.bytes - b.resize_to)/1024/1024 AS shrink_by_MB,
       b.resize_to/1024/1024 AS resize_to_MB
FROM   dba_data_files a,
       (SELECT file_id, MAX((block_id+blocks-1)*&v_block_size) AS resize_to
        FROM   dba_extents
        GROUP by file_id) b
WHERE  a.file_id = b.file_id
ORDER BY a.tablespace_name, a.file_name;Edited by: Anand... on Feb 17, 2009 12:01 PM

Similar Messages

  • How to drop Users DBF file in oracle 11g?

    Hi All
    I dropped the user and want to free the table space(To import another user(Which has more than 10 GB of record).
    the below is my query which i used to import the data and schema
    impdp system/test DIRECTORY=dump_dir DUMPFILE=exp_test.dmp FULL=Y LOGFILE=import_test.log REMAP_TABLESPACE=TEST_DATA:USERS
    After dropping my user i checked into the folder C:\oradata\orcl and i found two files USERS01.DBF(21.1GB,its 21.1 gb because i tried to cretae an another schema nd i got stuc up with low disk space.) and TEMP01.DBF(1.66GB).
    I tried to drop USERS tablespace and i could nt able to do it.
    Can any one help me to reduce the size of both two files?
    Thanks & Regards
    Vijay
    Edited by: Vijayamurugan on Jun 15, 2011 8:22 AM

    bobonacus wrote:
    shutdown immediate
    startup nomount
    alter database mount;
    why not just 'startup mount'?? Why the two-step?
    alter database rename file
    'e:\oracle\oradata\orcl\indx01.dbf',
    'e:\oracle\oradata\orcl\rbs01.dbf',
    'e:\oracle\oradata\orcl\system01.dbf',
    'e:\oracle\oradata\orcl\temp01.dbf',
    'e:\oracle\oradata\orcl\tools01.dbf',
    'e:\oracle\oradata\orcl\users01.dbf',
    'e:\oracle\oradata\orcl\file1.dbf',
    'e:\oracle\oradata\orcl\file2.dbf'
    to
    'd:\oracle\oradata\orcl\indx01.dbf',
    'd:\oracle\oradata\orcl\rbs01.dbf',
    'd:\oracle\oradata\orcl\system01.dbf',
    'd:\oracle\oradata\orcl\temp01.dbf',
    'd:\oracle\oradata\orcl\tools01.dbf',
    'd:\oracle\oradata\orcl\users01.dbf',
    'd:\oracle\oradata\orcl\file1.dbf',
    'd:\oracle\oradata\orcl\file2.dbf'
    ;I'm not sure the RENAME clause allows multiple files to be listed like that. In any event, just reduce the chance of error, I'd do it file by file.
    You forgot to mention that you need to actually move the files, at the os level. All the above does is change their entries in the control file. It doesn't do anything at all to the files themselves.
    >
    shutdown immediate
    startup
    No need for the shutdown. You could just ALTER DATBASE OPEN.
    >
    >
    you can get a full listing of files by
    alter database backup controlfile to trace;
    and you can then copy and paste from that ...
    Simpler, just select from dba_data_files.
    eta. of course assuming you mean move your database files rather than your installation
    Edited by: bobonacus on Jun 16, 2011 3:30 PM

  • How to drop user giving error ORA-03113

    hello,
    I am trying to drop user as follows
    SQL> drop user jbponm_trf cascade;
    drop user jbponm_trf cascade
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    SQL>
    pls suggest me how to drop user.

    Hi Dear,
    Please reconnect from SYS and try again ,Looking there is some problem in your oracle connection or network problem.
    Best Regards
    Faheem latif
    Senior Database Architect
    Genie Technologies (Pvt.) Ltd.

  • Unable to drop USERS tablespace.

    Hi All,
    I am trying to drop USERS tablespace and facing below error.
    PLATFORM:
    OS: Linux Ubuntu 9.04 LTS
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    PROBLEM:
    SQL> drop tablespace users including contents and datafiles cascade constraints;
    drop tablespace users including contents and datafiles cascade constraints
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-24005: must use DBMS_AQADM.DROP_QUEUE_TABLE to drop queue tables
    When I see, dba_queue_tables...
    SQL> select owner, queue_table, object_type from dba_queue_tables;
    OWNER               QUEUE_TABLE          OBJECT_TYPE
    SYS               ALERT_QT           SYS.ALERT_TYPE
    SYS               AQ$_MEM_MC
    SYS               AQ_EVENT_TABLE          SYS.AQ$_EVENT_MESSAGE
    SYS               AQ_SRVNTFN_TABLE      SYS.AQ$_SRVNTFN_MESSAGE
    SYS               KUPC$DATAPUMP_QUETAB     SYS.KUPC$_MESSAGE
    SYS               SCHEDULER$_EVENT_QTAB     SYS.SCHEDULER$_EVENT_INFO
    SYS               SCHEDULER$_JOBQTAB     SYS.ANYDATA
    SYS               SYS$SERVICE_METRICS_TAB     SYS.SYS$RLBTYP
    SYSMAN               MGMT_NOTIFY_QTABLE     SYSMAN.MGMT_NOTIFY_NOTIFICATION
    SYSTEM               DEF$_AQCALL
    SYSTEM               DEF$_AQERROR
    11 rows selected.
    Also, there are no tables in USERS tablespace now, as I've moved all to other tablespace.
    SQL> select count(*) from dba_tables where tablespace_name='USERS';
    COUNT(*)
         0
    USERS tablespace is not permanent tablespace as I've changed it to some other, still the problem.
    SQL> select property_name, property_value from database_properties where PROPERTY_NAME = 'DEFAULT_PERMANENT_TABLESPACE'
    PROPERTY_NAME          PROPERTY_VALUE
    DEFAULT_PERMANENT_TABLESPACE DEV
    Can you please help me drop the USERS tablespace.

    Thanks Hemant,
    I queried as below.
    SQL> select count(*) from dba_segments where tablespace_name='USERS';
    COUNT(*)
         7
    SQL> SELECT owner, segment_name, segment_type from dba_segments where tablespace_name='USERS';
    OWNER               SEGMENT_NAME
    SEGMENT_TYPE
    IX               SYS_IOT_TOP_62384
    INDEX
    IX               SYS_IOT_TOP_62386
    INDEX
    IX               SYS_IOT_TOP_62390
    INDEX
    IX               SYS_IOT_TOP_62392
    INDEX
    IX               SYS_IOT_TOP_62395
    INDEX
    IX               SYS_IOT_TOP_62397
    INDEX
    IX               SYS_IOT_TOP_62401
    INDEX
    7 rows selected.
    SQL> drop user ix cascade;
    drop user ix cascade
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-24005: must use DBMS_AQADM.DROP_QUEUE_TABLE to drop queue tables
    Then connected as 'IX' user.
    IX@devdb> exec sys.DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYS_IOT_TOP_62384',force => TRUE);
    BEGIN sys.DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYS_IOT_TOP_62384',force => TRUE); END;
    ERROR at line 1:
    ORA-24002: QUEUE_TABLE IX.SYS_IOT_TOP_62384 does not exist
    ORA-06512: at "SYS.DBMS_AQADM_SYS", line 4084
    ORA-06512: at "SYS.DBMS_AQADM", line 197
    ORA-06512: at line 1
    IX@devdb> alter index SYS_IOT_TOP_62384 rebuild tablespace dev;
    alter index SYS_IOT_TOP_62384 rebuild tablespace dev
    ERROR at line 1:
    ORA-28650: Primary index on an IOT cannot be rebuilt
    IX@devdb> SELECT INDEX_TYPE,TABLE_NAME,TABLESPACE_NAME,STATUS FROM USER_INDEXES;
    INDEX_TYPE          TABLE_NAME               TABLESPACE_NAME          STATUS
    LOB               STREAMS_QUEUE_TABLE      DEV                    VALID
    NORMAL               ORDERS_QUEUETABLE          DEV                    VALID
    NORMAL               STREAMS_QUEUE_TABLE      DEV                    VALID
    NORMAL               AQ$_ORDERS_QUEUETABLE_S     DEV                    VALID
    NORMAL               AQ$_STREAMS_QUEUE_TABLE_C     DEV                    VALID
    NORMAL               AQ$_STREAMS_QUEUE_TABLE_S     DEV                    VALID
    LOB               STREAMS_QUEUE_TABLE      DEV                    VALID
    LOB               ORDERS_QUEUETABLE          DEV                    VALID
    IOT - TOP          AQ$_STREAMS_QUEUE_TABLE_T     USERS               VALID
    IOT - TOP          AQ$_STREAMS_QUEUE_TABLE_I     USERS               VALID
    IOT - TOP          AQ$_STREAMS_QUEUE_TABLE_H     USERS               VALID
    IOT - TOP          AQ$_STREAMS_QUEUE_TABLE_C     USERS               VALID
    IOT - TOP          AQ$_ORDERS_QUEUETABLE_T     USERS               VALID
    IOT - TOP          AQ$_ORDERS_QUEUETABLE_I     USERS               VALID
    IOT - TOP          AQ$_ORDERS_QUEUETABLE_H     USERS               VALID
    15 rows selected.
    IX@devdb> alter table AQ$_STREAMS_QUEUE_TABLE_T move tablespace dev;
    alter table AQ$_STREAMS_QUEUE_TABLE_T move tablespace dev
    ERROR at line 1:
    ORA-08108: may not build or rebuild this type of index online

  • How can drop TEMP tablespace

    Hi,
    Please help me

    1) Create new temporary tablespcae
    2) Chechk new temp tablespace in default
    3) Drop tem pablespace
    CREATE TEMPORARY TABLESPACE TEMP2 TEMPFILE’C:\ORACLE\10.2\ORADATA\PROD\temp2_01.dbf’ SIZE 100M AUTOEXTEND ON NEXT 256K
    MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;
    ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP2;
    DROP TABLESPACE temp INCLUDING CONTENTS AND datafiles

  • Error when dropping a user/tablespace

    Hi
    I am trying to drop user/tablespaces, but I got the following error
    SQL> drop user SM92 cascade;
    drop user SM92 cascade
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00942: table or view does not exist
    Currently this user has not tables or view, the statement select * from all_tables where owner='SM92' return no row
    ANyone knows why I can't drop this user? What should I check?
    Thanks
    Li

    Hi, probably the user has dependency with other schemas, please review the Note:361576.1 into metalink site.
    Good luck.
    Regards.

  • Cannot drop user -must use DBMS_AQADM.DROP_QUEUE_TABLE to drop queue tables

    Hi,
    I had this issue before, but forgot the command that should be used to flush some kind of a trash bin.
    Can someone assist me?
    Thanks!

    Hi,
    Use this link :
    Re: Unable to drop USERS tablespace.

  • 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]

  • How to drop the datafile in a tablespace

    hi,
    I need to drop the datafile in a tablespace.How to drop the datafile in the tablespace.If iam able to drop the datafile and is it possible to create the datafiles with the same name.could u pls help me out..
    Thanks in advance,
    R.Ratheesh

    sql > alter database <datafile> offline drop ;
    sql > alter database open ;What if the datafile have the segments in it, I believe users will not be able to access them. And system will put the datafile to Recovry mode not drop it.
    Dropping a datafle is possible only in 10G. In 9i you can reduce the size of file below the size of your min extents so that the space wont be allocated from that datafile or you may need to recreate a new tablespace copy all the segments from old tablespace and drop old one.
    Cheers

  • How to restore views and procedures after drop user command?

    How to restore views and procedures after drop user command?
    We have 817 EE on NT and one developer created a lot of procedures, functions and vews. DB was not backuped and archived and export has not been done - our fault and we understand it. Sorry for this.
    Ok, now the story: another developer dropped this db user and we lost everything: procedures, functions and vews. The new user with trhe same name was created and new schema was imported in this user, but all old objects are lost. We don't have export and backup and archive log files.
    Question: may we can restore this lost stuff from some other sources. We are looking for lost codes, not data. May be we can use redo logs or shared pool or any other things. Any idea will be appreciated.
    Thanks.
    Victor
    [email protected]

    The switch has occurred after user was dropped, the data has been overwritten and there is be no way to use redo log files.
    I would like to explore another opportunity. Is possible to use Shared Pool or any Data Dictionary internal information to restore texts of the lost SQL and PL/SQL scripts executed in this DB before user was dropped? Not too many scripts are executed in this DB and the lost ones may still be in stack. I remember that Shared Pool (cash) should keep last executed scripts in order to improve performance. They probably are kept in some special format. Can we restore these scripts? Of course they also might be pushed out by Import that had been done after user was dropped.
    Thanks for your help,
    Victor

  • How to alert user using BizTalk if a file is not dropped in a folder during a specified time using file adapter (or any other)

    Hi,
    I have a requirement wher the client wants BizTalk to alert users somehow when a file is not received at specific time. I am using a FILE receive adapter, the requirement is, if the FILE adapter does not receive a file on time then BizTalk should alert the
    users somehow. The client wants to use ESB toolkit to do this job.
    does anybody have any idea ?
    PLEASE HELP
    Thanks & Regards
    Vikram

    Duplicate Thread.
    Follow here:
    https://social.msdn.microsoft.com/Forums/en-US/3e314d17-8b0c-451c-921a-65dbab0612a8/how-to-alert-user-using-biztalk-if-a-file-is-not-dropped-in-a-folder-during-a-specified-time-using?forum=biztalkgeneral

  • How to monitor DROP USER

    Hi Guys,
    Would anybody suggest me how to monitor the DROP USER command?
    OS: AIX, Oracle: 11.2.0.2
    CSM

    CSM.DBA wrote:
    I'm extremely sorry for not framing the question properly.
    I mean, Is there any way I can monitor the progress of the DROP USER command.
    To give more details, I have a schema with 500G+ data and I want to drop that schema. No doubt it'll take significant time but how to monitor how it's progressing?
    Using v$session_longops ?
    Aman....

  • How to drag and drop user from one node to other node.

    Dear All,
    How to drag and drop user from one node to other node.I tried but no success.
    What are precautions to be taken.
    Cay anybody kindly explain it.
    Thank you.

    Hello, if you had this message you had created BP....
    Now you don't have to user USERS_GEN this transaction is used only in first action, when you create the user in R/3 and then you pass this user to EBP in the organizational structure.
    Now you have to:
    1) Go to PPOMA_BBP
    2) Double click on organizational unit that you want to put this user (purchasing organization or purchasing group box for example)
    3) Select assign button in the top of the functions in the transaction
    4) Click on incorporates -- position
    5) Put userID that you want to add in this organizational unit
    6) Click Save
    Thanks
    Rosa

  • How to identify temp tablespace user in the past

    hi,
    can anyone guide me on how to identify temp tablespace users and corresponding temp space amount they used in the past?
    we have this situation where in we need to identify the top temp tablespace user last jan 1 around a specific time.
    is this possible? do these get stored in one of the tables in the dictionary? any sql statement?
    thanks.

    900666 wrote:
    hi ckpt,
    thats unfortunate..=(
    anyways, any sql that can be used to capture current sessions with their used mb in temp tablespace? for future monitoring.
    thansk.Here is example
    SQL> SET LINESIZE 145
    SQL> SET PAGESIZE 9999
    SQL> SET VERIFY   off
    SQL>
    SQL> COLUMN tablespace_name       FORMAT a15               HEAD 'Tablespace Name'
    SQL> COLUMN username              FORMAT a15               HEAD 'Username'
    SQL> COLUMN sid                   FORMAT 99999             HEAD 'SID'
    SQL> COLUMN serial_id             FORMAT 99999999          HEAD 'Serial#'
    SQL> COLUMN contents              FORMAT a9                HEAD 'Contents'
    SQL> COLUMN extents               FORMAT 999,999           HEAD 'Extents'
    SQL> COLUMN blocks                FORMAT 999,999           HEAD 'Blocks'
    SQL> COLUMN bytes                 FORMAT 999,999,999       HEAD 'Bytes'
    SQL> COLUMN segtype               FORMAT a12               HEAD 'Segment Type'
    SQL>
    SQL> BREAK ON tablespace_name ON report
    COMPUTE SUM OF extents   ON report
    SQL> SQL> COMPUTE SUM OF blocks    ON report
    SQL> COMPUTE SUM OF bytes     ON report
    SQL>
    SQL>
    SQL> SELECT
      2      b.tablespace          tablespace_name
      3    , a.username            username
      4    , a.sid                 sid
      5    , a.serial#             serial_id
      6    , b.contents            contents
      7    , b.segtype             segtype
      8    , b.extents             extents
      , b.blocks              blocks
      9   10    , (b.blocks * c.value)  bytes
    FROM
    11   12      v$session     a
    13    , v$sort_usage  b
    14    , (select value from v$parameter
    15       where name = 'db_block_size') c
    16  WHERE
    17        a.saddr = b.session_addr
    18  /
    Tablespace Name Username           SID   Serial# Contents  Segment Type  Extents   Blocks        Bytes
    TEMP          SYSTEM            1333      4725 TEMPORARY LOB_DATA            1      128    1,048,576
                    SYSTEM            1562       444 TEMPORARY SORT               89   11,392   93,323,264
                    SYSADM            1602        80 TEMPORARY LOB_DATA            1      128    1,048,576
                    SYSTEM            1613     18693 TEMPORARY SORT               89   11,392   93,323,264
    sum                                                                          180   23,040  188,743,680
    SQL>

  • 2 Undo Tablespace both ONLINE, How to drop previous undo tbs

    Hello Team,
    Undo management=auto
    After Cloning :-
    To reclaim space i created another undo tablespace, but now both are online, but as per oracle as soon as you switch undo tablespace, previous undo TBS gets in Pending offline mode,offline mode, (So that transaction get finished)
    But in my case Both UNDO Tablespaces are online
    Previous Undo TBS1:- 600 GB
    New UNDo Tb2s:- 100GB
    Please suggest how to drop this online undo TBS1
    TABLESPACE_NAME ONLINE_
    APPS_UNDOTS1 ONLINE
    APPS_UNDOTS1 ONLINE
    APPS_UNDOTS1 ONLINE
    APPS_UNDOTS1 ONLINE
    APPS_UNDOTS1 ONLINE
    APPS_UNDOTS1 ONLINE
    APPS_UNDOTS1 ONLINE
    APPS_UNDOTS1 ONLINE
    APPS_UNDOTS1 ONLINE
    APPS_UNDOTS2 ONLINE
    APPS_UNDOTS2 ONLINE
    TABLESPACE_NAME ONLINE_
    APPS_UNDOTS2 ONLINE

    Hi As per
    select segment_name,owner,tablespace_name,status from dba_rollback_segs where tablespace_name like 'UNDOTBS1';
    All Are offline for UNDOTBS1(Previous)
    SEGMENT_NAME OWNER TABLESPACE_NAME STATUS
    SYSSMU49861044602693$ PUBLIC APPS_UNDOTS1 OFFLINE
    SYSSMU4893847838046$ PUBLIC APPS_UNDOTS1 OFFLINE
    SYSSMU48682660477388$ PUBLIC APPS_UNDOTS1 OFFLINE
    SYSSMU47753309457002$ PUBLIC APPS_UNDOTS1 OFFLINE
    SYSSMU47131240212364$ PUBLIC APPS_UNDOTS1 OFFLINE
    434 rows selected.

Maybe you are looking for

  • Line Format in Chart

    Is there a way or work around to create a dotted line (constant value or limit) on a combination chart?  This would be used to indicate a minimum limit.

  • Do i have to charge my ipad overnight

    do i have to keep my ipad on charge overnight

  • Sales order /billing

    Hello My sales order type is zmf , i want to dispatch the material from sales order  but it should not allow create commercial invoice i want to create only proforma invoice from it kindly guide how to do it . sales order/obd/proforma invoice. Kindly

  • Check In failed for the activity

    Hi,     Here we have developed a Webdynpro application through JDI. We have created an activity for the application. The application is working fine, but we are facing the problem with the check in. It is saying check in failed for the activity. Belo

  • RF Scanner Introduction/ Implementation

    Hi Please explain the procedured invloved in a RF scanner implementation in a Warehouse. I assume the areas involved are. 1) IMG Mobile config 2) SAP Console setting 3) RF Device to SAP Console communication. Plse give as much information as possible