Friday, October 9, 2009

oracle: grant all permission to one user

the command is
grant all privileges to TESTUSER;

see below:

SQL> create user TESTUSER identified by TESTUSER
2 ;

User created.

SQL> grant all privileges to TESTUSER;

Grant succeeded.


SQL> select count(*),grantee from dba_sys_privs where grantee = 'TESTUSER' group by grantee;

COUNT(*) GRANTEE
---------- ------------------------------
139 TESTUSER

oracle rownum

ROWNUM is a pseudocolumn, it's not a real column;
it's assigned in the query result, starting from 1;
so,
select * from table where rownum > 1
will always return empty result;

and to get top N result in ordered result (like the LIMIT in mysql), you will need to use sub-query like:
select * from (select * from table order by col ) where rownum < 10

if you just use
select * from table order by col where rownum < 10
you will get 10 result, but not the top 10 ones in the ordered list as you expect

Thursday, October 8, 2009

commands to kill oracle session

alter system kill session 'session-id,session-serial';

session-id,session-serial can be selected from the table v$session

1st blog of a chinese farmer

1st blog of a chinese farmer:)