Friday, January 20, 2006

WindowsXP with SP2 and Oracle Database

I have WindowsXP with SP2 and Oracle Database.

I am using that computer with Firewall on since couple of months and i am accessing database for my own purpose on clients are connecting to my computer.

Suddenly i need to allow one client to connect to my oracle database but trying to access the database after creating concern entry in tnsnames.ora still client not able to connect to database.

Then i realize after some efforts firewall is creating problem so i had switched off then try finally i get success but i want firewall should be on and also i want to allowed user to connect to my database for that i need to do below.

For normal oracle developer and client you need to do the following executables need to be added to the Windows Firewall exception list:

oracle.exe
tnslsnr.exe

how to restict allowed some user connect to oracle

Open your sqlnet.ora file and add below two entry.
after this only invited ip listed can connect to oracle.

TCP.VALIDNODE_CHECKING = YES
TCP.INVITED_NODES= (192.168.16.22, 192.168.16.120)

Wednesday, January 11, 2006

random number solution from tomkyte

more on unique no. January 07, 2006
Reviewer: Nikunj from india

Followup:

that is technically impossible, since Oracle numbers are 38 digits long - that
is not an infinite set of numbers.

what are you really trying to do here?

I am trying to do as below.
My user want to enter starting no., ending no. and list of random no. wants
between starting no. and ending no.

i.e. starting no. 200 and ending no. 400 he wants 50 random no. from list.

so i had created loop which will select random no. between the range and base on
user input on how much random no. he wants.

I had try but i am getting non unique nos.


Followup:

so, really what you want to do is

a) generate the set of all integers between "lo" and "hi"
b) get a random selection from that

no problem when stated like that - when stated the way you did the first time -
big problem!

Huge difference between stating what the goal is (then people can give
solutions) versus offering a partial solution and saying "finish it" :)



ops$tkyte@ORA10GR2> variable lo number
ops$tkyte@ORA10GR2> variable hi number
ops$tkyte@ORA10GR2> variable num_to_get number
ops$tkyte@ORA10GR2>
ops$tkyte@ORA10GR2> exec :lo := 200

PL/SQL procedure successfully completed.

ops$tkyte@ORA10GR2> exec :hi := 400

PL/SQL procedure successfully completed.

ops$tkyte@ORA10GR2> exec :num_to_get := 5;

PL/SQL procedure successfully completed.

ops$tkyte@ORA10GR2>
ops$tkyte@ORA10GR2> with data
2 as
3 (select level+:lo-1 l
4 from dual
5 connect by level <= (:hi-:lo+1)
6 )
7 select *
8 from (select * from data order by dbms_random.random)
9 where rownum <= :num_to_get;

L
----------
221
297
367
305
333

ops$tkyte@ORA10GR2> /

L
----------
287
344
332
315
277

ops$tkyte@ORA10GR2> /

L
----------
213
278
209
357
341

ops$tkyte@ORA10GR2> /

L
----------
347
397
249
295
354


That is but one approach.

Wednesday, January 04, 2006

order by conditional

order by decode( deptno, 10, ename ) desc,
decode( deptno, 20, job ) asc,
decode( deptno, 30, hiredate ) desc;