Presentation is loading. Please wait.

Presentation is loading. Please wait.

DB-3: Tips for Database Administrators Gus Björklund Wizard, Progress Software Corporation.

Similar presentations


Presentation on theme: "DB-3: Tips for Database Administrators Gus Björklund Wizard, Progress Software Corporation."— Presentation transcript:

1 DB-3: Tips for Database Administrators Gus Björklund Wizard, Progress Software Corporation

2 © 2007 Progress Software Corporation 2 DB-3: Tips for Database Administrators Ask questions as we go if I am not clear about something. Warning: there is a mistake in these slides.

3 © 2007 Progress Software Corporation 3 DB-3: Tips for Database Administrators Topics  Tip Nr. 0x00  …  Tip Nr. 0x16

4 © 2007 Progress Software Corporation 4 DB-3: Tips for Database Administrators Tip Number 0x00 If it is not broken, don’t fix it !

5 © 2007 Progress Software Corporation 5 DB-3: Tips for Database Administrators Tip Number 0x01 If you do fix something, test your fix !

6 © 2007 Progress Software Corporation 6 DB-3: Tips for Database Administrators Tip Number 0x02 Read the man pages

7 © 2007 Progress Software Corporation 7 DB-3: Tips for Database Administrators Read the man pages  man man  man [ -s section ] name  Read the man pages!

8 © 2007 Progress Software Corporation 8 DB-3: Tips for Database Administrators Tip Number 0x03 SSH is your friend! Like Linux, more great stuff from Finland

9 © 2007 Progress Software Corporation 9 DB-3: Tips for Database Administrators SSH  SSH replaces telnet, rlogin, rcp, rsh, etc.  All connections are encrypted  Use for remote access over Internet

10 © 2007 Progress Software Corporation 10 DB-3: Tips for Database Administrators SSH  Don’t need username, password login Can also use certificates for authentication  Can send output of local commands to remote host remote commands to local host  Can do secure file transfer scp and sftp  Can tunnel other protocols (e.g. X windows)

11 © 2007 Progress Software Corporation 11 DB-3: Tips for Database Administrators Simple remote command execution $ ssh bespin ls password: 101arkt 90ajdk.txt GSI Mail News a.out a7 adb.man $ Nothing much to see here

12 © 2007 Progress Software Corporation 12 DB-3: Tips for Database Administrators Remote command output to local host $ ssh bespin "ls; echo DONE” >ls.dat password: $ cat ls.dat 101arkt 90ajdk.txt GSI Mail News a.out a7 adb.man DONE $

13 © 2007 Progress Software Corporation 13 DB-3: Tips for Database Administrators Local output piped to remote host $ cd 4gl; tar -cf - *.p | ssh bespin "cd foo; tar -xf -" password: $

14 © 2007 Progress Software Corporation 14 DB-3: Tips for Database Administrators Remote backup piped to local file $ ssh bespin "cd pdr; tar -cvf -." >backup.tar password: a./ 0K a./Makefile 1K a./pdrcache.c 131K a./pdrproc.c 23K a./pdrtrig.c 175K a./dsmcon.c 94K a./dsmrec.c 17K a./dsmseq.c 15K $

15 © 2007 Progress Software Corporation 15 DB-3: Tips for Database Administrators Turning off sshd password authentication in the file: /etc/ssh/sshd_config, do this: # Protocol 1,2 Protocol 2... # Authentication: PasswordAuthentication no then save changes. restart daemon: # service sshd restart

16 © 2007 Progress Software Corporation 16 DB-3: Tips for Database Administrators Enabling SSH certificate authentication $ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/Users/gus/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/gus/.ssh/id_rsa. Your public key has been saved in /Users/gus/.ssh/id_rsa.pub. The key fingerprint is: 3f:a9:2c:a6:74:5e:36:59:39:7f:ed:3f:5d:e3:a6:ee $ $ ssh-copy-id -i id_rsa $

17 © 2007 Progress Software Corporation 17 DB-3: Tips for Database Administrators Enabling SSH certificate authentication 2 $ cat /Users/gus/.ssh/id_rsa.pub. ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApwswruyeETRbQ/T7ZHdNxtXIC5 J41XpnJwWND4HB3WTuXPLx/Qf2S83Y3VPSgGoc+9YqmLOc/hfs/gQry +TQC9jGIPVYtW/E5PPvhh/HxTIKVc0eYMmpKlxFCjfcv0KyDcAwnd7r/wc zPqw2TpurzZcXfA0c2upqufJZbnweXZtDrcs7bUwdQXskrqDj1EDBxACu H1/omZa2M/PdfFzyrRtbRMeyrfIWAfoL5RNOFsPYYOxWJxfp11tuSF7OiB UQtcbXAfS8cdHsQkJNNzSZqM6B69LvK28mlHZ8m2b5+cXICA27aUyD ZfsSlMLR6rl+Ao3UByL8G+ZQBLUmhMsuRQ== $

18 © 2007 Progress Software Corporation 18 DB-3: Tips for Database Administrators More about SSH

19 © 2007 Progress Software Corporation 19 DB-3: Tips for Database Administrators Tip Number 0x04 Windows can do SSH too

20 © 2007 Progress Software Corporation 20 DB-3: Tips for Database Administrators SSH for Windows Client: use Putty Server: get Cygwin

21 © 2007 Progress Software Corporation 21 DB-3: Tips for Database Administrators Tip Number 0x05 After-image journalling is your friend!

22 © 2007 Progress Software Corporation 22 DB-3: Tips for Database Administrators After Imaging  Do you use after-image journalling? YOU SHOULD  AI records all database changes  Intended for disaster recovery hot standby on another machine

23 © 2007 Progress Software Corporation 23 DB-3: Tips for Database Administrators 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  OpenEdge DBA guide has details

24 © 2007 Progress Software Corporation 24 DB-3: Tips for Database Administrators AI basics 2  A failure occurs and you lose your database …..  Fix the failure replace disk, memory, machine, etc.  Restore the backup copy of your database  Roll forward all ai extents you archived You do know where you put them, don’t you? I hope they weren’t on the failed disk  When roll forward done, start database  Now you are back to where you were

25 © 2007 Progress Software Corporation 25 DB-3: Tips for Database Administrators Tip Number 0x06 Specify scratch space for index rebuild

26 © 2007 Progress Software Corporation 26 DB-3: Tips for Database Administrators Index rebuild scratch space Command line looks like this: proutil dbname -C idxbuild table customer \ -SS dbname.srt -TB 31 -TM 32 -B 1000 Scratch space spec file (dbname.srt) looks like this: 300 /user2/db1/first/ 400 /user3/junk/ 0 /user4/last/ note multiple drives in this example

27 © 2007 Progress Software Corporation 27 DB-3: Tips for Database Administrators Tip Number 0x07 Tools you should know about

28 © 2007 Progress Software Corporation 28 DB-3: Tips for Database Administrators Tools  uptime  find  top  lsof  ifconfig  vmstat  iostat  netstat  bzip2

29 © 2007 Progress Software Corporation 29 DB-3: Tips for Database Administrators Tools: uptime $ uptime 11:26am up 17 day(s), 9:16, 163 users, load average: 3.09, 3.36, 3.76 $

30 © 2007 Progress Software Corporation 30 DB-3: Tips for Database Administrators Tools: top $ top -l 1 Processes: 65 total, 3 running, 62 sleeping 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 M private, 164M shared PhysMem: 161M wired, 758M active, 879M inactive, 1.76G used, 248M free VM: 9.47G + 102M (0) pageins, 16746(0) pageouts PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE 606 top 0.0% 0: K 684K 748K 26.9M 586 bash 0.0% 0: K 1.05M 844K 27.1M 585 login 0.0% 0: K 768K 636K 26.9M 583 Terminal 0.0% 0: M 11.9M 8.93M 364M 563 TextEdit 0.0% 0: M 8.94M 5.80M 355M 558 TeXShop 0.0% 0: M 20.2M 25.6M 365M 467 firefox-bi 0.0% 1: M 29.4M 67.4M 428M

