26 April 2011

LINUX - Listing today's files only

# ls -l --time-style=+%D | grep `date +%D`

ORACLE - To check list of inactive users or inactive sessions

In many cases you need to check the list of inactive users or inactive sessions in your database. 

The script below produces the list of inactive users and inactive sessions. Run the script using sysdba 

set heading on feedback on pages 100 lines 140

column userinfo heading "ORACLE/OS User" format a19
column machine heading "Client Machine" format a20
column terminal heading "Terminal" format a10
column process heading "Parent|Process ID" format a10
column spid heading "Shadow|Process ID" format a10
column seq# heading "Wait|Sequence" format 99999990
select s.username||' '||s.osuser userinfo,s.machine, s.terminal, s.sid, s.serial#,
p.spid,
s.process , w.seq#
from v$session s, v$process p
,v$session_wait w
where p.addr = s.paddr
and s.sid = w.sid
and w.event = 'SQL*Net message from client'
and s.status = 'INACTIVE'
order by s.osuser, s.machine
/

ORACLE - What is the overall database size (MB)

The next time if your manager asks you how big is our Oracle database size? Do this...

An oracle database consists of data files, redo log files, control files, temporary files. Whenever you say the size of the database this actually means the summation of these files.

The biggest portion of a database's size comes from the datafiles. To find out how many megabytes are allocated to ALL datafiles:
SQL> select sum(bytes)/1024/1024 "Meg" from dba_data_files;

To get the size of all TEMP files:
SQL> select nvl(sum(bytes),0)/1024/1024 "Meg" from dba_temp_files;

To get the size of the on-line redo-logs:
SQL> select sum(bytes)/1024/1024 "Meg" from sys.v_$log;

To get the size of the control files use,
SQL> select sum(BLOCK_SIZE*FILE_SIZE_BLKS/1024/1024) "MEG" from v$controlfile;

So to get the total size of the database just sum these.

SQL> select a.data_size+b.temp_size+c.redo_size+d.controlfile_size "total_size in MB"
from ( select sum(bytes)/1024/1024 data_size
from dba_data_files ) a,
( select nvl(sum(bytes),0)/1024/1024 temp_size
from dba_temp_files ) b,
( select sum(bytes)/1024/1024 redo_size
from sys.v_$log ) c,
( select sum(BLOCK_SIZE*FILE_SIZE_BLKS)/1024/1024 controlfile_size
from v$controlfile) d;



4 April 2011

APACHE - Basic performance tuning

If you are running into frequent Apache crashes you can check the error_log for MaxClients-related problems.

To check your error logs to see if you have MaxClient issues you can run the following command as root: 


# grep -i maxclient /var/log/httpd/error_log*

If this command returns any results after making the above changes you may need to fine-tune the MaxClients variables further.

The official documentation on these settings and many others can be found here:
 
http://httpd.apache.org/docs-2.0/mod/mpm_common.html

APACHE - failed to start

[On] Red Hat Enterprise Linux Server release 7.4 (Maipo) Apache was not running and attempt to start the httpd service failed. The natural t...