find ./ -name "*.arc" -atime +7 -exec ls {} \;
find ./ -type f -mtime +10 -exec ls {} \;
find ./ -type f -mtime +10 -exec rm {} \;
#
#
Common Unix Command for DBA# Oct 04,2002
$ORACLE_HOME/install/utl/unixenv
###########################
#OS setup
###########################
uname -X
uname -a
hostname
ulimit -a
swap -l
sar -r 1 1
vmstat
mount
df -k
env | sort
sar -v 1 1
ipcs -sa
/etc/sysdef | grep SEM
ipcs -ma
/etc/sysdef | grep SHM
/var/opt/oracle/oratab
#PhysicalMemory
prtconf|grep Memory
#CPU Info
psrinfo -v
mpstat 1 3
#OS Patches
showrev -p
#OS Packages
pkginfo -l
#system error log
dmesg
#National Language Support(NLS) Environment Settings
NLSPATH
NLS_LANG
ORA_NLS33
TZ
#profile
/etc/profile
$HOME/.profile
#for CDE login
$HOME/.dtprofile
/etc/*.conf
#Checking if domainname is set: domainname
/etc/hosts
/etc/groups
/etc/networks
/etc/nodename
#system configuration
/usr/sbin/sysdef|grep -v instance |grep -v drv |tail -77
#system uptime
uptime
##########################################
#Performance Overview
##########################################
=====================
#Process Overview
=====================
#Oracle:
ps -ef|grep oracle|wc -l
#Background:
#Listeners:
#Root:
#Number Users:
#Total Processes
ps -ef|wc -l
#Databases Running: (Note: the CPU Usage in Minutes)
/usr/ucb/ps aux|head -1
/usr/ucb/ps aux|grep oracle
#Who is logged on
who
#Current CPU HOGS:
top 15
#Current TOP 10 CPU by % CPU
/usr/ucb/ps aux|head -11
#root CPU Hogs
=====================
#Disk Related
=====================
#File System Free Space in KB
df -k
#throughput MB/sec, transfers/sec, avg service time milliseconds
iostat -M 10 3
#Current Disks (see iostat -E) run 7200rpm @@100 random I/O /sec or 500 sequential/sec
#100 I/O per sec imples seek time 10 ms since most access is seek time
#Disks on PC capable of sustaned 8-16 MBit/sec and Unix 32-40 Mbit/sec
#throughput KB/sec, transfers/sec, avg service time milliseconds
iostat -d 10 3
#extended disk statistics
#look for disks more than 30 % busy and service times of more than 50ms
#iostat -x.b > 30% && iostat -x.svc_t > 50ms == busy disk
#look for overloaded scsi bus
#iostat -x.w >= 5% == busy scsi bus
#striping filesytems and tablespaces over multiple disks and
#controllers can spread i/o over multiple spindles
iostat -xe 10 3
#disk error reports
iostat -e
#paging activities
sar -g 1 4|grep -v SunOS
#swap activities
swap -l
swap -s
=====================
#CPU Overview
=====================
#General CPU Information
psrinfo -v
#CPU per-processor statistics
mpstat 1 3 -v
#Sar CPU Usage
sar -u 1 4|grep -v SunOS
#Top Report Usage
top
#system calls
sar -c 1 4|grep -v SunOS
#Memory Statistics
vmstat -s
# message and semaphore
sar -m 1 4|grep -v SunOS
###################
#Network
###################
ifconfig -a
#tcpip settings
ndd /dev/tcp \?
#SQL*Net Config Files
sqlnet.ora
tnsnames.ora
listener.ora
#Intelligent Agent Config Files
$ORACLE_HOME/network/admin/snmp_ro.ora
$ORACLE_HOME/network/admin/snmp_rw.ora
$ORACLE_HOME/network/log/nmiconf.log
$ORACLE_HOME/network/agent/services.ora
#Configuration file for webServer discovery
$ORACLE_HOME/network/agent/config/nmxw.ora
#config file for discovering Oracle Applications
$ORACLE_HOME/network/agent/oapps.ora
#Heterogeneous Services Config Files
#HS parameters that are needed for an ODBC Agent.
$ORACLE_HOME/hs/admin/inithsodbc.ora
#Oracle Management Server Config Files
$ORACLE_HOME/sysman/config/omsconfig.properties
#Listener Status and Services
===============================
#Environment
===============================
#Checking to see if TNS_ADMIN is being used
#list of .ora files from /etc
#list of .ora files from /var/opt/oracle
#List of .ora files from $ORACLE_HOME/network/admin
sqlnet.ora
listener.ora
tnsnames.ora
snmp_rw.ora
snmp_ro.ora
#Checking for any all tnslsnr PROCESSES: (Look for CPU hogs)
#Checking for any TWO TASK PROCESSES:
#Is ORACLE_HOME / SID / TWO_TASK set:
ORACLE_BASE
ORACLE_SID
ORACLE_OWNER
OES_ORACLE_HOME
ORACLE_TERM
ORACLE_HOME
==========================
#Network Performance
==========================
ping -s -v -R 1280 10
Ping Report from sun3-lab.vialta-inc.com (this machine) to sun3-lab.vialta-inc.com (this machine)
Ping Report from sun3-lab.vialta-inc.com (this machine) to 10.0.43.88 (wan)
Ping Report from sun3-lab.vialta-inc.com (this machine) to sun3-lab.vialta-inc.com (rdbms)
Ping Report from sun3-lab.vialta-inc.com (this machine) to 10.0.44.101 (web)
Ping Report from sun3-lab.vialta-inc.com (this machine) to 10.0.43.88 (client)
#Are the tns processes running and for what listeners:
UID PID PPID C STIME TTY TIME CMD
oracle 8469 7662 0 21:53:15 pts/3 0:00 grep tnslsnr
oracle 7298 1 0 Aug 22 ? 4:27 /oracle/9.0.1/bin/tnslsnr LISTENER -inherit
#Unix netstat ESTABLISHED
netstat|grep ESTABLISHED|wc -l
#Unix netstat WAITING
netstat|grep WAITING|wc -l
netstat -a
#Ports Being Used
/etc/services
#Network Cards and setup
ifconfig -a:
#Network Performance
netstat -s
############################
#RDBMS Product Versions
############################
init.ora
V$Parameters
V$Option
SGA Information: v$SGA V$SGASTAT
V$License Information
V$Compatibility Information
NLS_Database_Parameters
NLS_Instance_Parameters
NLS_Session_Parameters
NLS Session TimeZone
NLS Database TimeZone
Java Information
Java Objects
Java Roles
Oracle Supplied Java Users
V$Controlfile Information
Log Information : V$Log V$Logfile
Undo Information: V$UndoStat DBA_Undo_Extents
V$System_Event
V$Session_Wait
Latch Information: V$Latch V$Latchholder
Tablespaces
Tablespace
Locally Managed Temporary Tablespaces
Database Files
Database Files
Temp files
Invalid Objects
All_Errors: dba_errors
Install logs
$ORACLE_HOME/install/make.log
$ORACLE_BASE/oraInventory/logs/installActions*.log
Last 7940 Lines of Alert Log
$ORACLE_BASE/admin/sid/bdump/alert_sid.log
WebIV
Last Trace File
Trace/Log Directory Listings
Background Dump Destination (from background_dump_dest setting)
Default Background Dump Destination ($ORACLE_HOME/rdbms/log)
Core Dump Destination (from core_dump_dest setting)
Default Core Dump Destination($ORACLE_HOME/dbs)
User Dump Destination
check the port is open or not --> telnet sun2-prod-101 1754
check ORACLE port is open or not -->tnsping "(ADDRESS=(PROTOCOL=TCP)(HOST=sun2-prod-101)(PORT=1748))"
check port is listened or not --> netstat -an|grep 1754
check DNS resolution --> nslookup
check history commands-->history / last
trace system calls and signals --> truss lsnrctl dbsnmp_start
truncate current used log file --> :>listener.log
Tool for Sun Performance and Tuning
====================================
SE Toolkit can be downloaded from www.setoolkit.com
sun2-noc:(need x-server)
/opt/RICHPse/bin/se ../examples/zoom.se&
$ export ORACLE_SID=orcl1; echo 'startup'|sqlplus "/ as sysdba"
DNS config file-->/etc/resolv.conf
Use of the Secure Copy (scp) Command
=====================================
General Syntax:
scp [-pr] [userid@][source host:][path to file] [userid@][destination host:][path to file]
The "-p" option is to preserve the time stamp of the file.
The "-r" option is to recursively copy files from the source directory specified.
Once you enter the scp command, you will prompted for access to the host
Examples:
From Remote Unix to Local Unix
-------------------------------
$ scp emao@10.0.23.102:/u01/oradata/8.1.7/dbs/* /opt/oracle/8.1.7/dbs/
From Local Unix to Remote Unix
-------------------------------
$ scp /opt/oracle/8.1.7/dbs/* emao@10.0.23.102:/u01/oradata/8.1.7/dbs/
check partition block size-->df -g
compare files-->cksum
replace a word in vi editor--> :%s/test/exam/g
:3,5s/test/exam/g
undo in vi editor--> u
help
: set all
display line number
: set number
ignore case-sensitve
: set ic
shift+w
shift+4
shift+0
shift+j
Track shell script--> sh -x dbora start
nohup sqlplus "/as sysdba" <<>/usr/proc/bin/pmap -x
Refer to Note:163763.1 Diagnosing Oracle memory on Sun Solaris using PMAP
ipcs -m
report per-processor statistics-->mpstat
check os bit-->isainfo -b
prompt hostname and SID(.profile)--> PS1="`hostname`*\${ORACLE_SID}$ "
see the whole process string-->/usr/ucb/ps -auxww|grep jre
zcat O8i_DG_R3_0_2_Sun_tar.Z | tar xvf -
|--> uncompress O8i_DG_R3_0_2_Sun_tar.Z
+--> tar -xvf O8i_DG_R3_0_2_Sun_tar
rsh without prompting password
-------------------------------
--> .rhosts under remote user default hhome
sun7-dev$ cat .rhosts
sun6-dev oracle
--> make sure hostname is the same as iin "who" on remote site
sun7-dve$ who
oracle pts/5 Feb 15 14:35 (sun6-dev)
Note: http://sunsolve.Sun.COM for the Document 12029 REMOTE LOGIN PSD/FAQ.
mail on unix
--------------------
send email/pager-->
echo 'test' | mailx -s 'Subject: Alter" emao@sun5-noc.vialta-inc.com
echo 'test' | mailx -s 'Subject: Alter" 5103766360@messaging.nextel.com
email auto-forward--> .forward (under user default home)
/etc/mail/alias
--to show 32-bit or 64 bit OS
--sparcv9-->64 bit
$ isalist
sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc