448d134078ed4404f99ce108b7143ef6.ppt
- Количество слайдов: 45
Root Cause and Other DBA Urban Legends Brian Hitchcock OCP 10 g DBA Sun Microsystems brian. hitchcock@sun. com brhora@aol. com www. brianhitchcock. net Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 1
For DBA Issues Ÿ I'm told that I must find root cause, – Can't resolve the issue without root cause Ÿ Must have testing environment that is – – Similar enough to production to recreate the issue And the fix Ÿ Need extensive expertise to solve performance issues – – – 10046 trace Wait events Extents size/number Physical spindles Rebuilding indexes Undocumented init parameters Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 2
What is My Experience Ÿ Centralized DBA support team Ÿ 2000+ databases Ÿ Database users open cases with DBA team Ÿ Cases randomly assigned to DBAs – – Not assigned based on experience or expertise My cases are probably typical of all the cases Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 3
My Experience Ÿ Finding root cause costs money Ÿ Building and maintaining test system(s) costs money Ÿ Test system – – – Needs to be able to recreate production issue Database, network, apps and web servers, load balancers Users around the world Ÿ Root cause and test system(s) are only worthwhile – If having them is less expensive than not having them. Ÿ Perhaps these are Urban Legends? – – – Root cause Test system(s) Specific expertise required Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 4
My Experiences Ÿ Review major cases I worked on over the last 2 years – Cases are presented in chronological order, oldest first Ÿ For each case – – What worked, i. e. what was the real world solution? Was root cause identified? Was a test system available to verify root cause Ÿ and the solution? What extensive expertise was required? Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 5
Keeping Score Ÿ For each case, look for 3 things – – – Root cause Test system(s) Specific expertise Ÿ Listed earlier (10046, wait events, extents, etc. ) – Were any of the following useful in resolving the issue? Ÿ Open Mind (anything can and will happen) Ÿ Communication (it's difficult) Ÿ Simple solutions Any active db users? Reboot one or more components? Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 6
Case 1 – CRM Local Language Ÿ Moved to UTF 8, add local language columns Ÿ SQL ran slower Ÿ 10046 trace, explain plan Ÿ Found the single step slowing execution Ÿ Existing index wasn’t updated to have new local language column Ÿ Recreated index – Performance returned to normal Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 7
Case 1 – Three Things Ÿ Root cause – – Existing indexes not optimal for new schema Corrected indexes fixed the problem Ÿ Test system identified the issue Ÿ Specific Expertise – – – 10046 Explain plan Indexes Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 8
Case 2 – Storefront Slow Ÿ Ÿ Ÿ App support team reports database slow Check database, 1 3 active users at most Active users gone in 1 2 seconds App users report 30 second response time Have App support person use app – Watch database Ÿ See single active user connect, complete, disconnect – 2 seconds maximum Ÿ Remainder of response time – Web servers, load balancers etc. Ÿ Application server was locked up – reboot fixed it Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 9
Case 2 – Three Things Ÿ Root cause – Not identified Ÿ Test Environment – – – Exists, but not even close to production Complex production application environment Accurate test environment Ÿ Expensive to build and maintain – – Hard to find qualified testers No one completely understands how production was built Ÿ Impact of layoffs, outsourcing Ÿ Hard to recreate what you don’t understand Ÿ No specific expertise required Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 10
Case 3 – Contracts Slow Ÿ App users report message – ‘Problem contacting the database: No available resource…’ Ÿ Sar shows CPU 90% idle Ÿ Statspack snapshot for last hour shows top wait events – – 70% CPU time 20% db file read Ÿ App server rebooted, performance returns to normal Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 11
Case 3 – Three Things Ÿ Root cause unknown – How to determine what caused the app server to hang? Ÿ Test system does not have all the components of prod – – Don’t know why production locked up Tough to reproduce in test system Ÿ Simple solutions – no specific expertise required – – Reboot app server Low risk, cheap, quick No special experience required If it doesn’t work, time to put more resources into the issue Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 12
Case 4 – Storefront Ÿ Ÿ Ÿ Users report app hanging Few or no active users in database Active users taking much longer than normal Isolate single SQL statement that is running slow Explain plans show good/bad execution plans – Changes from good to bad at random times Ÿ Various attempts to isolate give conflicting results – We assume that the problem is stable, it isn’t Ÿ 10053 trace, watch optimizer choose execution plan Ÿ Optimizer changes from good to bad plan – one column of one table has 2 versus 3 distinct values Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 13
Case 4 – Three Things Ÿ Root cause – not sure… Ÿ App developers gone (outsourced) – – – No one knows how code really works Why are these values appearing and disappearing? App is inserting/deleting the rows with the 3 rd distinct value This change causes optimizer to choose bad plan Bug or feature? Ÿ Fix? – Create rows so column always has 3 distinct values Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 14
Case 4 – Three Things (cont’d) Ÿ No test system – – Test system has small percentage of production data App system too complex to reproduce Ÿ Multiple strings, load balancers, app servers Ÿ Hardware, support, upgrades, patches Ÿ Difficult to get testing resources – people are expensive – – Changes are tested for functionality Changes aren’t tested for performance Ÿ Until released in production Ÿ Specific expertise – – Explain plan 10053 trace Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 15
Case 5 – Customer Demo Ÿ Users report slow performance Ÿ Database shows 4 inactive sessions Ÿ Inactive sessions holding locks Ÿ Kill these 4 sessions – Performance is fine Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 16
Case 5 – Three Things Ÿ Root cause – unknown – – Why some sessions inactive and holding locks? App developers gone Easier to kill sessions once in a while Real root cause would be expensive to find Ÿ Test system – – Don’t have test system – app developed on the cheap Don’t know how app works Ÿ No specific expertise required – Kill database sessions Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 17
Case 6 – Executive Dashboard Ÿ User reports database is sorting dates incorrectly – Phone on mute – laugh Ÿ Users have really good drugs today! Ÿ Connect to db – Verify that indeed dates are being sorted backwards Ÿ From NLS experience, look at actual bytes of dates – – There are extra bytes that I can’t explain Go back to the docs for DATE type Expand DATE format to include all the possible fields Suddenly it all makes sense! Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 18
Case 6 – What’s the Story? Ÿ The dates are being correctly sorted – because – They are from BC! Ÿ OK, now what? – – This is sales data from Fred Flintstone? Is Barney setting up his own IT department? Ÿ Check the basics – – App code uses 10 g JDBC Ÿ User says this was a requirement But the database is 9 i – it just gets better and better Ÿ User finds Metalink note – – 10 g JDBC issues with 9 i database Doesn’t describe our issue, but it’s a start… Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 19
Case 6 – What to Do? Ÿ Setup a 10 g database and test the app code against it – – – No test system, in fact, no other system of any kind Critical executive reporting system, can’t be down for long Very limited disk space Ÿ Why not upgrade existing 9 i database? – – Upgrades can cause problems If this isn’t a 10 g to 9 i issue, why risk the db upgrade? Ÿ Install 10 g db, full export 9 i db, import into 10 g db Ÿ User tests app code against 10 g database – No more dates from BC! Ÿ Remove 9 i database, expand 10 g database to match Ÿ User happy – Executive’s reports don’t show sales to the Flintstones Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 20
Case 6 – Three Things Ÿ Root cause – Not clear Ÿ Tried 10 g database and issue went away Ÿ Did we really identify the root cause? Ÿ Was it a feature of 10 g JDBC? A bug? Ÿ Test system – None Ÿ Expertise required – – Minimal configuration control would have prevented this Hardest part was accepting what Oracle was telling us Ÿ Dates from BC – Not at all the way things are supposed to be Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 21
Case 7 – Customer Demo Ÿ Users calls, application is slow Ÿ Blocking processes, restart database twice in one day – App still slow Ÿ Ask user to connect and start using app – – – I watch database for active users Over 20 seconds before new db user appears Db user is done and gone in less than a second User reports 30 seconds before results appear in browser I tried ping between the db server and the app server Ÿ 200 ms with packet loss Ÿ Ask network group to investigate Network switch in data center has failed Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 22
Case 7 – Three Things Ÿ Root cause – – Network switch – no question This was not a database problem Ÿ But we could have wasted a lot of time with SQL tracing etc. Ÿ Need to confirm that the database is the problem – Then work the issue as a db tuning issue Ÿ No test system available – How would you reproduce the data center network? Ÿ Expertise required – – Look for active users in database ping between db and app server Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 23
Case 8 – Data Warehouse Ÿ User reports application slow – – User can’t truncate a table – command hangs Loading data into warehouse is also hanging Ÿ Watch database while user starts load process Ÿ During load – – User is using third party app to do the load No active users performing inserts Ÿ When no load is happening – Truncate table runs quickly Ÿ User contacts app vendor – – Vendor “changes some parameters for the load process” Data load runs normally, truncate table runs normally Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 24
Case 8 – Three Things Ÿ Root cause – – Looking at the db showed no active inserts during data load Needed to verify that db wasn’t the issue Ÿ Force vendor to perform Ÿ Test system – – This was a dev database so there was a ‘test’ system Data load issues identified, resolved in dev environment Ÿ Expertise required – – – Quickly check for database problems Communicate with user to understand what is happening Politics – dealing with vendor Ÿ Vendor really, really wants it to be a database problem Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 25
Case 9 – Software Registry Ÿ User trying to truncate table – Part of a data feed process Ÿ Other users in database – Performing deletes on same table Ÿ Blocking truncate Ÿ Kill delete processes – Truncate still blocked Ÿ Watch database processes – Delete process starts every hour on the hour Ÿ Cron job starts delete hourly – – Part of data feed process Why don’t the app owners know this? Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 26
Case 9 – Three Things Ÿ Root cause – – Unknown Why was cron in place that user didn’t know about? Ÿ Test system – exists – But doesn’t have the production data feeds Ÿ Expertise required – – – None – basic DBA skills Not a database performance issue Basic app configuration was the issue Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 27
Case 10 – CRM Reporting Ÿ Ÿ Ÿ Ÿ User reports app is too slow Specific selects are taking 10 15 seconds STATSPACK snapshots are being taken Check snapshots over same time for last week Performance of the top SQL hasn’t changed User agrees that performance hasn’t changed Resources not available to make performance better When is a performance problem not a problem? – When you don’t want to pay to fix it Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 28
Case 10 – Three Things Ÿ Root cause – User perception Ÿ Test system – None Ÿ Expertise required – – Document that performance hasn’t changed Offer to work the issue if user will get funding Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 29
Case 11 – Configurator Ÿ Users getting error – Can’t allocate memory in shared pool Ÿ What is causing this? Ÿ Spend some time looking at the database – Looks normal Ÿ Reboot database to clear shared pool Ÿ Watch database after restart – Shared pool doesn’t fill up Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 30
Case 11 – Three Things Ÿ Root cause – Don’t know why shared pool fills up Ÿ Test system – How to recreate problem in test system? Ÿ Expertise needed – – Basic DBA skills Flush shared pool Ÿ Problem didn’t reoccur – One time or infrequent set of circumstances Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 31
Case 12 – Pricing Database Ÿ User reports slow performance Ÿ Check database server – – CPU and iowait very high Watch SQL executing Explain plan for worst SQL shows full table scans No indexes on tables being scanned Ÿ Test server – Same tables do have indexes Ÿ While recreating indexes – All the needed indexes reappear Ÿ Cron job for pricing data runs every two weeks – Rebuilds indexes and loads data Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 32
Case 12 – Three Things Ÿ Root cause – What caused indexes to be dropped? Ÿ Unknown Ÿ Test system – – Used to verify that indexes were missing Can’t reproduce whatever dropped the indexes Ÿ Expertise required – Basic DBA skills Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 33
Case 13 – Contracts Database Ÿ User reports error when selecting from table – Invalid row id Ÿ Some queries on same table don’t report error Ÿ Looking at table and row ids – – Some queries use index Ÿ No errors Other queries use table Ÿ Specific rows have invalid row ids Ÿ Rebuild table – Create table as select * from <table> Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 34
Case 13 – Three Things Ÿ Root cause – Why did row ids become invalid? Ÿ Unknown Ÿ Test system – Exists, can’t reproduce cause of invalid row ids Ÿ Expertise required – Basic DBA skills Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 35
Case 14 – Software Download Ÿ User reports application slow in Dev environment – – SQL so slow, application server times out Sar shows CPU near 0% idle Ÿ User executes problem SQL – – – Watch database SQL completes, very slowly, database is working Explain plan shows full table scans Ÿ Look at tables involved – – Production – last analyzed NULL, indexes, runs fast Test – recently analyzed, indexes, runs slow Ÿ Drop stats, rebuild indexes, reanalyze – Performance returns to normal Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 36
Case 14 – Three Things Ÿ Root cause – – What happened to indexes, statistics in production? Unknown Ÿ Test system – – – Exists Doesn’t match production – which is correct? Can’t reproduce dropped indexes and/or statistics Ÿ Expertise required – Basic DBA skills Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 37
Case 15 – BRIO Ÿ User reports SQL failing with error – Can’t allocate memory in shared pool Ÿ Watch database – – Same SQL runs most of the time Error occurs once in a while Ÿ Solutions – – Reduce sort area size Ÿ Free up more memory for shared pool Increase physical memory assigned to database Ÿ Error occurred so infrequently – Users decided not to change system Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 38
Case 15 – Three Things Ÿ Root cause – – Unknown Just too many users for a brief time? Ÿ Test system – Yes, but how to reproduce this issue (user load)? Ÿ Expertise required – Basic DBA skills Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 39
Case 16 – Revenue App Ÿ Automated alert – – Report log switching hung Database stopped for transactions Ÿ Examine database – Can’t find anything wrong Ÿ Restart database – – – Log switch works No further alerts No user problems Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 40
Case 16 – Three Things Ÿ Root Cause – Unknown Ÿ Test system – Exists, but no help Ÿ Expertise required – Basic DBA skills Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 41
Scoreboard Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 42
Observations Ÿ How many times did we – – – Identify root cause? Have a complete test system? Need specific expertise? Ÿ Un scientific results – – – Root cause – 2 out of 16 = 13% Test system – 3 out of 16 = 19% Specific expertise – indexes 1/16 = 6% Ÿ Simple solutions worked 94% of the time Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 43
Conclusions Ÿ Brian’s off his meds – Ignore him – this isn’t typical Ÿ Urban legends? – – – You don’t have to find root cause You don’t have to have a complete test environment You don’t need extensive expertise in specific DBA areas Ÿ You do need – – – DBA experience Open mind – strange stuff happens all the time Communication skills – you don’t know what’s happening Ÿ Looking at training resources – – Why become more expert at things that are rarely needed? Why not become familiar with things you know little about? Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 44
Opinion Ÿ Specific expertise can be obtained when needed Ÿ Based on the results shown – – 94% of the time, don’t need expertise to be productive 15 of 16 cases solved with general DBA skills Ÿ Some expertise can be automated or outsourced – Tracing, wait events Ÿ Focus on skills that can’t be put into a GUI – – Communication Ability to solve problems, not just database issues Sun. Fed DBA Brian Hitchcock October 19, 2006 Page 45
448d134078ed4404f99ce108b7143ef6.ppt