Dropping a Datafile and Deleting its References

Using sqlplus how do I delete datafiles and any references to them?
At the moment I start the database in mount mode and use:
ALTER DATABASE DATAFILE 'O:\BCS\test.ora' OFFLINE DROP;
Which drops the datafile, but when I try to open the database it fails because it is still referencing the datafile.
How do I delete this reference?
Any thoughts or suggestions are greatly appreciated.
Regards
Toby

I usually use the following sql to see what is in a tablespace before I drop it with
"drop tablespace users including contents and datafiles;"
column meg format 999999999
column tablespace_name format a20
set wrap off
set lines 120
set heading on
set pages 50
select round(sum(a.bytes)/1024/1024) meg,
count(*) extents,a.tablespace_name,a.segment_type,a.owner||'.'||a.segment_name
from dba_extents a
where a.tablespace_name=upper('&1')
group by a.tablespace_name,a.segment_type,a.owner||'.'||a.segment_name
order by round(sum(a.bytes)/1024/1024)
I also map the contents of datafiles with the following you can get the file_id from v$datafile or dba_data_files:
column owner format a30
column object format a30
set lines 120
set wrap off
set trunc off
set pages 50
set feedback on
column file_id format 999
select     /*+ Rule */     'free space' owner     /*"owner" of free space*/
,          ' ' object          /*blank object name*/
,          file_id                    /*file id for the extent header*/
,          block_id               /*block id for the extent header*/
,          blocks                    /*length of the extent, in blocks*/
from          dba_free_space
where          file_id=&1
union
select     /*+ Rule */ substr(owner,1,20)||' '||substr(segment_type,1,9) /*owner name (first 20 chars)*/
,          substr(segment_name,1,32)||'.'||partition_name     /*segment name*/
,          file_id                    /*file id for the extent header*/
,          block_id               /*block id for the extent header*/
,          blocks                    /*length of the extent, in blocks*/
from           dba_extents
where          file_id=&1
order by     3,4
And datafiles can be dropped in 10g if they are empty:
alter tablespace users drop datafile '/oracle/oradata/users01.dbf';
Good luck

