Tuesday, July 5, 2011

How to find the sessions which generated maximum redo from the last oracle database startup on

How to find the sessions which generated maximum redo from the last oracle database startup on
=================================================================

----see the query

SELECT ss.SID, sq.sql_text, se.status, se.username, se.osuser, se.program,
se.machine, ss.VALUE
FROM v$sesstat ss, v$statname sn, v$session se, v$sqlarea sq
WHERE ss.statistic# = sn.statistic#
AND se.sql_hash_value = sq.hash_value(+)
AND se.sql_address = sq.address(+)
AND ss.SID = se.SID
AND sn.NAME = 'redo size'
ORDER BY ss.VALUE DESC



----for current session how much redo generation

SELECT value
FROM v$mystat, v$statname
WHERE v$mystat.statistic# = v$statname.statistic#
AND v$statname.name = 'redo size';

Sunday, July 3, 2011

How many users are there or created in sun solaris machine or server and who are they?

How many users are there or created in sun solaris machine or server and who are they?
================================================================================

To print all system account you need to use awk command:

$ awk -F: ' $3 < 99 { print $0 }' /etc/passwd


OR to just display list of all regular user:


$ awk -F: ' $3 > 99 { print $0 }' /etc/passwd

or

$logins



Others related command :=

$ id , w , id -a , who ,whodo , logname, echo $LOGNAME , wha am i , who r u, who we are

---for seeing bash

ps -p$$



note:-

IDs 0-99 are for Solaris system accounts
IDs 100-999 for applications--------------------this is created user
IDs 1000-60000 for normal users


example:-


bash-3.00#
bash-3.00# awk -F: ' $3 < 99 { print $0 }' /etc/passwd
root:x:0:0:Super-User:/:/sbin/sh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
smmsp:x:25:25:SendMail Message Submission Program:/:
listen:x:37:4:Network Admin:/usr/net/nls:
gdm:x:50:50:GDM Reserved UID:/:
webservd:x:80:80:WebServer Reserved UID:/:
postgres:x:90:90:PostgreSQL Reserved UID:/:/usr/bin/pfksh
svctag:x:95:12:Service Tag UID:/:
bash-3.00#
bash-3.00#




bash-3.00#
bash-3.00# awk -F: ' $3 > 99 { print $0 }' /etc/passwd
nobody:x:60001:60001:NFS Anonymous Access User:/:
noaccess:x:60002:60002:No Access User:/:
nobody4:x:65534:65534:SunOS 4.x NFS Anonymous Access User:/:
oracle:x:100:100::/export/home/oracle:/bin/sh
shoeb:x:101:1::/home/shoeb:/bin/sh
basia:x:102:0::/home/basia:/bin/sh
dbuser:x:103:1::/home/dbuser:/bin/sh
santosh:x:104:1::/home/santosh:/bin/sh
bash-3.00#
bash-3.00#


bash-3.00#
bash-3.00#
bash-3.00# logins
root 0 root 0 Super-User
daemon 1 other 1
bin 2 bin 2
sys 3 sys 3
adm 4 adm 4 Admin
uucp 5 uucp 5 uucp Admin
nuucp 9 nuucp 9 uucp Admin
smmsp 25 smmsp 25 SendMail Message Submission Program
listen 37 adm 4 Network Admin
gdm 50 gdm 50 GDM Reserved UID
lp 71 lp 8 Line Printer Admin
webservd 80 webservd 80 WebServer Reserved UID
postgres 90 postgres 90 PostgreSQL Reserved UID
svctag 95 daemon 12 Service Tag UID
oracle 100 oinstall 100
shoeb 101 other 1
basia 102 root 0
dbuser 103 other 1
santosh 104 other 1
nobody 60001 nobody 60001 NFS Anonymous Access User
noaccess 60002 noaccess 60002 No Access User
nobody4 65534 nogroup 65534 SunOS 4.x NFS Anonymous Access User
bash-3.00#

How do enable root user log in with ssh in sun solaris?

How do enable root user log in with ssh in sun Solaris ?
--------------------------------------------------------

If you want to enable root login through ssh then you'll want to follow these two steps:

1) Open up /etc/ssh/sshd_config and set "PermitRootLogin" "no" to "yes".
(Your ISP probably set it to "without-password")
2) You also need to restart the sshd process. reboot the server
or
$ /etc/init.d/sshd restart
or
This is done by killing the existing one
(use ps -aux|grep sshd to get the process ID, then use kill it),then restarting /usr/sbin/sshd