Finding watermark: problem in linking dba_free_space and dba_data_files

Hi all,
I'm trying to write a very simple (maybe too much simple...) query to find out how much space I can save doing a resize of my datafiles.
For this purpose, for every datafile, I look for the last free segment in the dba_free_space: if I find a row in dba_free_space such that the value (block_id+blocks-1) matches the one in dba_data_files.blocks, I can find the watermark.
The problem is that I have an (almost) empty tablespace with the last blocks unused: if I look in the dba_segments or in the dba_extents I can see that the last 5 or 4 blocks are not used, and they are not included in the dba_free_space.
So, here is my query:
select t.tablespace_name,
d.bytes / 1024 / 1024 as file_size_mb,
(f.block_id - 1) / d.blocks * d.bytes / 1024 / 1024 as space_before_watermark_mb,
f.bytes / 1024 / 1024 as space_after_watermark_mb,
d.file_name
from dba_tablespaces t, dba_data_files d, dba_free_space f
where t.tablespace_name = d.tablespace_name
and d.file_id = f.file_id
and d.blocks = (f.block_id + f.blocks - 1)
order by tablespace_name;
There are two problems right now:
- I have to use a different query to find out if there are datafiles whose last blocks are used
- I'm not able to find out informations about datafile whose last blocks are not used and are not in the dba_free_space.
How can I solve that?
thansk in advance for every comment

hi,
try the following to look for the HWM.
set serveroutput on
execute dbms_output.enable(2000000);
declare
cursor c_dbfile is
select tablespace_name
,file_name
,file_id
,bytes
from sys.dba_data_files
where status !='INVALID'
order by tablespace_name,file_id;
cursor c_space(v_file_id in number) is
select block_id,blocks
from sys.dba_free_space
where file_id=v_file_id
order by block_id desc;
blocksize binary_integer;
filesize binary_integer;
extsize binary_integer;
begin
/* get the blocksize of the database, needed to calculate the startaddress */
select value
into blocksize
from v$parameter
where name = 'db_block_size';
/* retrieve all datafiles */
for c_rec1 in c_dbfile
loop
filesize := c_rec1.bytes;
<<outer>>
for c_rec2 in c_space(c_rec1.file_id)
loop
extsize := ((c_rec2.block_id - 1)*blocksize + c_rec2.blocks*blocksize);
if extsize = filesize
then
filesize := (c_rec2.block_id - 1)*blocksize;
else
/* in order to shrink the free space must be uptil end of file */
exit outer;
end if;
end loop outer;
if filesize = c_rec1.bytes
then
dbms_output.put_line('Tablespace: '
||' '||c_rec1.tablespace_name||' Datafile: '||c_rec1.file_name);
dbms_output.put_line('Can not be resized, no free space at end of file.')
dbms_output.put_line('.');
else
if filesize < 2*blocksize
then
dbms_output.put_line('Tablespace: '
||' '||c_rec1.tablespace_name||' Datafile: '||c_rec1.file_name);
dbms_output.put_line('Has a highwater mark of: '||2*blocksize
||' Bytes, actual size: '||c_rec1.bytes||' Bytes');
dbms_output.put_line('.');
else
dbms_output.put_line('Tablespace: '
||' '||c_rec1.tablespace_name||' Datafile: '||c_rec1.file_name);
dbms_output.put_line('Has a highwater mark of: '||filesize
||' Bytes, actual size: '||c_rec1.bytes);
dbms_output.put_line('.');
end if;
end if;
end loop;
end;
regards
Alan