Similar Messages

  • I dropped my iphone and ow its not turning on

    I dropped my iPhone 5 on the floor, the screen popped out and now its not turning on and when i put it on charge it just replays the apple logo over and over. how can i fix it?

    You cannot. Make an appointment at the Genius Bar of the nearest Apple Store or Authorized Apple Service provider and be prepared to purchase an out of warranty replacement. User damage is not covered under warranty.

  • Can't drop UNDOTBS datafile and tablespace

    The datafile is already offline but i still can't drop either that or the entire UNDOTBS tablespace.
    Please help!

    Hi,
    the answer gives by mr stevencallan is right.
    first create new undo tablespace for ur instance and then assign this undo tablespace by
    alter system set undo_tablespace=<undo_tb name> scope=both;
    later u drop ur old undo tablespace.
    no need of any shutdown inthis scenario.
    Thanks and Regards
    Kuljeet Pal Singh

  • ERR I dropped the IPOD and now its

    stuck on the song that was playing it will not do aything and is not recognized when I plug in the usb connector
    no what? i don't know what do do. I tired Reset restore etc
    Amy

    I understand the warranty info
    still I don't think it dropping to the floor once should have ruined it, KWIM
    so I guess my ques is, is it worth the repair cost, since the warranty won't cover this? or just a buy a new one or rather the NANO?
    I did let the battery die, no the screen just shows a folder and the apple support site but again it will do nothing. I tried all the steps. Probably all a waste of time at this rate
    the computer will not recognize the ipod is plugged in to restore it, tried a different firewire as well, didn't work.
    its not my keyboard or computer the were purchased in July as well
    any other ideas are appreciated
    willing to buy another IPOD I work at home and need it
    TIA
    Amy

  • I dropped my iphone and now its stuck on recovery mode.

    i dropped my iphone on the kitchen floor and it went completely off. Now i got it on to show something on the screen, but its just stays only on recovery mode. I plug phone into itunes to try to restore and after the restoring process is complete, it gives me a error -1. Then goes right back to recovery mode. Does any of you know how i can fix this problem and get my itunes to read the phone so i can restore it please?

    Make an appointment at the genius bar. An out of warranty replacement will cost you $199 if you didn't buy AppleCare+.
    There is no magic that can fix broken hardware.

  • 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

  • Drop dbf file and then recover - possible?

    We have to 'startup mount' our database and then
    1. alter database datafile ....12.dbf offline
    2. recover using backupcontrolfile until cancel.
    Can we do this on oracle 9.1.7

    Hi,
    I am not sure if I have understood the question.
    Here is my translation of my understanding:
    - you have dropped a datafile and do not have a backup, right?
    - you want to recover the lost datafile, right?
    My question now is:
    - how did you drop the file?
    1. did you remove it on OS level?
    2. did you drop the tablespace?
    Here the possible answers:
    => 1: if you "just" removed the file from the OS it is no problem to recreate it and recover it, under the condition that you have all the redologs archived or online which contain all the changes applied to the db since the creation of the lost datafile. Oracle will know the creation change number for the file and will be able to create a new one. It works like this:
    SQL > ALTER DATABASE CREATE DATAFILE '<name of your lost file>';
    SQL> RECOVER DATAFILE '<name of your lost file>' -- number of the file is also possible
    SQL > ALTER DATABASE DATAFILE '<name of your lost file> ONLINE;
    => 2: if you have dropped teh entire database by DROP TABLESPACE ... INCLUDING CONTENTES AND DATAFILES; it is a little more tricky. Now you first need a controlfile which still contains the talespace information, because the tablesapce has been removed from the controlfile with the drop stsatement. And you can only recover what is in the controlfile. So you need a backup of the old controlfile, either a binary controlfile backup or a backup from a trace controlfile backup.
    In this case you must shutdown the db and startup with a backup controlfile. You must restore the entire db from backup and recover incomplete, which means loss of data!
    You must recover the whole db to a point in time short before the drop tablespace. YOu can find the timestamp for the drop tablespace in the alertSID.log file.
    The first thing you do is to take a full backup of the entire db including redologs and controlfile, just in case you make a mistake in order to be able to get back to where you started!!!
    Then resore db from backup.
    Then:
    SQL> RECOVER DATABASE UNTIL TIME <timestamp> USING BACKUP CONTROLFILE;
    Then you must open teh database with RESETLOGS:
    SQL> ALTER DATABASE OPEN RESETLOGS;
    The next thing you do is check if you met the point in time you wanted and then TAKE A NEW BACKUP OF THE ENTIRE DATABASE, because you do not have ya valid backup any more now. It is a new database you have, at least a new incarnation.
    Let me know if this was helpfull or if I have completely misunderstood your question.
    Good luck,
    Lutz

  • Drop offline Datafile

    Oracle Database version - 10.2.0.3
    I have a tablespace with 2 datafiles. One of the datafile is offline since couple of months. Now I am trying to drop the offline datafile but its not possible to drop that datafile.
    As its production environment I can not take the tablespace in offline mode.
    Can anyone please suggest suitable solution to drop the datafile?
    Regards,
    Sandeep

    SQL> alter tablespace AUDIT_REPORT drop datafile '/data/zus26d-0701/oracle/u04/PZHINF01/cust_idx_04.dbf';
    alter tablespace AUDIT_REPORT drop datafile '/data/zus26d-0701/oracle/u04/PZHINF01/cust_idx_04.dbf'
    ERROR at line 1:
    ORA-03264: cannot drop offline datafile of locally managed tablespace
    SQL>

  • Drop a datafile that is offline and not on the OS

    I am running a 2 node rac on ASM . 10gR2 on HP UX.
    By mistake 1 datafile has been deleted on the OS , and that datafile is marked as offline in the dba_data_files.
    How can I drop the datafile from the database.
    since when I query the dba_data_files the datafile 10 ( which was deleted on OS ) , shows its still present and online_status is offline.
    The datafile is not required and also there is no backup for the datafile.
    Thanks

    Hi,
    ALTER DATABASE DATAFILE '<full file spec>' OFFLINE DROP;
    example: just give '+dg1/../../..' if it not exists also give the same
    Kind Regards,
    Rakesh Jayappa

  • How to copy/paste anchor text box to its anchor point in text and delete all empty anchors?

    hi all
    i have a document of few pages but one story. The right column is the main text box and on many places anchored text boxes are placed which appeared on the left column as shown below.
    i want text of each anchor-text-box to be cut from its place and paste at its insertion/anchor point and delete all empty anchored boxes.
    I am trying since morning but i unable to reach anchor object reference. Any help on how to start with will be helpful.
    virender

    Ok, let's say you have one main text box (not anchored) and three text boxes that are anchored to text within it. The first one is anchored with text, the second one is unanchored, and the third one is empty (I'm not going to get into inline anchoring vs. custom anchoring since you didn't bring it up in your post).
    We cycle through the items on the page:
    function main(){
      var myDoc = app.activeDocument;
      var myPages = myDoc.pages.everyItem().getElements();
      for (var i = 0; i < myPages.length; i++){
        var myPage = myPages[i];
        //Checks that the page is valid, and that it is not a master page. If either is true, skips to the next page.
        if (myPage.isValid == false) continue;
        if (myPage.parent instanceof MasterSpread) continue;
        var myItems = myPage.allPageItems;
        for (var j = 0; j < myItems.length; j++){
          //Current item.
          var myItem = myItems[j];
          //If myItem doesn't have a Character parent, it is not anchored.
          //The first and third text frames would fail this test.
          if (!(myItem.parent instanceof Character)) continue;
          //We only care about text frames.
          if (!(myItem instanceof TextFrame)) continue;
          //I think the only way this would happen would be if you had an image or
          //something else unexpected within the frame. I check for it so no content
          //is inadvertently lost.
          else if (myItem.texts.length > 1) continue;
          //If we're still in this iteration of the loop, all qualifications are met.
          //Flatten the text frame.
          //I don't use layers that often so, to me, flatten makes sense. You may want
          //to use a different term if there's a chance for confusion.
          flattenItem(myItem);
    function flattenItem(funcItem)
         //Hold onto the anchor character.
        var myParent = funcItem.parent;
         //Duplicate the text from within the frame so that it appears right after the anchor.
         //There may be other methods, but this works for me. I try to avoid copy/paste
         //so as not to deal with any clipboard mishaps. I added a check in case of empties.
         if (funcItem.texts.length > 0){funcItem.texts[0].duplicate(LocationOptions.AFTER, myParent.insertionPoints[0]);}
         //Replace the anchor character itself with a space (or whatever) which also
         //deletes the text frame it was anchoring.
        myParent.contents = " ";
    I guess the takeaway might be that you're not looking at the main text frame and then checking to see if anything is anchored to it. You're looking at each text frame and figuring out if it is anchored. That's my approach, anyway.

  • How do i fix my home button it has completely stopped working after i dropped it and now its frozen on the apple screen?

    so yesterday i dropped my iphone and the home key stopped working. i had to turn the phone completely off to change screens and get back to the home page. today i turned it off to get back to the home screen and now it is frozen on the apple screen. its been like this for about an hour or so. i plugged it into the computer and it still hasnt done anything. i try to reset it but of course since the home button isnt working it wont allow me to do so.
    does anyone know what to do besides taking it to apple?

    You can try the steps recommended in the User Guide.  If they don't work bring your phone into Apple for evaluation.
    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • I created an iDVD through iMovie on one computer in my home and want to edit the slideshow and delete some videos on the iDVD.  However, I want to work on my own iMac.  Is there a way to "share" the original project through the drop box on my computer?

    I created an iDVD through iMovie on one computer in my home and want to edit the slideshow and delete some videos on the iDVD.  However, I want to work on my own iMac.  Is there a way to "share" the original project through the drop box on my computer?

    Sir Churchill, I tried deleting one of the playlists from my computer (Playlist 130).  The next day I checked my wife's computer and noticed that Playlist 130 was now missing from her computer as well.  Is there a way that I can delete a playlist from my computer without it disappearing from hers as well?

  • I am having error message of "firefox has stopped working".i unstill and delete folder in my directory adn i again reinstall but its still showing same error

    I having the error message of "Firefox has Stopped working" and having following problems list out in the problem list text area is
    Problem signature:
    Problem Event Name: APPCRASH
    Application Name: firefox.exe
    Application Version: 20.0.1.4847
    Application Timestamp: 51650aee
    Fault Module Name: KERNELBASE.dll
    Fault Module Version: 6.1.7600.16385
    Fault Module Timestamp: 4a5bdaae
    Exception Code: c0000005
    Exception Offset: 00007b69
    OS Version: 6.1.7600.2.0.0.256.1
    Locale ID: 16393
    Additional Information 1: 59d2
    Additional Information 2: 59d28f4851ee3e61e3aa57edc696ac9e
    Additional Information 3: 38b6
    Additional Information 4: 38b6ae8359371108855a2a4e84f0ea47
    Read our privacy statement online:
    http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
    C:\Windows\system32\en-US\erofflps.txt
    i uninstall and delete the mozilla firfox in my directory and reinstall tha lastest version but its still showing the same error message.

    i experienced the same problem. this is what i did:
    *right click firefox
    *click properties
    *click compatibility tab
    * check "Run this program in compatability mode for:"
    * on dropdown choose Windows 7.
    * click ok or apply.
    this solution solved my problem.i hope it will work on yours too.

  • I dropped my iphone yesterday on its backside from my computer desk to floor.the distance is about 50cm. and it has a  phone case. it did't work any  vertical direction lock .then i restarted my phone, it recovered.but i am not sure is it ok ?

    i dropped my iphone yesterday on its backside from my computer desk to floor.the distance is about 50cm. and it has a  phone case. it did't work any  vertical direction lock .then i restarted my phone, it recovered.but i am not sure is it ok ?

    Good job with trying the two-button reset, that would have been my first advice for you.  Next, I suggest you take the reset/update a step further.  This step may risk losing the data on your phone, but since it's not working already, there may be no other solution.
    On your computer, make sure you have internet acces and the latest version of iTunes installed.
    Launch iTunes and connect the iPhone
    Press and hold both sleep/wake and home buttons
    After ten seconds, only release the sleep/wake button.
    If you were successful, the iPhone screen should stay dark and the computer should display a popup. 
    If you see a message saying "iTunes has detected a device in recovery mode," then continue by clicking yes to each subsequent popup. 
    If the iPhone displays the silver Apple logo start over with step three of these instructions.

  • My niece dropped my iphone and now i cant get past my password screen because its unresponsive in a certain area, what do i do?

    My niece dropped my iphone and now i cant get past my password screen because its unresponsive in a certain area, what do i do?

    hand it in for repair?

Maybe you are looking for

  • Itunes location problem

    I have some songs in itunes that require editing to the "where" section.  Because they are downloaded, I cannot simply delete them and re-enter them.  itunes cannot find them as is. 

  • How to run proc in 9ias

    Hi, We had developed a project in Oracle D2k and Pro'c and deployed in 9iAS.There is some problem while invoking pro'c files from the form menu through web browser in the client system. Normally a proc executable runs in the client side whereas if i

  • Something Went Wrong Trying to install...

    I haven't every been able to get AIR to work on my laptop since it was called Apollo, but I got a bunch of cool links to stuff at MAX that I wanted to try out, so I uninstalled the AIR Runtime I had, rebooted, installed AIR 1.5, and now all attempts

  • Hyperion Report Repository

    is it possible or has anyone had any experience in changing the data source of reports in the repository from the repository rather than the Reports Client? For example running an SQL script against the Oracle repository? Thanks,

  • Album Art Error Message

    When trying to Add Album art to my iPod, An Unknown error (-50) shows up and the art does not show up on my iPod... help?