Monday, February 20, 2006

killing a session immediately

To kill a session in oracle, i generally use,

alter system kill session 'sid,serial#';

(where i get sid, serial# by querying v$session. I also get the unix process id from here).

But this many not kill the processes at the unix level. So, i generally kill the process at the unix level too.

I've found on one of the blogs that you can do this at sql itself (without kill -9 ing) by using

alter system disconnect session 'sid,serial#' immediate;

Thursday, February 09, 2006

Size of the table in bytes

To find the size of bytes allocated to a table:

sql > analyze table emp compute statistics;

sql > select num_rows * avg_row_len "Bytes Used" from dba_tables where table_name = 'TEST';

Bytes Used
-----------
560

sql > select bytes "Bytes Allocated" from dba_segments where segment_name = 'TEST';


Bytes Allocated
----------
524288

The result of the query shows that the emp table is using 560 bytes of the 524,288 bytes allocated to it.

**** you can use user_segments too...if u don't have the dba privileges ******

10g installation on windows

I was trying to install oracle 10g on my personal laptop. Tried a couple of times without goin' through much of a documentation and failed. The network configuration assistant fails each time. Its a pretty straight forward installation except that it needs a fixed IP address (you can't have one in a DHCP enabled environment). But you can fake it using the Microsoft loopback adapter. You can see the following link to see how u can install microsoft loopback adapter.

http://support.microsoft.com/default.aspx?scid=kb;en-us;839013

Once i've installed this, i've included the following line in my hosts file (which is located in C:\WINDOWS\system32\drivers\etc). Now my hosts file looks like this (where vish is my computer name, 10.101.10.10 is the fixed IP address i've mentioned in the microsoft loopback adapter).

-----------------------------
10.10.10.10 vish (this is the new line u need to include)
127.0.0.1 localhost (this line is already present..just leave it there)
-----------------------------

Once i've done this, my network configuration assistant was successful.

Here is the link which shows a pretty staright forward way of installing oracle. Similar to 9i.

http://www.compiere.org/support/install/installOracleSteps.html

Now that i've installed 10g successuflly, i need to start learning the new features of oracle. In my next post i'll post the installation of oracle internet directory whcih i've implemented for my home network, so that we can connect to a centralized db instead of having the oracle server on each and ev. laptop.

Oracle Project Raptor

Finally, the much awaited TOAD like software is released by oracle. Thanks to oracle for recognizing that they need to have a software like TOAD delivered free of cost.

They have not yet implemented all the functionalities of TOAD, but its pretty OK. (Its free ofcourse). A delight for oracle pl/sql developers who don't have access to TOAD.

Its more intended towards developers than DBA's.

You can download Oracle project raptor here.

http://www.oracle.com/technology/software/products/sql/index.html

I've started to use it and almost got familiar with it.