31 © 2007 Progress Software Corporation 31 DB-3: Tips for Database Administrators Tools:find  find files modified more than 30 days ago find. -mtime +30 -print  delete files modified more than 30 days ago find. -mtime +30 -exec rm {} \;  find files bigger than 16k find. -size c -print find. -size +32 -print  delete files bigger than 16k find. -size c -print | xargs -i rm \; Read the man page!

32 © 2007 Progress Software Corporation 32 DB-3: Tips for Database Administrators Tools:lsof _progres bleicher /usr/lib/librt.so.1 _progres bleicher /usr/lib/libsocket.so.1 _progres bleicher /usr/lib/libintl.so.1 _progres bleicher /usr/lib/ld.so.1 _progres bleicher /usr/lib/libdl.so.1... _progres bleicher /tools/solaris/dlc100b/promsgs _progres bleicher /tools/solaris/dlc100b/bin/_progres ftp://vic.cc.purdue.edu/pub/

33 © 2007 Progress Software Corporation 33 DB-3: Tips for Database Administrators Tools:ifconfig 1-bespin-gus-> /usr/sbin/ifconfig -a lo0: flags= mtu 8232 index 1 inet netmask ff ce0: flags= mtu 1500 index 2 inet netmask ffff0000 broadcast

34 © 2007 Progress Software Corporation 34 DB-3: Tips for Database Administrators Tools:ifconfig $ ifconfig en0 en0: flags=8863 mtu 1500 tunnel inet --> inet6 fe80::217:f2ff:fecc:b686%en0 prefixlen 64 scopeid 0x4 inet netmask 0xffff0000 broadcast ether 00:17:f2:cc:b6:86 media: autoselect (1000baseT ) status: active supported media: autoselect 10baseT/UTP 10baseT/UTP 10baseT/UTP 10baseT/UTP 100baseT 100baseTX 100baseTX 100baseTX 1000baseT 1000baseT none vlan: 0 parent interface: bond interfaces:

35 © 2007 Progress Software Corporation 35 DB-3: Tips for Database Administrators Tools:netstat 1-bespin-gus-> netstat TCP: IPv4 Local Address Remote Address Swind Send-Q Rwind Recv-Q State bespin.1023 rdlserv.nfsd ESTABLISHED bespin bespin ESTABLISHED bespin bespin ESTABLISHED bespin.6014 bespin ESTABLISHED bespin.6015 bespin CLOSE_WAIT...

36 © 2007 Progress Software Corporation 36 DB-3: Tips for Database Administrators Tools: netstat -s $ netstat -s tcp: packets sent data packets ( bytes) 51 data packets (11242 bytes) retransmitted 0 resends initiated by MTU discovery ack-only packets ( delayed) 0 URG only packets 0 window probe packets window update packets 4516 control packets packets received acks (for bytes) 2270 duplicate acks 0 acks for unsent data packets ( bytes) received in-sequence 385 completely duplicate packets ( bytes) 0 old duplicate packets 41 packets with some dup. data (28512 bytes duped) out-of-order packets ( bytes) 1 packet (376 bytes) of data after window

37 © 2007 Progress Software Corporation 37 DB-3: Tips for Database Administrators 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

38 © 2007 Progress Software Corporation 38 DB-3: Tips for Database Administrators iostat $ iostat 5 5 disk0 cpu KB/t tps MB/s us sy id

39 © 2007 Progress Software Corporation 39 DB-3: Tips for Database Administrators Tools:bzip2 $ ls -l tips_for_dbas_00.ppt -rw-r--r-- 1 gus staff 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 Apr 23 09:18 tips_for_dbas_00.ppt.bz2

40 © 2007 Progress Software Corporation 40 DB-3: Tips for Database Administrators Tools: Windows tabbed console

41 © 2007 Progress Software Corporation 41 DB-3: Tips for Database Administrators Tools: windows tabbed console

42 © 2007 Progress Software Corporation 42 DB-3: Tips for Database Administrators Tools: More Windoze Stuff 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

