Академический Документы
Профессиональный Документы
Культура Документы
Gus Bjrklund
Wizard, Progress Software Corporation
Ask questions as we go if I am not clear about something. Warning: there is a mistake in these slides.
Topics
SSH is your friend! Like Linux, more great stuff from Finland
SSH
SSH replaces telnet, rlogin, rcp, rsh, etc. All connections are encrypted Use for remote access over Internet
SSH
gus@dirac:gus $ cd 4gl; tar -cf - *.p | ssh bespin "cd foo; tar -xf -" gus@bespin's password: gus@dirac:4gl $
do this:
# Protocol 1,2 Protocol 2 ... # Authentication: PasswordAuthentication no then save changes. restart daemon: # service sshd restart
15 DB-3: Tips for Database Administrators
2007 Progress Software Corporation
www.openssh.com http://www.ietf.org/rfc/rfc4251.txt
After Imaging
AI Basics
Add AI extents to database Back up the database Enable after-imaging Archive ai extents as they become full
10.1 has an automatic archiver
AI basics 2
Restore the backup copy of your database Roll forward all ai extents you archived
You do know where you put them, dont you? I hope they werent on the failed disk
When roll forward done, start database Now you are back to where you were
Tools
Tools: uptime
$ uptime 11:26am up 17 day(s), 9:16, 163 users, load average: 3.09, 3.36, 3.76 $
Tools: top
gus@dirac:gus $ top -l 1 Processes: 65 total, 3 running, 62 sleeping... 183 threads 10:51:24 Load Avg: 0.04, 0.06, 0.07 CPU usage: 11.1% user, 44.4% sys, 44.4% idle SharedLibs: num = 170, resident = 37.0M code, 5.30M data, 6.44M LinkEdit MemRegions: num = 6460, resident = 166M + 16.3M private, 164M shared PhysMem: 161M wired, 758M active, 879M inactive, 1.76G used, 248M free VM: 9.47G + 102M 230499(0) pageins, 16746(0) pageouts PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE 606 top 0.0% 0:00.05 1 17 19 276K 684K 748K 26.9M 586 bash 0.0% 0:00.02 1 14 16 224K 1.05M 844K 27.1M 585 login 0.0% 0:00.01 1 16 40 172K 768K 636K 26.9M 583 Terminal 0.0% 0:01.56 5 130 197 2.64M 11.9M 8.93M 364M 563 TextEdit 0.0% 0:00.23 1 67 149 2.05M 8.94M 5.80M 355M 558 TeXShop 0.0% 0:03.18 2 109 238 4.49M 20.2M 25.6M 365M 467 firefox-bi 0.0% 1:31.55 6 96 389 48.1M 29.4M 67.4M 428M
Tools:find
Tools:lsof
bleicher /usr/lib/librt.so.1 bleicher /usr/lib/libsocket.so.1 bleicher /usr/lib/libintl.so.1 bleicher /usr/lib/ld.so.1 bleicher /usr/lib/libdl.so.1 . . . 26240 bleicher /tools/solaris/dlc100b/promsgs 26240 bleicher /tools/solaris/dlc100b/bin/_progres
ftp://vic.cc.purdue.edu/pub/
Tools:ifconfig
1-bespin-gus-> /usr/sbin/ifconfig -a lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST, IPv4> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 ce0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST, IPv4> mtu 1500 index 2 inet 172.16.7.168 netmask ffff0000 broadcast 172.16.255.255
Tools:ifconfig
gus@dirac:gus $ ifconfig en0 en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 tunnel inet --> inet6 fe80::217:f2ff:fecc:b686%en0 prefixlen 64 scopeid 0x4 inet 172.16.114.99 netmask 0xffff0000 broadcast 172.16.255.255 ether 00:17:f2:cc:b6:86 media: autoselect (1000baseT <full-duplex,flow-control>) status: active supported media: autoselect 10baseT/UTP <half-duplex> 10baseT/UTP <full-duplex>10baseT/UTP <full-duplex,hw-loopback> 10baseT/UTP <full-duplex flow-control> 100baseT<half-duplex> 100baseTX <full-duplex> 100baseTX <full-duplex,hw-loopback> 100baseTX <full-duplex,flow-control> 1000baseT <full-duplex> 1000baseT <full-duplex,hw-loopback> 1000baseT <full-duplex,flow-control> none vlan: 0 parent interface: <none> bond interfaces: <none>
Tools:netstat
1-bespin-gus-> netstat TCP: IPv4 Local Address Remote Address Swind Send-Q Rwind Recv-Q State -------------------- -------------------- ----- ------ ----- ------ ------bespin.1023 rdlserv.nfsd 26280 0 49640 116 ESTABLISHED bespin.32880 bespin.6015 49152 0 49152 0 ESTABLISHED bespin.32879 bespin.6014 49152 0 49152 0 ESTABLISHED bespin.6014 bespin.32879 49152 0 49152 0 ESTABLISHED bespin.6015 bespin.32880 49152 0 49152 0 CLOSE_WAIT
...
Tools: netstat -s
gus@dirac:4gl $ netstat -s tcp: 794419 packets sent 37468 data packets (22991001 bytes) 51 data packets (11242 bytes) retransmitted 0 resends initiated by MTU discovery 430311 ack-only packets (196294 delayed) 0 URG only packets 0 window probe packets 322074 window update packets 4516 control packets 1308690 packets received 33675 acks (for 22967429 bytes) 2270 duplicate acks 0 acks for unsent data 1248341 packets (1521010141 bytes) received in-sequence 385 completely duplicate packets (343882 bytes) 0 old duplicate packets 41 packets with some dup. data (28512 bytes duped) 33202 out-of-order packets (38094369 bytes) 1 packet (376 bytes) of data after window
36 DB-3: Tips for Database Administrators
2007 Progress Software Corporation
vmstat
vmstat 3 50 procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---r b swpd free buff cache si so bi bo in cs us sy id wa 0 7 3656 226920 16528 5294120 0 0 360 636 281 823 4 4 49 42 0 6 3656 205504 16584 5302288 0 0 2688 903 1066 4675 7 6 11 75 2 0 3656 186088 16584 5310512 0 0 2656 684 1010 4687 6 6 8 80 22 28 3656 165196 16600 5319748 0 0 2887 871 1096 4623 8 6 8 78 0 94 3656 138524 16648 5331008 0 0 3909 815 1292 3455 8 6 6 79 ...
iostat
gus@dirac:gus $ iostat 5 5 disk0 cpu KB/t tps MB/s us sy id 18.07 4 0.07 7 3 90 0.00 0 0.00 2 1 97 0.00 0 0.00 4 1 95 0.00 0 0.00 2 2 96 0.00 0 0.00 3 1 95
Tools:bzip2
$ ls -l tips_for_dbas_00.ppt -rw-r--r-- 1 gus staff 644096 Apr 23 09:18 tips_for_dbas_00.ppt $ bzip2 tips_for_dbas_00.ppt $ ls -l tips_for_dbas_00.ppt.bz2 -rw-r--r-- 1 gus staff 246356 Apr 23 09:18 tips_for_dbas_00.ppt.bz2
http://sourceforge.net/projects/console/
Some useful stuff you can get there: Handle: Who has what files open Process Monitor: Lots of information about processes and disk activity Autorun: what programs get started automatically Regmon: monitors registry activity Tcpview: shows all active TCP and UDP endpoints PsTools: list processes, system info, who is logged on Zoomit: zoom in on parts of screen
Lots more
Tools: Solaris
pldd pfiles List the dynamic libraries linked into each process Report fstat(2) and fcntl(2) information for all open files in each process. print information about the address space of a process get or set the resource limits of running processes print process arguments, environment variables force a defunct process to be reaped by its parent
159191
List top 15 memory consumers svmon -Pt15 | perl -e while(<>){print if($.==2||$&&&!$s++);$.=0 if(/^-+$/)}
Windows scripting
Windows scripting
Windows .bat scripts are brain damaged
Cygwin
provides lots of Unix tools and a shell for Windows. Also SSH server Download from: www.cygwin.com
From Micro$oft, but free Lots of goodies: Korn, C, bash shells, 350 UNIX commands, NFS, NFS gateway, telent, telnetd Download from http://technet.microsoft.com/enus/interopmigration/bb380242.aspx
properties dialog, if service running, click stop. select disabled. click apply close.
Scripting backup
bkupdev="${DB_bkupdir}/${DB_name}.bkup" rm -f ${bkupdev}* 2>&1 # echo "Backing up database $DB_dir/$DB_name to $bkupdev" # $DLC/bin/probkup online $DB_dir/$DB_name ${bkupdev}01 \ -vs 250000 -bf 40 <<EOF ${bkupdev}02 ${bkupdev}03 ... ${bkupdev}12 ${bkupdev}_overflow EOF #
source: PEG, from Jared Middleton
scripting promon
Scripting promon
Set page size, capture list of IO operations by process
$DLC/bin/promon $DBNAME > promon.log \ <<- "EOF" 2> /dev/null R&D 5 1 9999 p 3 2 x EOF
Scripting ai archiving
EXTENT_NAME=`_rfutil $DB_DIR/$DB -C aimage extent full` # EXTENT_DATE=`date +%Y%m%d-%H%M%S` # like this: 20070516-140856 tar -czvf /anotherdisk/aiarchives/$EXTENT_DATE $EXTENT_NAME rfutil $DB_DIR/$DB -C aimage extent empty $EXTENT_NAME
for each _Area, each _Storageobject where (_Storageobject._Area-number = _Area._Area-number), each _File where (_File._File-Number = _Storageobject._Object-number) and (_File._File-Number > 0) break by _File._File-name: display _Area._Area-name _File._File-name. end.
for each _Area, each _Storageobject where (_Storageobject._Area-number = _Area._Area-number), each _File where (_File._File-Number = _Storageobject._Object-number) and (_File._File-Number > 0) break by _File._File-name: display _Area._Area-name _File._File-name. end.
for each _Area, each _Storageobject where (_Storageobject._Area-number = _Area._Area-number), each _File where (_File._File-Number = _Storageobject._Object-number) and (_File._File-Number > 0) and (_StorageObject._Object-type eq 1) break by _File._File-name:
display _Area._Area-name _File._File-name. end.
for each _Area, each _Storageobject where (_Storageobject._Area-number = _Area._Area-number), each _Index where (_Index._Idx-num = _Storageobject._Object-number) and (_StorageObject._Object-type eq 2) : find _File of _Index. if (_File._File-number > 0) then display _Area._Area-name _File._File-name _Index._Index-name. end.
Learn to use vi
vi cheat sheet
protop
Available on PEG: http://www.peg.com/utilities.html Been aroud awhile, but very good Stuff they do:
backup check ai status check db status look for blocked clients more
www.peg.com
Ask questions there
Questions
79 DB-3: Tips for Database Administrators
2007 Progress Software Corporation