Archives For January 2015

today ( by accident ) I discovered a nice tool that shows socket information on linux:

ss -s
Total: 666 (kernel 0)
TCP:   21 (estab 7, closed 1, orphaned 0, synrecv 0, timewait 1/0), ports 0

Transport Total     IP        IPv6
*	  0         -         -        
RAW	  0         0         0        
UDP	  24        17        7        
TCP	  20        16        4        
INET	  44        33        11       
FRAG	  0         0         0   

there are much more options:

Usage: ss [ OPTIONS ]
       ss [ OPTIONS ] [ FILTER ]
   -h, --help		this message
   -V, --version	output version information
   -n, --numeric	don't resolve service names
   -r, --resolve       resolve host names
   -a, --all		display all sockets
   -l, --listening	display listening sockets
   -o, --options       show timer information
   -e, --extended      show detailed socket information
   -m, --memory        show socket memory usage
   -p, --processes	show process using socket
   -i, --info		show internal TCP information
   -s, --summary	show socket usage summary
   -b, --bpf           show bpf filter socket information

   -4, --ipv4          display only IP version 4 sockets
   -6, --ipv6          display only IP version 6 sockets
   -0, --packet	display PACKET sockets
   -t, --tcp		display only TCP sockets
   -u, --udp		display only UDP sockets
   -d, --dccp		display only DCCP sockets
   -w, --raw		display only RAW sockets
   -x, --unix		display only Unix domain sockets
   -f, --family=FAMILY display sockets of type FAMILY

   -A, --query=QUERY, --socket=QUERY
       QUERY := {all|inet|tcp|udp|raw|unix|packet|netlink}[,QUERY]

   -D, --diag=FILE     Dump raw information about TCP sockets to FILE
   -F, --filter=FILE   read filter information from FILE
       FILTER := [ state TCP-STATE ] [ EXPRESSION ]

have fun with sockets …

Advertisements

as described previously all roles and users are stored in the user$ table.

and yes, you can tell:

select user#,name from user$ where type# = 0 and name='_NEXT_USER';

     USER# NAME
---------- ------------------------------
	77 _NEXT_USER

create a new user:

SYS@xxxx> create user a identified by "a";

User created.

SYS@xxxx> select user# from user$ where name = 'A';

     USER#
----------
	77

checking the “_NEXT_USER” again we can see that the ID got incremented:

SYS@xxxx> select user#,name from user$ where type# = 0 and name='_NEXT_USER';

     USER# NAME
---------- ------------------------------
	78 _NEXT_USER

so oracle uses a (hidden) role to track the next id a user will get and updates the id of the (hidden) role itself after a user has been created :)