Home » Open Source » Programming Interfaces » show TableSpaces in PHP
show TableSpaces in PHP [message #393814] Tue, 24 March 2009 08:22 Go to next message
guif
Messages: 17
Registered: November 2008
Junior Member
hi!
i would like to monitoring the size of tablaspaces in my oracle.
I have the query to show this values but i don't know to show in my web.
The query is:

$query =   "select    fs.tablespace_name, (df.totalspace - fs.freespace),fs.freespace, df.totalspace,
         round(100 * (fs.freespace / df.totalspace))
        from (select tablespace_name, round(sum(bytes) / 1048576) TotalSpace
           from dba_data_files
        group by tablespace_name) df, (select    tablespace_name, round(sum(bytes) / 1048576) FreeSpace 
from dba_free_space
        group by tablespace_name) fs where df.tablespace_name = fs.tablespace_name";


I see the function "oci_connect" in php to establishes a connection to the Oracle server but my level of php is very low.

Any body help me??? I would like to show in a different rows and columns my values for example:

name_tamblespace | total_size | Used_% | free_size | free_size_%

I know to create a oracle connection but i don't know to make a Echo out the output...
very thanks!

[Updated on: Tue, 24 March 2009 09:19] by Moderator

Report message to a moderator

Re: show TableSpaces in PHP [message #393828 is a reply to message #393814] Tue, 24 March 2009 09:21 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
http://www.google.com/search?hl=en&q=php+oracle+oci&aq=0&oq=php+oracle+oci

Regards
Michel
Re: show TableSpaces in PHP [message #394119 is a reply to message #393814] Wed, 25 March 2009 14:27 Go to previous messageGo to next message
guif
Messages: 17
Registered: November 2008
Junior Member
oh thanks for the link...

i have a bucle to know all my information.

  $s = OCIParse($c, $query); 
  OCIExecute($s, OCI_DEFAULT);
    while (OCIFetch($s)) {
	echo ociresult($s, 1) . " ";
	echo ociresult($s, 2) . " ";
	echo ociresult($s, 3) . " ";
	echo ociresult($s, 4) . " ";
	echo ociresult($s, 5) . " ";
	echo ociresult($s, 6) . " ";
	[B]$size =  ociresult($s, 6);[/B]
	echo ociresult($s, 7);
	echo "<br>";
    } 
OCILogoff($c);


in this line: $size = ociresult($s, 6); I give the free % of my tablespace.
How can i give in different echo the values???
Re: show TableSpaces in PHP [message #394126 is a reply to message #394119] Wed, 25 March 2009 15:05 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Sorry but this is not a PHP forum, this is an Oracle forum.
Maybe you should post your question in a PHP forum.

Try "echo $size;"

Regards
Michel
Re: show TableSpaces in PHP [message #394240 is a reply to message #393814] Thu, 26 March 2009 04:58 Go to previous messageGo to next message
guif
Messages: 17
Registered: November 2008
Junior Member
"echo $size;" is for one value but, if i have 90 tablespaces, i have 90 values...
Re: show TableSpaces in PHP [message #395029 is a reply to message #394240] Tue, 31 March 2009 02:24 Go to previous message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
As you loop for each row, that is each tablespace, you have one value per tablespace, if you put echo inside the loop of course.

Regards
Michel
Previous Topic: Driver throws NullPointerEx while inserting an obj and RETURNING a REF
Next Topic: Please Help.....PHP Apache Crashes....
Goto Forum:
  


Current Time: Mon Dec 05 21:31:02 CST 2016

Total time taken to generate the page: 0.08940 seconds