43 © 2007 Progress Software Corporation 43 DB-3: Tips for Database Administrators Tools: Still More Windoze Stuff

44 © 2007 Progress Software Corporation 44 DB-3: Tips for Database Administrators Tools: Solaris plddList the dynamic libraries linked into each process pfilesReport fstat(2) and fcntl(2) information for all open files in each process. pmap print information about the address space of a process plimitget or set the resource limits of running processes pargsprint process arguments, environment variables preapforce a defunct process to be reaped by its parent pkginfolist what packages are installed

45 © 2007 Progress Software Corporation 45 DB-3: Tips for Database Administrators Tools: AIX svmon svmon -G -I size inuse free pin virtual memory pg space work pers clnt pin in use PageSize PoolSize inuse pgsp pin virtual s 4 KB L 16 MB List top 15 memory consumers svmon -Pt15 | perl -e ’while(<>){print if($.==2||$&&&!$s++);$.=0 if(/^-+$/)}’

46 © 2007 Progress Software Corporation 46 DB-3: Tips for Database Administrators Tools: AIX vmstat vmstat -v memory pages lruable pages free pages 1 memory pools pinned pages 80.1 maxpin percentage 20.0 minperm percentage 80.0 maxperm percentage 36.1 numperm percentage file pages... Use vmo command to adjust minperm, maxperm, numperm as needed

47 © 2007 Progress Software Corporation 47 DB-3: Tips for Database Administrators Tip Number 0x08 Windows scripting

48 © 2007 Progress Software Corporation 48 DB-3: Tips for Database Administrators Windows scripting  Cygwin provides lots of Unix tools and a shell for Windows. Also SSH server Download from:  Windows Services for UNIX Version 3.5 From Micro$oft, but free Lots of goodies: Korn, C, bash shells, 350 UNIX commands, NFS, NFS gateway, telent, telnetd Download from us/interopmigration/bb aspx Windows.bat scripts are brain damaged

49 © 2007 Progress Software Corporation 49 DB-3: Tips for Database Administrators Tip Number 0x09 how to turn off Windows indexing service

50 © 2007 Progress Software Corporation 50 DB-3: Tips for Database Administrators Stop Windows indexing service  Go to the Start menu, pick run. Type services.msc, click OK. Services dialog will show.  Right-click on indexing service to show properties dialog,  if service running, click stop.  select disabled.  click apply  close.

51 © 2007 Progress Software Corporation 51 DB-3: Tips for Database Administrators Tip Number 0x0a creating Windows services

52 © 2007 Progress Software Corporation 52 DB-3: Tips for Database Administrators User SRVANY to run Windows Services  Lets you create “user defined” Windows services  Instructions and download from  Warning: This is not for n00bs. Study before using Read

53 © 2007 Progress Software Corporation 53 DB-3: Tips for Database Administrators Tip Number 0x0b How to telnet to Windows

54 © 2007 Progress Software Corporation 54 DB-3: Tips for Database Administrators Enable Windows telnet login by name/passwd  NTLM authentication by default  To fix: run TLNTADMN take menu pick no 3 (display/change …) pick 7 (NTLM) set value to 1 take menu pick no 4 (restart service)  BUT: don’t use telnet

55 © 2007 Progress Software Corporation 55 DB-3: Tips for Database Administrators Tip Number 0x0c scripting Progress backup

56 © 2007 Progress Software Corporation 56 DB-3: Tips for Database Administrators 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 bf 40 <

57 © 2007 Progress Software Corporation 57 DB-3: Tips for Database Administrators Tip Number 0x0d scripting promon

58 © 2007 Progress Software Corporation 58 DB-3: Tips for Database Administrators Scripting promon $DLC/bin/promon $DBNAME > promon.log \ /dev/null R&D p 3 2 x EOF Set page size, capture list of IO operations by process

59 © 2007 Progress Software Corporation 59 DB-3: Tips for Database Administrators Tip Number 0x0e scripting after imaging

