25 Şubat 2013

to get the actual physical cores/cpus


grep -i "physical id" /proc/cpuinfo | sort -u | wc -l

17 Mayıs 2012

tcpdump

tcpdump -i eth0 -nnvvXSs 1514 port 7779 -w capture.cap

04 Nisan 2012

To shrink datafiles as much as possible

select 'alter database datafile '''||file_name||''' resize ' || ceil( (nvl(hwm,1)*&&blksize)/1024/1024 )  || 'm;' cmd from dba_data_files a, ( select file_id, max(block_id+blocks-1) hwm from dba_extents group by file_id ) b where a.TABLESPACE_NAME='TEST_OIM' and a.file_id = b.file_id(+) and ceil( blocks*&&blksize/1024/1024) - ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) > 0;

Oracle DB data size monitoring - tips for troubleshooting

To check Datafile size of a given tablespace;
select NAME,BYTES/1024/1024/1024 from v$datafile;
SELECT FILE_NAME,BYTES/1024/1024/1024 FROM DBA_DATA_FILES where TABLESPACE_NAME = 'USERS';
select sum(bytes)/1024/1024/1024 "Gig" from dba_data_files where TABLESPACE_NAME = 'TEST_OIM';
select * from DBA_FREE_SPACE where TABLESPACE_NAME = 'TEST_OIM';

Alter tablespace datafiles
ALTER DATABASE DATAFILE '+DATA/oimtest/datafile/test_oim.278.779629303' RESIZE 5000m;

To check size availability in Storage Disks(ASM)
select GROUP_NUMBER,NAME,TOTAL_MB,FREE_MB,HOT_USED_MB,COLD_USED_MB,USABLE_FILE_MB from v$asm_diskgroup;

To check actual sizes of objects in a schema:
select SEGMENT_NAME,SEGMENT_TYPE,BYTES/1024/1024 from dba_Segments where TABLESPACE_NAME = 'TEST_OIM' and BYTES/1024/1024> 1000 order by bytes desc;
select sum(BYTES/1024/1024) from dba_Segments where TABLESPACE_NAME = 'TEST_OIM';
select SEGMENT_NAME,SEGMENT_TYPE,BYTES/1024 from dba_Segments where TABLESPACE_NAME = 'TEST_OIM' and BYTES/1024/1024> 1000 order by bytes desc;

To check ownerships of LOB objects:
SELECT owner, table_name, column_name FROM dba_lobs WHERE segment_name = 'SYS_LOB0000095949C00007$$';

DBA_SEGMENTS definition

http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_4097.htm

DBA_TABLES definition

https://netfiles.uiuc.edu/jstrode/www/oradd/DBA_TABLES.html

Oracle Database Monitoring Tips

http://www.rocket99.com/techref/oracle8406.html

15 Şubat 2012

Disabling db user password expiration

SELECT USERNAME, PROFILE, ACCOUNT_STATUS FROM DBA_USERS WHERE USERNAME LIKE 'TEST_%';
select resource_name,liMit from dba_profiles where profile='DEFAULT';
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
alter user TEST_OIM identified by Oracle123;

08 Aralık 2011

Update with Join

update
(select table1.col1, table2.col2 from table1inner join table2on table1.key = table2.key where something something)
set col1= col2

04 Mayıs 2011

Redirect JVM Output from .out to .log files in Weblogic

Just add


-Dweblogic.log.RedirectStdoutToServerLogEnabled=true

server start parameters ..
This will put JVM outputs (other than internal stuff like thread dump etc.) to .out file with level "NOTIFICATION"

27 Şubat 2011

Getting rid of the system beep on VMware



tip to myself:


add the setting mks.noBeep = "TRUE" to the .vmx file to disable the PC speaker in a VM

13 Şubat 2011

SLCIAF: ps command for Solaris

today on _simple linux commands i always forget_ series :


ps command that we are used to is unfortunately not available in Solaris... But there is one alternative:
/usr/ucb/ps -awwx 

This "normal" ps is generally in this path, if some management packages are installed.

14 Eylül 2010

search for a text spawned to several lines of a file

omg awk is s.f.cool...



#!/usr/bin/ksh

cat source.log | awk 'BEGIN {x=0}
{
if ($0~"STARTINGMARK") {x=1}
if (x==1) {print $0}
if ($0~"ENDINGMARK") {x=0}
}' > output.log

14 Haziran 2010

Configuring kernel params before any Oracle installation

If the value of any kernel parameter is different from the recommended value, complete the following steps:

Using any text editor, create or edit the /etc/sysctl.conf file and add or edit lines similar to the following:


Note:
Include lines only for the kernel parameter values that you want to change. For the semaphore parameters (kernel.sem), you must specify all four values. However, if any of the current values are larger than the recommended value, specify the larger value.
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 256 32000 100 142
fs.file-max = 131072
net.ipv4.ip_local_port_range = 10000 65000
kernel.msgmni = 2878
kernel.msgmax = 8192
kernel.msgmnb = 65535

By specifying the values in the /etc/sysctl.conf file, they persist when you reboot the system.

Enter the following command to change the current values of the kernel parameters.

# /sbin/sysctl -p

Review the output from this command to verify that the values are correct. If the values are incorrect, edit the /etc/sysctl.conf file, then enter this command again.

On SUSE Linux Enterprise Server only, enter the following command to cause the system to read the /etc/sysctl.conf file when it reboots:

# chkconfig boot.sysctl on




To increase the shell limits:

Add the following lines to /etc/security/limits.conf file:

*        soft   nproc         2047
*        hard   nproc         16384
*        soft   nofile        2048
*        hard   nofile        65536

Add the following line to the /etc/pam.d/login file, if it does not already exist:

session    required     /lib/security/pam_limits.so

Depending on the oracle user's default shell, make the following changes to the default shell start-up file:

For the Bourne, Bash, or Korn shell, add the following lines to the /etc/profile file:

if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
fi

For the C or tcsh shell, add the following lines to the /etc/csh.login file:

if ( $USER == "oracle" ) then
        limit maxproc 16384
        limit descriptors 65536
endif

17 Mayıs 2010

Viewing Information About Database Users and Profiles

The following data dictionary views contain information about database users and profiles:
ViewDescription
DBA_USERS
ALL_USERS
USER_USERS
DBA view describes all users of the database. ALL view lists users visible to the current user, but does not describe them. USER view describes only the current user.
DBA_TS_QUOTAS
USER_TS_QUOTAS
Describes tablespace quotas for users.
USER_PASSWORD_LIMITS
Describes the password profile parameters that are assigned to the user.
USER_RESOURCE_LIMITS
Displays the resource limits for the current user.
DBA_PROFILES
Displays all profiles and their limits.
RESOURCE_COST
Lists the cost for each resource.
V$SESSION
Lists session information for each current session. Includes user name.
V$SESSTAT
Lists user session statistics.
V$STATNAME
Displays decoded statistic names for the statistics shown in the V$SESSTAT view.
PROXY_USERS
Describes users who can assume the identity of other users.

14 Mayıs 2010

SLCIAF: Searching files that includes a given text

today on _simple linux commands i always forget_ series :


Searching files that includes a given text. 


find . -exec grep -l “string to find” {} \;