Similar Messages

  • Find filter problem with Adobe CS6 and Mavericks

    Hi to all!
    I've 2 new MacPro with OSX 10.9 (is no possible to downgrade) with Adobe Illustrator CS6 and all software are full updated at the last version.
    Firs of all I've found a problem after a last firmware update of my 2 MacPro, in samba connection, solved by AFP implement; in detail:
    I've a Qnap storage with samba and afp shares, so when I connect the samba share the search function in finder not find any, but if I connect the same share via AFP protocol, all works good.
    Ok, it's a problem but no so bad for me because I've the possibility to use AFP ;-)
    Ok, now the big problem:
    when I use the CS5 Illustrator and I execute the "insert" command, the search window show blank screen in the search area if I select a qnap sared folder (AFP or SAMBA shared get the same result, 0 element found)
    After many and many tests I've solved with a workaround: I've forced the Finder to index the shared folder (from the command line in the console) and in this case I've no more problem...
    The problem affect only the afp and samba share, with the local folder (volumes) I don't have any problem.
    So, I can't downgrade Maveriks, and I'm sure the problem is not of CS6... then my only solution is to wait a future update of Mavericks?! or anyone can suggest me a solution?
    Thank you for any reply.
    Paolo

    Go here to check out compatibility:
    http://roaringapps.com/apps?index=a
    As for Photoshop CS6 itself, I have no issues running
    it on Mavericks on my 2011 Mini Server.
    Also, before upgrading, make sure any drivers for third
    party hardware are up to date and compatible with Mavericks.

  • What version of fiefox do i use for mac 10.1.5?AND WHERE CAN I FIND THE PROPER DOWNLOAD LINK PLEASE AND THANK YOU..DAVE

    I REALLY NEED A DESCENT BROWSER FOR MY OLDER IMAC WITH LIMITED HARDRIVE SPACE. CAN ANYBODY HELP ME AS MY NETSCAPE BROWSER(1.7.13) IS STARTING TO MESS UP A BIT. THANX!!

    Firefox 1.0.8 was the last version of Firefox for Mac OSX 10.1 versions. It is not supported by Mozilla since April 2006.
    ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/1.0.8/mac/en-US/
    You should also look at Classilla. <br />
    http://www.floodgap.com/software/classilla/ <br />
    Looks like is still being maintained. <br />
    http://code.google.com/p/classilla/wiki/Roadmap

  • Problems with dropped calls and no reception on Samsung Continuum

    My mother and I both purchased a Samsung Continuum in late March 2011, and have experienced the same problems with the phone.  The device drops at least 2-3 calls per day, often on the same conversation; we have not found that location or time of day makes a difference.  The phone freezes up frequently, even if no apps are running in the background.  We lose our 3G network reception frequently, and cannot access our texts, emails, or the internet.  The screen saver kicks in even when we are actively dialing a number, or typing in a text message.  The overall performance of the phone is also poor, and it is quite slow much of the time.
    We have raised this issue several times with a representative at one of the Verizon stores, but he states that he can find no problem with the phone, and that these issues may not be covered under our insurance plan.  None of my friends with non-Samsung phones are having the same problems with phone reception and performance.  I am aggravated enough with these issues that I am considering reactivating my old Blackberry, which worked like a charm.
    I am not upset that my phone has not been updated to Android 2.2.  I just want the phone to perform as stated, and not fail at its primary function:  making and receiving phone calls.  I am not certain if these problems originate with the phone, Verizon, or Samsung, nor do I care.  I just want to resolve these issues as soon as possible, or I will have to look at other alternatives.
    Thank you.

    If this doesn't work...now what??? I have a useless $400 plus piece of unreliable junk. My Motorola Razor was ions more reliable than this phone...very, very sad but true.
    What carrier were you using with the Razor? AT&T? Same area?
    Dave M.
    MacOSG Founder/Ambassador  An Apple User Group  iTunes: MacOSG Podcast
    Creator of 'Mac611 - Mobile Mac Support' (designed exclusively for an iPhone/iPod touch)

  • Can't Find ODBC drivers to link MS Access 2013 and MySQL

    Can't Find ODBC drivers to link MS Access 2013 and MySQL.
    Is one available?
    Thanks,
    Larry

    Could to associate the problem at Office 2013?
    I just installed the ODBC Driver; The data source machine was available; When selected I had received the message. When it was selected I had received the message:
    "ODBC -- falha na chamada.
    [Microsoft][ODBC Driver Manager] O DSN especificado contém uma incompatibilidade de arquiteturas entre o Driver e o Aplicativo (#0)"
    In english, could to say: "ODBC -- fail on call.
    ... The specified DSN contains a architectural incompatibility between Driver and App (#0)"
    I don't know yet the reason for this. Anyone knows?

  • Hello! i've a problem with my Imac. it shows me white screen with a folder with quastion. it could be a problem with hard drive. i should insert mac os cd, but i couldnt find it. in Russia, in Finland and in Sweden the same problem)

    hello! i've a problem with my Imac. it shows me white screen with a folder with quastion. it could be a problem with hard drive. i should insert mac os cd, but i couldnt find it. in Russia, in Finland and in Sweden the same problem)

    Have a look at some of the suggestions in this link:
    http://support.apple.com/kb/TS2570?viewlocale=en_US&locale=en_US (Russian is available from the link within the article (top right of the page).

  • TS3899 why, when the problems are linked to an ipad, do I need to download a document and fill it in? My ipad doesn't do that! What if my ipad is my computer?

    why, when the problems are linked to an ipad, do I need to download a document and fill it in? My ipad doesn't do that! What if my ipad is my computer?
    My mailing system won't work, and I see many here have had the same problem. so I tried the suggestions I could find. Last thing I tried was deleting my mailing account, so that I could restore it again. Internet is working, everything else is working, plenty of space BUT now my email won't even be restored. Not any of my other mailing accounts either for that matter.
    Background information:
    I use yahoo (the one I prefer by far), sometimes gmail, hotmail if I absolutely have to
    My ipad is ipad 2, 1 year old
    problem with the mailing system started less than a month ago
    iåproblem was that it wouldnt refresh and find new mails, also took a long time sending mails

    Create a iTune and App Store account without credit card
    1. Go to App Store and select a free app
    2. Tap INSTALL APP
    3. Create New Apple ID
    4. Confirm Your Country
    5. Agree with Terms and Conditions
    6. Fill in your Apple ID and Password (must be a valid email address)
    7. Create and answer your secret question e.g. What is the name of my dog?
    8. Select NONE for Payment Method
    9. Fill in Billing Address i.e. your address
    10. Submit application for new Apple ID
    11. Wait for verification email
    12. When email arrive, verify your account
    13. Start downloading your free apps

  • I find it ABSOLUTELY unacceptable that since recently safari opens up random "commercial websites" without me clicking on any link. And it does that without allowing me to go (back) to the site I really clicked on. STOP THAT!!!!!!

    I find it ABSOLUTELY unacceptable that since recently safari opens up random "commercial websites" without me clicking on any link. And it does that without allowing me to go (back) to the site I really clicked on. STOP THAT!!!!!!

    There is no need to download anything to solve this problem. You may have installed a variant of the "VSearch" ad-injection malware. Follow Apple Support's instructions to remove it.
    If you have trouble following those instructions, see below.
    Malware is always changing to get around the defenses against it. This procedure works as of now, as far as I know. It may not work in the future. Anyone finding this comment a few days or more after it was posted should look for a more recent discussion, or start a new one.
    The VSearch malware tries to hide itself by varying the names of the files it installs. To remove it, you must first identify the naming pattern.
    Triple-click the line below on this page to select it, then copy the text to the Clipboard by pressing the key combination  command-C:
    /Library/LaunchDaemons
    In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.
    A folder named "LaunchDaemons" may open. Look inside it for two files with names of the form
              com.something.daemon.plist
    and
               com.something.helper.plist
    Here something is a variable string of characters, which can be different in each case. So far it has always been a string of letters without punctuation, such as "cloud," "dot," "highway," "submarine," or "trusteddownloads." Sometimes it's a meaningless string such as "e8dec5ae7fc75c28" rather than a word. Sometimes the string is "apple," and then you must be especially careful not to delete the wrong files, because many built-in OS X files have similar names.
    If you find these files, leave the LaunchDaemons folder open, and open the following folder in the same way:
    /Library/LaunchAgents
    In this folder, there may be a file named
              com.something.agent.plist
    where the string something is the same as before.
    If you feel confident that you've identified the above files, back up all data, then drag just those three files—nothing else—to the Trash. You may be prompted for your administrator login password. Close the Finder windows and restart the computer.
    Don't delete the "LaunchAgents" or "LaunchDaemons" folder or anything else inside either one.
    The malware is now permanently inactivated, as long as you never reinstall it. You can stop here if you like, or you can remove two remaining components for the sake of completeness.
    Open this folder:
    /Library/Application Support
    If it has a subfolder named just
               something
    where something is the same string you saw before, drag that subfolder to the Trash and close the window.
    Don't delete the "Application Support" folder or anything else inside it.
    Finally, in this folder:
    /System/Library/Frameworks
    there may an item named exactly
                v.framework
    It's actually a folder, though it has a different icon than usual. This item always has the above name; it doesn't vary. Drag it to the Trash and close the window.
    Don't delete the "Frameworks" folder or anything else inside it.
    If you didn't find the files or you're not sure about the identification, post what you found.
    If in doubt, or if you have no backups, change nothing at all.
    The trouble may have started when you downloaded and ran an application called "MPlayerX." That's the name of a legitimate free movie player, but the name is also used fraudulently to distribute VSearch. If there is an item with that name in the Applications folder, delete it, and if you wish, replace it with the genuine article from mplayerx.org.
    This trojan is often found on illegal websites that traffic in pirated content such as movies. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow. Never install any software that you downloaded from a bittorrent, or that was downloaded by someone else from an unknown source.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Then, still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates (OS X 10.10 or later)
    or
              Download updates automatically (OS X 10.9 or earlier)
    if it's not already checked.

  • HT204088 I am receiving unauthorised billings for purchase from application Kingdom Age from seller Funzio, Inc .  I can't find a place/link to cancel the billing neither report this problem. The link REPORT A PROBLEM only links you to Apple Store without

    I am receiving unauthorised billings for purchase from application Kingdom Age from seller Funzio, Inc .  I can't find a place/link to cancel the billing neither report this problem. The link REPORT A PROBLEM only links you to Apple Store without a hint/directions whre you can report the problem.
    I've been surfing all parts of the website and didn.t find a manner to REPORT A PROBLEM with purchases on my behalf not authorized.

    Hi..
    Just to be on the safe side if you have not already changed your Apple ID password, probably should do that.
    How to change your Apple ID password
    And you can use the email form for contacting Apple here > Apple - Support - iTunes Store - Contact Us

  • Problems with links and pages

    I'd like to start by saying that it's not the first time I used iWeb. My family website has been online for more than a year, constantly being updated and I never had this sort of trouble.
    However just yesterday I finished setting up my company site on my office Intel iMac Core Duo 17" and I came across some problems, mainly when saving the site to a folder and viewing it. These are ;
    1. Some links work some don't.
    2. Some pages are published while some are not.
    Anyone come across these errors.
    Obviously I can't upload the site to the webserver until I've ironed out these creases, so any help is GREATLY appreciated.
    Thanks.
    P.S. I've also tried moving the iWeb Domain file to my home iMac G5 and re-publishing it to a folder with the same results.

    I am having the same problem... although I am only trying to link between "One of My Pages" i.e navigation menus.
    It is pretty random which links work and which don't as far as I can tell anyway.
    The links work fine when I activate hyperlinks in iWeb but as soon as I publish to a folder some of them don't.
    I will post if I find a solution, but I have read and tried just about everything.
    Best
    PowerBook G4   Mac OS X (10.4.9)   1.25 GB RAM

  • Problems with links and the "advanced" field

    Has anyone else had problems with the advanced field when
    making a new link? It seems I have to edit it three or four times
    before it will actually take the link I put in ("
    http://www.blah.com/" instead of
    "../../"). Anyone else?

    I am having the same problem... although I am only trying to link between "One of My Pages" i.e navigation menus.
    It is pretty random which links work and which don't as far as I can tell anyway.
    The links work fine when I activate hyperlinks in iWeb but as soon as I publish to a folder some of them don't.
    I will post if I find a solution, but I have read and tried just about everything.
    Best
    PowerBook G4   Mac OS X (10.4.9)   1.25 GB RAM

  • CS6 problem. When I open the Mask panel, it takes up the entire screen width and the Looks controls disappear, Also, there is a new panel below the Mask panel that seems to have no purpose that I can find. The documentation says "Mask and Look panels - Th

    CS6 problem. When I open the Mask panel, it takes up the entire screen width and the Looks controls disappear, Also, there is a new panel below the Mask panel that seems to have no purpose that I can find. The documentation says "Mask and Look panels - The Mask panel is now placed next to the Look panel. WIth the masking and grading tools placed side-by-side, you can now work faster on the mask workflow." Is there a way to move, hide, or otherwise manipulate the panels for a custom layout? All the examples I can find on the Web show the Looks panel to the left of the Mask panel where the controls are available.

    Ok, here is what I have so far. Appdelete the iWork and reinstalled. Pages and Number work, but not Keynote.
    Now, I downloaded a couple apps that I need, and no matter what I did, the spinning ball came up and the download stopped till it unlocked itself. It is really frustrating because the download was not completed and whatever came through would not mount. Could this issue be the internet connection? Permission fix showed a lot of Airport issues. I will try to run permissions fix again.

  • The Control A key is not working. I cannot multi-select my songs. I'm not sure if it is the problem with iTunes 10.6.1.7 or my PC settings encounter issues. Also, i cannot find Album Artwork online using iTunes and i cannot select any view form but List.

    The Control A key is not working. I cannot multi-select my songs. I'm not sure if it is the problem with iTunes 10.6.1.7 or my PC settings encounter issues. Also, i cannot find Album Artwork online using iTunes and i cannot select any view form but List.

    The Control A key is not working. I cannot multi-select my songs. I'm not sure if it is the problem with iTunes 10.6.1.7 or my PC settings encounter issues. Also, i cannot find Album Artwork online using iTunes and i cannot select any view form but List.

  • How you can solve a problem or find out on a dead pc if the problem relies on motherboard and not on processor or vice versa

    hi.
    I am working myself with computers ,  so there is one thing in my mind I wanted to be sure,which I couldn't find an answer for it!
    because I had before totally black screen and the problem was damaged processor.
    I am wondering how I can be sure as the last option when I get a black screen and there is no lihgts at all no any LED is lighting.totally dead pc.
    how  you can be sure then that the problem relies on processor and not on motherboard or vice versa the problem relies on motherboard and not on processor
      because I can't say to the customer lets buy first a processor if it is the cause of dead PC and if not then we buy motherboard. this sounds not wise.
    so I experimented first with my latop ,I pulled out the processor to see if I can see any LED light or any movement on the motherboard to be sure that motherboard giving me some clue that it is healty. I gave some light heat to de fan to let it turn ,because 
    it is working with heat sensors then I know that the motherboard is healty. but it didn't work. 
    I did the same with my desktop computer and the result is the same no any lights and no any movement on the motherboard . so now can some one tell me how you can distuingish as a last result which of this 2 components is causing dead PC. is there any
    tool to test the motherboard or how asus,dell ect. they solve such a problem if the customer send to them a dead pc.
    I know that the power supply also can cause dead pc but I know how to solve a problem  with dead power supply. and I want to keep away power supply from this question. please do not tell me that  Idon't have to pull out processor
    because I am a technician and both of my computers are doing very good after this experiment.
    thanks
    johan
    h.david

    Usually if you have some kind of hardware failure there is some beeping during POST or most motherboards now have LED indicators to produce and error message based on the type of failure
    So if its bad memory, not place properly, mismatched, processor not inserted properly, mismatched voltage or voltage connector not present etc it beeps or generates the error id.
    Power supplies can be tested for failure. There are some walk throughs for testing just them with a switch, paperclip or a jumper (I'd suggest not doing this if you are not familiar with the dangers of electricity).
    Memory can be tested with memory diagnostics programs like Memtest+
    Processors can overheat if the proper precautions have not been taken usually you will get a POST beep or error code for that.
    If the motherboard has no response then do the basics first:
    Check power connectors and power supply. Once you determine that is not the case move on to other items like graphics cards in all the way or memory.

  • Problems w/ver 27 and xp sp3; should I give up on xp and go to Win 7 PRO 64bit where I find no problems?

    OS = Win XP SP3
    Cannot change/edit location of downloads; the only download available is DOWNLOADS
    This ver of MF takes about 15 seconds to load NASCAR website
    After I select any website to load a small, rotating circle appears in the upper-left of the screen and remains until, finally, the page has completely loaded.
    I do not have this problem w/win 7 pro 64 bit
    Installing MF 4 solves this problem on the Win XP SP3 OS.
    I do not find this problem on older laptops running the same XP OS.

    Have you done any routine maintenance on that computer recently?
    What happens if you use a different browser on that computer?
    Are you running the most up-to-date version of Firefox on that computer?
    What do you mean by MF4?

Maybe you are looking for

  • TS Failing only on one Surface Pro booting to USB - 0x80004005

    This is only happening with one of many Surface Pro's I am unsure what would cause this, booting from USB in a hub with USB Network Adapter. <![LOG[LOGGING: Finalize process ID set to 812]LOG]!><time="19:45:17.874+480" date="01-17-2014" component="TS

  • Failed to Deploy Workflow on Clustered SOA

    Hi, We have developed a custom workflow which is working fine in the test environment which is a non clustered environment. However, now when we are deploying the same workflow on live SOA environment which is clustered, we are getting the error belo

  • Time Dimension Type allows different values in attributes - Bug or Feature?

    Not sure if this is a bug or a feature. But if one has multiple hierarchies on a Time dimension. You have the ability to specify different values for member attributes in different hierarchies. Example. Hierarchy A has MIN_ID for it's Member and uses

  • I want to erase saved user names in sign-in boxes and nothing I do erases them

    My kids have put different user names in my e-mail welcome page and other welcome pages. The list is long. I'd like to delete all the saved names and start over just having the computer save the names we actually use. I have gotten into tools and tri

  • How to the *material costing* after below steps

    Hi sapgurus please help us, How to the material costing after below steps 1.     Actual costing /material ledger 2.     Material update 3.     Actual costing 4.     Production start up 5.     Customizing setting in OBYC please sent to any documents.