60 © 2007 Progress Software Corporation 60 DB-3: Tips for Database Administrators Scripting ai archiving EXTENT_NAME=`_rfutil $DB_DIR/$DB -C aimage extent full` # EXTENT_DATE=`date +%Y%m%d-%H%M%S` # like this: tar -czvf /anotherdisk/aiarchives/$EXTENT_DATE $EXTENT_NAME rfutil $DB_DIR/$DB -C aimage extent empty $EXTENT_NAME

61 © 2007 Progress Software Corporation 61 DB-3: Tips for Database Administrators Tip Number 0x0f How much space is being used by storage areas?

62 © 2007 Progress Software Corporation 62 DB-3: Tips for Database Administrators How much space is being used? for each _AreaStatus where ( not _AreaStatus-Areaname matches "*After Image Area*" ) no-lock: display _AreaStatus-Areanum format ">>>" column-label "Num" _AreaStatus-Areaname format "x(20)" column-label "Area Name" _AreaStatus-Totblocks column-label "Tot blocks" _AreaStatus-Hiwater column-label "High water mark" _AreaStatus-Hiwater / _AreaStatus-Totblocks * 100 column-label "% use" _AreaStatus-Extents format ">>>" column-label "Num Extents". end. from PEG: Dmitri Levin

63 © 2007 Progress Software Corporation 63 DB-3: Tips for Database Administrators Tip Number 0x10 List tables by storage area

64 © 2007 Progress Software Corporation 64 DB-3: Tips for Database Administrators List tables by storage area 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.

65 © 2007 Progress Software Corporation 65 DB-3: Tips for Database Administrators Listing of tables by storage area Area-name File-Name Schema Area agedar Schema Area customer Schema Area item Schema Area monthly

66 © 2007 Progress Software Corporation 66 DB-3: Tips for Database Administrators List tables by storage area 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.

67 © 2007 Progress Software Corporation 67 DB-3: Tips for Database Administrators List tables by storage area 2 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.

68 © 2007 Progress Software Corporation 68 DB-3: Tips for Database Administrators Tip Number 0x11 List indices by storage area and table

69 © 2007 Progress Software Corporation 69 DB-3: Tips for Database Administrators List indexes by storage area and table 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.

70 © 2007 Progress Software Corporation 70 DB-3: Tips for Database Administrators Tip Number 0x12 Learn to use vi

71 © 2007 Progress Software Corporation 71 DB-3: Tips for Database Administrators vi cheat sheet

72 © 2007 Progress Software Corporation 72 DB-3: Tips for Database Administrators Tip Number 0x13 Tom Bascom’s protop

73 © 2007 Progress Software Corporation 73 DB-3: Tips for Database Administrators protop  Tom Bascom’s Open Source Progress 4GL VST based performance monitoring program  Displays tons of useful information  Study source code to learn how it is done  Download from

74 © 2007 Progress Software Corporation 74 DB-3: Tips for Database Administrators Tip Number 0x14 Adam Backman’s DBA scripts

75 © 2007 Progress Software Corporation 75 DB-3: Tips for Database Administrators Adam Backman’s dba scripts  Available on PEG:  Been aroud awhile, but very good  Stuff they do: backup check ai status check db status look for blocked clients more …  Study code to learn how it is done

76 © 2007 Progress Software Corporation 76 DB-3: Tips for Database Administrators Tip Number 0x15 Where to get more tips

77 © 2007 Progress Software Corporation 77 DB-3: Tips for Database Administrators Where to learn more  OpenEdge Database Administration Guide  PSDN:  Classes (not the only ones) Bravepoint: bravepoint.com White Star Software: wss.com Progress DBA classes  PSC Tech Support Knowledge Center

78 © 2007 Progress Software Corporation 78 DB-3: Tips for Database Administrators Tip Number 0x16 Join the PEG Ask questions there

79 © 2007 Progress Software Corporation 79 DB-3: Tips for Database Administrators Questions


Download ppt "DB-3: Tips for Database Administrators Gus Björklund Wizard, Progress Software Corporation."

Similar presentations


Ads by Google