I have been a fan of Morgen's articles. But their latest myth-buster on "oracle installation is tedious and complex" is delightfully funny to watch.
True oracle-ities are real "nosy" creatures, indeed. :)
Saturday, January 5, 2008
..and if you didnt believe DBAs are NOSY
Posted by
Venkat
at
1/05/2008 01:24:00 PM
0
comments
Friday, January 4, 2008
Can you solve this?
I did the worst thing to myself just before the start of holidays..thats by reading some sql question somewhere on the list and jumping in to solve it. (that was complex enough that it was actually reserved to be asked to the Oracle guru Tom Kyte)
Obviously over the holidays I didnt get too much time..but with whatever little I could work, I havent been able to accomplish much.
Just posting the question for those like-minded souls who get a kick out of solving everything in SQL.
SQL> col id format 99
SQL> col customer_id format 99 heading CID
SQL> col service_name format a12 trunc
SQL> col start_date format a12
SQL> col end_date format a12
SQL> desc sql_test
Name Null? Type
----------------------------------------- -------- --------------
ID NOT NULL NUMBER(38)
CUSTOMER_ID NUMBER(10)
SERVICE_NAME VARCHAR2(100)
START_DATE DATE
END_DATE DATE
SQL> select * from sql_test ;
ID CID SERVICE_NAME START_DATE END_DATE
--- --- ------------ ------------ ------------
1 1 Service-S2 01-AUG-07 05-AUG-07
2 1 Service-S1 02-AUG-07 01-NOV-07
3 1 Service-S3 07-AUG-07 30-AUG-07
4 1 Service-S4 07-AUG-07 30-NOV-07
5 1 Service-S5 02-DEC-07 20-DEC-07
assume thats a table with customer info..what we need to output is the period during which customer had continued service..(doesnt matter what the service is..but as long as its continous..we need to consider it one row)
so the output should be something like this
CID START_DATE END_DATE
--- ------------ ------------
1 01-AUG-07 30-NOV-07
1 02-DEC-07 20-DEC-07
PS: extend your solution to work for many other customers too (the sample is only for one customer_id (identified as 1)
Even though I havent solved this yet (well I did, but only to find if I change the data..it fails :) )
(the only good thing so far is..I never worked with MODEL clause before..now I have extensively researched that to solve this..thats a hint hint)
Posted by
Venkat
at
1/04/2008 02:53:00 PM
0
comments
Thursday, December 27, 2007
"I am a Senior DBA..but I am NEW"
I don't know if this is real or meant as joke..but had a good laugh when I read that in Oracle forums.
Here is the thread URL
and here is the scoop
"
Hi everyone,
Can any one advise me? I have joined a company as new senior dba.
i am not understanding what shall be done at beginning?
Can anybody advice me how to check all the database and what to do in the beginning ?
I have been reading all the stuff,documents fr. a week?
"
:) I am looked at my business card and it says I am a "Senior oracle DBA" too. Something I should rethink about :)..
Happy Holidays!!
Posted by
Venkat
at
12/27/2007 02:24:00 PM
191
comments
Wednesday, December 26, 2007
lobs vs strings
Recently one of the emails I read at a client site (wherein the lead had recommended his team to use dbms_lob.substr in the sqls) probed me do this research and as always learning new stuff in oracle is never ending. :)
|
first interesting thing I noticed was I couldnt use rpad function to generate a string more than 4000 chrs..Its strange that oracle silently ignores the request to create longer strings (request was made to make it as long as 100000 chrs long) but it extended only upto 4000.
Well, that takes me to using PLSQL to insert clob data.
now comes the interesting part..lets say we need to fetch only part of the data from clob..what would you use? dbms_lob.substr function or regular substr function?
|
what does that tell? dbms_lob.substr cannot return more than 4K characters ..whereas substr can..
It all comes back to datatypes and why understanding them is necessary..I checked the manual and its clearly stated substr can take a clob as its input and return "clob" ..whereas dbms_lob if it accepts clob, returns varchar2 (hence limited to 4000 characters).
Posted by
Venkat
at
12/26/2007 10:53:00 AM
17
comments
Wednesday, November 28, 2007
Interesting SQL problem
Came across this interesting sql question on oracle-l list while I was searching for something else.
The poster's original question is as below..
create table t(id number);
insert into t values(1);
insert into t values(2);
commit;
I want to query this with an Id set. All values in the set should be
there to return me any row.
e.g.
select * from t where id in (1,2); return 1 and 2
If am serching for 1,2,3 if any one value is missing I should not get any data.
e.g.
select * from t where id in (1,2,3) should not return any row.
How to rewrite the above query with (1,2,3) that should not return me any row.
Here is my solution for that...
ccD>l
1 With inputstr as
2 ( select '&inp' elements from dual),
3 setdata
4 as
5 (
6 select
7 trim( substr (txt,
8 instr (txt, ',', 1, level ) + 1,
9 instr (txt, ',', 1, level+1)
10 - instr (txt, ',', 1, level) -1 ) )
11 as token
12 from (select ','||elements||',' txt
13 from inputstr ) t,inputstr i
14 connect by level <=
15 length(i.elements)-length(replace(i.elements,',',''))+1
16 )
17 select token from
18 (
19 select
20 to_number(token) token,
21 nvl2(t.id,1,0) present,
22 min(nvl2(t.id,1,0)) over() min_over_report
23 from setdata s, t
24 where s.token=t.id(+)
25 )
26* where min_over_report=1
Testing
--------ccD>select * from t; -- this is what the table containsID
----------
1
2
ccD> get the above sql into bufferccD>/
Enter value for inp: 1,2 -- input is 1,2 and it retrives two rowsTOKEN
----------
1
2ccD>/
Enter value for inp: 1,2,3 -- 1,2,3 retrives no rows because 3 is not presentno rows selectedccD>/
Enter value for inp: 1,2,3,4 -- same with 1,2,3,4no rows selectedccD>/
Enter value for inp: 1 -- input 1 retrives one rowTOKEN
----------
1
Posted by
Venkat
at
11/28/2007 05:15:00 AM
1 comments
Monday, November 26, 2007
Software what?
Just saw this picture online and was thinking to myself..
well this day is not very far away and approaching us very soon. we are going to see "wanted software pros" like our current "open house" signs.
but I am curious how to interpret...
too much demand for software professionals?
or
would that be too much supply in market , that employing headhunters to recruit would be considered "not-worth-the-cost".
Take a look at this picture..
Posted by
Venkat
at
11/26/2007 12:22:00 PM
0
comments
Saturday, November 3, 2007
ASM instance & remote client
well we know ASM instance is always in mount state and so you really dont have much access to data dictionary..and listener displays BLOCKED as status leaving you no choice but to login into the OS server and connect to asm instance locally..
But I just learned something new..that by adding "UR=A" to tnsnames, you can actually connect to asm instance (blocked service) via oracle net connection. (remote connection)
thats really cool thing for me..as I dont have to login to a server box just to check asm instance..I can simply have one more sql window open to asm instance from my client..
Add "(UR=A)" to the connect_data section of your tnsnames entry and you should be all set.
(Note: ASM instance lets admin authentication only via password file or OS authentication..so obviously, you have to have password file created before trying to connect to ASM from remote client)
Posted by
Venkat
at
11/03/2007 02:02:00 PM
170
comments