560 likes | 857 Views
Good Afternoon, I'm:. Tom Canty, President of ServerCare, Inc.20 years of Oracle experience, mostly as a DBAPrevious presenter at IOUG, OpenWorld, NoCoug, and othersHas been running ServerCare for 10 years, specializing in being the
E N D
1. By Brent BigongerPresented by Tom CantyServerCare, Inc.
2. Good Afternoon, I’m: Tom Canty, President of ServerCare, Inc.
20 years of Oracle experience, mostly as a DBA
Previous presenter at IOUG, OpenWorld, NoCoug, and others
Has been running ServerCare for 10 years, specializing in being the “safety net” for databases, servers, and staff
NOT a System Administrator, but Brent was and is now a Senior Oracle DBA
3. Outline System, Storage and Network
Oracle Installation
Tips and Commands
Troubleshooting
4. RAID0 Striping
Implemented for performance
NO REDUNDANCY for disk failure
Failure chances increase as disks added
5. RAID1 Mirroring
Implemented for redundancy
Can sustain one disk failure
Not as “fast” as RAID0
6. RAID5 Good performance & redundancy balance
3 disks minimum
Uses “parity” bit to maintain consistency
NOT ideal for intensive write applications
OLTP databases!!
Never put redo logs on RAID5! In the event of a disk failure, any subsequent reads can be calculated from the distributed parity so that the array does not fail and is usually unknown to the end user. Although during typical operation read performance is very good, RAID5 is not ideal for write intensive applications due to the overhead of the parity calculation that must occur on each write.In the event of a disk failure, any subsequent reads can be calculated from the distributed parity so that the array does not fail and is usually unknown to the end user. Although during typical operation read performance is very good, RAID5 is not ideal for write intensive applications due to the overhead of the parity calculation that must occur on each write.
7. RAID0+1 Minimum 4 disks
Add in even numbers
No parity calculation
Will survive 1 disk failure
Maybe more
8. RAID1+0 (RAID10) Characteristics similar to RAID0+1
Minimum 4 disks
Add in even numbers
No parity calculation
Will survive 1 disk failure
Maybe more
11. Direct Attached Storage (DAS)
12. Network Attached Storage (NAS)
13. Storage Area Network (SAN)
14. File Systems RAW
Lack of a file system
Supposedly going away on Linux
“Cooked”
Disk file systems
ext3, NTFS, UFS, ZFS, ISO 9660 (CDFS)
Network file systems
NFS, SMB/CIFS (Samba)
Shared (clustered) file systems
OCFS/OCFS2, ASMFS (new), proprietary (Veritas, Solaris (QFS), etc.)
15. Outline System, Storage and Network
Oracle Installation
Tips and Commands
Troubleshooting
16. Oracle Installation - Packages Display full package names (32bit and 64bit)
rpm -q --qf "%{n}-%{v}-%{r}.%{arch}\n" <package name>
Find which package provides this file
rpm -q --whatprovides libXp.so.6
List the files in this RPM packages
rpm -qpl gibran/ncftp-3.2.0-3.el4.i386.rpm
17. Oracle Installation – Swap Space Add swap:
dd if=/dev/zero of=/swapfile bs=1024 count=524288
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
Another option:
./runInstaller -ignoreSysPrereqs
18. Oracle Installation – X-Display Start local X-Server (Cygwin, XWin, Xming…)
Enable X-forwarding on Server: /etc/sshd/sshd_config
Make sure: X11Forwarding yes
Configure Putty to ‘Enable X11 forwarding’
Test using ‘xclock’
xclock
19. Oracle Installation – X-Display Demo
20. Oracle Installation – Network Connectivity Check connectivity between client and server
Server:
nc –l –p 1521
Client:
telnet oracleserver.com 1521
21. Oracle Installation – cpio Extract a cpio
(-i extract, -d make dirs, -m keep mod time, -v verbose)
cpio -idmv < ship.db_Disk1.lnxx86-64.cpio
22. Oracle Installation – Parameter Compare QA Warehouse
sqlplus system@WHSQA
set pages 1000 lines 130
col name format a30
col value format a70
spool params_WHSQA.txt
select name, value from v$parameter order by 1;
spool off
23. Oracle Installation – Parameter Compare Prod Warehouse
conn system@WHSPRD
set pages 1000 lines 130
col name format a30
col value format a70
spool params_WHSPRD.txt
select name, value from v$parameter order by 1;
spool off
!diff -bB --side-by-side --suppress-common-lines params_WHSQA.txt params_WHSPRD.txt
24. Oracle Installation – Parameter Compare compatible 10.2.0 | compatible 10.2.0
cpu_count 4 | cpu_count 32
db_block_checking FALSE | db_block_checking true
db_cache_size 11576279 | db_cache_size 12582912
db_writer_processes 1 | db_writer_processes 4
dml_locks 4860 | dml_locks 7280
job_queue_processes 10 | job_queue_processes 20
log_buffer 15276032 | log_buffer 30503936
open_cursors 400 | open_cursors 2000
open_links 4 | open_links 150
25. Outline System, Storage and Network
Oracle Installation
Tips and Commands
Troubleshooting
26. Tips & Commands – System Info Find if CPU is 64bit capable, search for 'lm' (Long Mode)
cat /proc/cpuinfo | grep lm
Print out lots of kernel and system information
uname –a
Show free memory in megabytes (kbytes is default)
free -m
27. Tips & Commands – System Info (Cont.) top - 23:42:27 up 320 days, 16:05, 10 users, load average: 3.49, 3.68, 3.64
Tasks: 1167 total, 2 running, 1164 sleeping, 0 stopped, 1 zombie
Cpu(s): 0.9% us, 0.5% sy, 0.0% ni, 97.5% id, 1.0% wa, 0.0% hi, 0.0% si
Mem: 32907424k total, 32602304k used, 305120k free, 514928k buffers
Swap: 8385920k total, 297012k used, 8088908k free, 17308820k cached
shows about 300MB freeshows about 300MB free
28. Tips & Commands – System Info (Cont.) free -m
total used free shared buffers cached
Mem: 32136 31761 374 0 495 16851
-/+ buffers/cache: 14414 17721
Swap: 8189 290 7899 Actually 17GB free.
Linux always tries to use RAM to the fullest extent to speed up disk operations. Using available memory for buffers (file system metadata) and cache (pages with actual contents of files or block devices) helps the system to run faster because disk information is already in memory which saves I/O. If space is needed by programs or applications like Oracle, then Linux will free up the buffers and cache to yield memory for the applications. So if your system runs for a while you will usually see a small number under the field "free" on the first line. Actually 17GB free.
Linux always tries to use RAM to the fullest extent to speed up disk operations. Using available memory for buffers (file system metadata) and cache (pages with actual contents of files or block devices) helps the system to run faster because disk information is already in memory which saves I/O. If space is needed by programs or applications like Oracle, then Linux will free up the buffers and cache to yield memory for the applications. So if your system runs for a while you will usually see a small number under the field "free" on the first line.
29. Tips & Commands – X-Display Revisited Forward X11 traffic from server A to a local PC through intermediate server:
Enable X-forwarding on both Server A and Server B in:
/etc/sshd/sshd_config
Make sure:
X11Forwarding yes
Start X server on local PC
Configure Putty to ‘Enable X11 forwarding’
ssh to Server B
Export DISPLAY to PC
ssh with X11 forwarding (usually ssh -X) to Server A
Run X Application
30. Tips & Commands – screen Re-connect to a Linux Session!!
31. Tips & Commands – screen Demo
32. Tips & Commands – Mount Volumes Mount the data1 nfs volume on /mnt/temp
mount nas1:/data1 /mnt/temp
Mount Windows SMB shares
mount -t cifs -o user=username //computer/share /mnt/mtpoint
Mount a CDROM in a typical Linux environment
mount /dev/cdrom /mnt/cdrom
Definitions in /etc/(v)fstab will automount at boot and simplify manual mounting:
mount /u01
33. Tips & Commands – find Find and delete files more than 5 days old
find /u01/oracle/oradb/arch/ -mtime +5 -exec rm -f {} \;
Find & ask before deleting trace files in current dir
find . -name “*.trc” –ok rm –f {}\;
Find largest files and sort by size
find . -size +5000000c -ls | awk '{print $7, $11}' | sort
List file names with "aabbcc" & modified w/in 30 min
find . -mmin -30 -exec grep -l aabbcc "{}" \;
34. Tips & Commands – grep, sed Greps out 4 lines before & after the desired text
cat uni1_lmon_13673.trc | grep -C4 -i “ORA-”
Grep out blank lines (be careful of spaces or tabs)
grep -v '^$' input.txt
Search and replace checking each line in the file
sed '1,$s/searched/replaced_with/g' error.log > error.html
Caution: some *nix environments use egrep, fgrep, or lgrep, or have different syntax (esp. –e switch), and Windows uses findstr
35. Tips & Commands – du Find the 'disk usage' (du) for several archive logs and display a total (s=summary (top directory only), h=human readable, c=show total)
du -shc al_TEST1_20080304*
16M al_TEST1_20080304_15jacpfk_1_1
4.0K al_TEST1_20080304_1ajacpgv_1_1
1.9G al_TEST1_20080304_2cjaeqqg_1_1
…
1.9G al_TEST1_20080304_2qjaerj1_1_1
40G total -c for cumulative-c for cumulative
36. Tips & Commands – sar setup (RHEL) Log in as root
Enter the command
yum install sysstat
Systat is now scheduled:
more /etc/cron.d/sysstat
#run system activity accounting tool every 10 minutes */10 * * * * root /usr/lib/sa/sa1 1 1
#generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib/sa/sa2 -A
37. Tips & Commands – sar reporting sar -f /var/log/sa/sa05 -s 08:00:00 -e 10:00:00
Linux 2.6.9-42.0.10.ELsmp 03/05/2008
08:00:01 AM CPU %user %nice %system %iowait %idle
08:10:01 AM all 1.04 0.00 0.93 24.77 73.25
08:20:01 AM all 1.02 0.00 0.90 23.77 74.31
08:30:01 AM all 1.12 0.00 1.08 26.74 71.06
08:40:01 AM all 1.15 0.00 1.07 27.07 70.71
08:50:01 AM all 1.16 0.00 1.11 28.51 69.21
09:00:01 AM all 1.18 0.00 1.19 29.78 67.85
09:10:01 AM all 1.23 0.00 1.21 30.59 66.96
09:20:01 AM all 1.17 0.00 1.16 30.79 66.89
09:30:01 AM all 1.16 0.00 1.22 33.50 64.11
09:40:01 AM all 1.12 0.00 1.15 33.13 64.60
09:50:01 AM all 1.22 0.00 1.30 34.53 62.95
Average: all 1.14 0.00 1.12 29.38 68.36
38. Tips & Commands – OS Watcher Keeps history of:
top, vmstat, iostat, ps, netstat, mpstat, prvtnet
To setup
Download OSW from Metalink (osw.tar)
Untar
Run
nohup ./startOSW.sh 60 24 &
Sample vmstat file from OSW
***Fri Jan 28 12:50:00 PST 2008
procs memory page disk faults cpu
r b w swap free re mf pi po fr de sr dd f0 s0 in sy cs us sy id
0 0 0 1761344 1246520 1 6 0 0 0 0 0 2 0 0 0 380 1364 900 4 1 95
0 0 0 1643920 1086776 331 1485 8 16 16 0 0 31 0 0 0 447 4966 1315 15 31 54
0 0 0 1643872 1086728 6 0 0 0 0 0 0 0 0 0 0 389 1472 932 0 0 100
39. Tips & Commands – ps Return either apache or mysql
ps -ef | egrep "apache|mysql"
Print Oracle smon background process
ps -ef | grep ora_smon | grep -v grep | awk '{ print $8 }‘
Caution: some *nix environments use totally different switches for ps. For example, ps –ef ? ps –aux. Some use –w or –ww to see full line. This can be important when doing a grep.
40. Tips & Commands – Shell Prompt Add timestamp to bash prompt
export PS1="\[\033[1;31m\][\$(date +%H:%M)][\u@\h:\w]$ "
Here’s how the prompt looks:
[13:59][oracle@shag:~]$
My prompt
export SYS_HOST=`/bin/hostname -s`
export PS1="[\$(date +%H:%M)]$LOGNAME@$SYS_HOST[$ORACLE_SID]$ "
My prompt looks like:
[13:46]oracle@rmandb1[EMREP]$
41. Tips & Commands – Shell Prompt (Cont.) Useful bash shell shortcuts
[partial command]+<tab> - Auto command complete
<ctl>+a - Go to beginning of the line
<ctl>+e - Go to end of the line
<ctl>+d - Delete character
<ctl>+r - Recall commands
42. Tips & Commands – Script Debugging One of the best places to start debugging a shell script is with the `-x` option. This causes bash to be more verbose in its output, including printing out expanded shell variables, and command lines before they are executed. Because of the sometimes extensive expansion of shell and enviroment variables, and obtuse quoting rules, being able to see the expanded version of the script is enough to figure out what is going on. One of the best places to start debugging a shell script is with the `-x` option. This causes bash to be more verbose in its output, including printing out expanded shell variables, and command lines before they are executed. Because of the sometimes extensive expansion of shell and enviroment variables, and obtuse quoting rules, being able to see the expanded version of the script is enough to figure out what is going on.
43. Tips & Commands – Script Debugging Demo One of the best places to start debugging a shell script is with the `-x` option. This causes bash to be more verbose in its output, including printing out expanded shell variables, and command lines before they are executed. Because of the sometimes extensive expansion of shell and enviroment variables, and obtuse quoting rules, being able to see the expanded version of the script is enough to figure out what is going on. One of the best places to start debugging a shell script is with the `-x` option. This causes bash to be more verbose in its output, including printing out expanded shell variables, and command lines before they are executed. Because of the sometimes extensive expansion of shell and enviroment variables, and obtuse quoting rules, being able to see the expanded version of the script is enough to figure out what is going on.
44. Tips & Commands – cron crontab –l > oracron.`date '+%Y_%m_%d_%I%M'`
crontab -r
crontab oracron.2008_08_27_1152
Cron time order:
Minute - Minutes after the hour (0-59)
Hour - 24-hour format (0-23)
Day - Day of the month (1-31)
Month - Month of the year (1-12)
Weekday - Day of the week. (0-6, where 0 indicates Sunday)
45. Tips & Commands – File Cleanup List file names with "aabbcc" & modified w/in 30 min
find . -mmin -30 -exec grep -l aabbcc "{}" \;
Move files > 10 days old with the filename *.trc
find . -name "*.trc" -mtime +10 -exec mv {} /tempdir \;
Deletes file older than 60 minutes in one statement
find . -type f -name '*.trc' -mmin +60 -exec rm -f {} \;
46. Tips & Commands – Miscellaneous Correctly set the backspace key
Note this is the backspace character, not ^? (but it usually works. ^H is a common one as well.)
stty erase ^?
Rename a subset of files
ls *.log | xargs -t -i mv {} {}.old
Renice process value and increase by 20
make it less important
NEVER do with Oracle processes or connections!
renice 20 -p 22432
47. Tips & Commands – Miscellaneous Split a 1.3GB file into smaller chunks
split –bytes=500m largefile.zip largefile.zip_part_
Would produce:
largefile.zip_part_aa
largefile.zip_part_ab
largefile.zip_part_ac
Re-assemble file from smaller chunks
cat largefile.zip_part_* > largefile.zip
48. Tips & Commands – Sendmail SMART_HOST cp -p sendmail.cf sendmail.cf_orig
cp -p sendmail.mc sendmail.mc_orig
vi /etc/mail.sendmail.mc
Uncomment the line that looks like this:
dnl define(`SMART_HOST',`smtp.your.provider')
Replace with your smtp provider, such as
Notice the backtick
`smtp.west.cox.net'
m4 sendmail.mc > /etc/sendmail.cf
Restart sendmail
/etc/init.d/sendmail restart If you don’t have the sendmail.cf rpm installed or don’t not want to install it, you can add your SMART_HOST definition directly into the /etc/mail/sendmail.cf file yourself. Open /etc/mail/sendmail.cf and search for the DS definition.
To add your SMART_HOST simply add the DNS name directly after 'DS' (without any space, i.e. DSsmtp.west.cox.net). Save and close the file and restart sendmail.If you don’t have the sendmail.cf rpm installed or don’t not want to install it, you can add your SMART_HOST definition directly into the /etc/mail/sendmail.cf file yourself. Open /etc/mail/sendmail.cf and search for the DS definition.
To add your SMART_HOST simply add the DNS name directly after 'DS' (without any space, i.e. DSsmtp.west.cox.net). Save and close the file and restart sendmail.
49. Tips & Commands – SMTP AUTH Add to /etc/mail/authinfo:
AuthInfo:smtp.1and1.com "U:brent" "P:password" "M:PLAIN“
Then create the .db file:
makemap hash /etc/mail/authinfo < /etc/mail/authinfo
Edit the file permissions:
chmod o-r /etc/mail/authinfo
50. Tips & Commands – SMTP AUTH (cont) vi sendmail.mc
define(`SMART_HOST',`smtp.west.cox.net')dnl
FEATURE(`authinfo')dnl
define(confDOMAIN_NAME, `soe.sony.com')dnl
m4 sendmail.mc > sendmail.cf
If not installed:
yum install sendmail-cf
/etc/init.d/sendmail restart
Send a test
echo "Test" | mail -s "Test1 from qaserv1" brent@cox.net
51. Outline System, Storage and Network
Oracle Installation
Tips and Commands
Troubleshooting
52. Troubleshooting – OS Logs/Buffer Places to start (requires root privilege):
tail -50 /var/log/messages
tail -30 /var/log/secure
Linux bootup messages:
dmesg
Sample ‘dmesg’ output:
Linux version 2.6.9-42.0.3.EL (gcc version 3.4.6 2006040
4 (Red Hat 3.4.6-3)) #1 Fri Oct 6 05:59:54 CDT 2006
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009f800 (usable)
BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved)
... The program helps users to print out their bootup messages. The program helps users to print out their bootup messages.
53. Troubleshooting – vmstat vmstat 3 5
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---
r b swpd free buff cache si so bi bo in cs us sy id wa
0 1 0 2432332 67616 1475224 0 0 317 262 333 144 1 0 92 7
0 2 0 2432332 67616 1475224 0 0 1711 570 1594 1017 1 0 70 29
0 3 0 2432284 67624 1475216 0 0 1646 337 1538 911 0 0 70 29
0 4 0 2432292 67624 1475216 0 0 3001 312 1622 1107 1 1 65 34
0 0 0 2432212 67624 1475216 0 0 2078 1466 2459 2354 1 1 76 22
54. Troubleshooting – sar -W sar –W
Linux 2.6.9-67.0.1.ELsmp
07:40:02 AM pswpin/s pswpout/s
07:50:01 AM 0.76 0.01
08:00:01 AM 10.29 0.90
08:10:02 AM 13.94 7.38
08:20:01 AM 12.98 1.43
08:30:01 AM 5.85 5.03
08:40:01 AM 10.04 0.03
08:50:01 AM 5.30 1.78
09:00:01 AM 2.19 2.32
09:10:01 AM 42.42 43.59
09:20:01 AM 1.02 0.14
Average: 3.24 2.62 Swapping:
swap pages brought in
swap pages brought outSwapping:
swap pages brought in
swap pages brought out
55. Troubleshooting – strace System calls summary
strace -c -p 28192
Process 28192 attached - interrupt to quit
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- -----------
78.07 0.000997 997 1 poll
12.84 0.000164 13 13 read
6.26 0.000080 6 13 open
2.19 0.000028 2 13 close
0.62 0.000008 3 2 getrusage
------ ----------- ----------- --------- --------- -----------
100.00 0.001277 45 total
See the actual system calls
strace -p 28192
Trace your own session
strace sqlplus
56. Summary System, Storage and Network
Oracle Installation
Tips and Commands
Troubleshooting
57. Thank You! Tom Canty
I can be contacted at: tom.canty@servercare.com
I will upload presentation to our website tonight
Thanks!! Please fill out you speaker evaluation.