1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.

Slides:



Advertisements
Similar presentations
Enhancing Productivity with MySQL 5.6 New Features
Advertisements

1.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Your customer as a segment of one That changes every second! Hein Van Der Merwe Chief.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1.
1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
DEBUGGING IN THE REAL WORLD : Recitation 4.
A Java Architecture for the Internet of Things Noel Poore, Architect Pete St. Pierre, Product Manager Java Platform Group, Internet of Things September.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Track the changes in your Apex application between releases: Yes you can Plsql.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle SQL Developer What’s New in Version 4.1 Jeff Smith
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 2 Hidden Gems of APEX David Gale Software Engineer Oracle Application Express November,
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle SQL Developer For the DBA Jeff Smith
The Safe Harbor The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated.
Reliable MySQL Using Replication Issac Goldstand Mirimar Networks
Passage Three Introduction to Microsoft SQL Server 2000.
QAD .Net UI: New Enhancements
Replication with MySQL 5.1 Ligaya Turmelle Senior Technical Support Engineer - MySQL
Application Express 4.1 New Features Hilary Farrell, Principal Member of Technical Staff, Oracle.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
Introduction and simple using of Oracle Logistics Information System Yaxian Yao
1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8 Reporting from Contract.
Sayed Ahmed Computer Engineering, BUET, Bangladesh MSC, Computer Science, U of Manitoba, Canada
Oracle Application Express 3.0 Joel R. Kallman Software Development Manager.
LSC Segment Database Duncan Brown Caltech LIGO-G Z.
Designing For Testability. Incorporate design features that facilitate testing Include features to: –Support test automation at all levels (unit, integration,
RMB Billing UX Design Concepts / Proposals Peter Picone.
MySQL. Dept. of Computing Science, University of Aberdeen2 In this lecture you will learn The main subsystems in MySQL architecture The different storage.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 1 Quick Tutorial – Part 2 Open Data Web Services for Oracle BPM August, 2013 Forms.
Ideas to Improve SharePoint Usage 4. What are these 4 Ideas? 1. 7 Steps to check SharePoint Health 2. Avoid common Deployment Mistakes 3. Analyze SharePoint.
ITN Wake Tech1 ITN270 Advanced Internet Databases Lecture 15. General MySQL Administration Topics: –Securing a New MySQL Installation –MySQL Server.
1099 Why Use InterBase? Bill Todd The Database Group, Inc.
SQL Tuning made much easier with SQLTXPLAIN (SQLT) Mauro Pagano Senior Principal Technical Support Engineer Oracle Confidential – Internal/Restricted/Highly.
Oracle Data Integrator Procedures, Advanced Workflows.
Quick Tips for Database Performance Tuning Sergey Koltakov Kurt Engeleiter Product Manager.
Analysis of SQL injection prevention using a filtering proxy server By: David Rowe Supervisor: Barry Irwin.
A Brief Documentation.  Provides basic information about connection, server, and client.
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Using Edition-based redefinition with PL/SQL How to deploy database code changes.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
ESRI User Conference 2004 ArcSDE. Some Nuggets Setup Performance Distribution Geodatabase History.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
MySQL Gubbins Richard Sinclair HepSysMan – 11/05/2012.
Workforce Scheduling Release 5.0 for Windows Implementation Overview OWS Development Team.
RESTful Microservices In Java With Jersey Jakub Podlešák Software Engineer Oracle, Application Server Group September 29, 2014 Copyright © 2014, Oracle.
© 2009/2010 Pythian 1 mysqltuner 1.0 Author: Major Hayden Quick sanity check: » Status/system variables » Memory, Architecture, Tables Not all recommendations.
MySQL and GRID status Gabriele Carcassi 9 September 2002.
Performance/Scalability with JDBC, UCP & Oracle Database 12c
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
CMPE 226 Database Systems April 19 Class Meeting Department of Computer Engineering San Jose State University Spring 2016 Instructor: Ron Mak
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 5 Lifehacks for the Apex Development environment Five frameworks you should use.
Slide 1. What's New in NetBeans IDE 7.1 Name Title.
Mastering InnoDB Diagnostics Harrison Fisk Senior Principal Technical Support Engineer.
SQL Database Management
Fundamental of Databases
Welcome POS Synchronize Concept 08 Sept 2015.
DEPTT. OF COMP. SC & APPLICATIONS
JD Edwards EnterpriseOne In-Memory Sales Advisor
The Involuntary DBA Where there is Linux, you most likely will find MySQL or MariaDB. Like it or not, if you're working with Linux, you're a DBA.
1Z0-320 Dumps
Flight Recorder in OpenJDK
OpenWorld 2018 How to Combine Data from Source Sites
Charles Phillips screen
JD Edwards Support and Oracle Cloud Infrastructure: A Successful Path to Oracle Cloud
OpenWorld How to Prepare Data from Business Intelligence Cloud Service
OpenWorld 2018 How to Get Value from Data in Oracle Analytics Cloud
Confidential – Oracle Internal/Restricted/Highly Restricted
Confidential – Oracle Internal/Restricted/Highly Restricted
R11 Product Release Update March 2008
1.
Transactions and Concurrency
Presentation transcript:

1

When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle

3 Part 2. Complex things Crashes Problems repeatable only in production/high load Sandbox Best practices

4 Crashes Symptoms: –«Lost connection to MySQL server» returned to the application –Message in the error log file Check error log file If message contains a query try it using MySQL command line client If crash is repeatable fix the query

5 Crashes If there is no query try general query log: it will contain query unless this was crash during writing to general query log Check backtrace for a clue about what can cause the problem Create core file and analyze it using debugger if needed

6 Backtrace help stack_bottom = 0x450890f0 thread_stack 0x40000 /5.1.39/bin/mysqld(my_print_stacktrace+0x2e)[0x8ac81e] /5.1.39/bin/mysqld(handle_segfault+0x322)[0x5df502] /lib64/libpthread.so.0[0x3429e0dd40] /5.1.39/bin/mysqld(_ZN6String4copyERKS_+0x16)[0x5d9876] /5.1.39/bin/mysqld(_ZN14Item_cache_str5storeEP4Item+0xc9)[0x52dd d9] /5.1.39/bin/mysqld(_ZN26select_singlerow_subselect9send_dataER4Li stI4ItemE+0x45)[0x5ca145]

7 Backtrace help /5.1.39/bin/mysqld[0x6386d1]... Trying to get some variables. Some pointers may be invalid and cause the dump to abort... thd->query at 0x6a39e60 = select 1 from `t1` where `c0` <> (select geometrycollectionfromwkb(`c3`) from `t1`)‏ thd->thread_id=2 thd->killed=NOT_KILLED

8 Crashes If problem is not particular query Analyze other messages in the log If there is a clue fix the problem

9 Too greedy buffers key_buffer_size= read_buffer_size= max_used_connections=17 max_connections=2048 threads_connected=13 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = K K ~= 20G

10 Crashes Check if you allocated reasonable values for buffers Set realistic value of max_connections based on your operating system resources Use monitoring tools of your operating system to find which application use enormous amount of resources which lead to crashes of MySQL server.

11 Production applications Be sure you have error logging turned on In case of a problem check error log first Turn InnoDB Monitoring to on to have information about transactions in error log file Use slow query log to have information about all queries which run slowly Tune time of query considered slow

12 Production applications Once problem query is found try to run it isolated. If needed in test environment. If problem is not repeatable analyze if this is effect of options or concurrency. If problem is options adjust them in such a way so problem is not repeatable

13 Concurrency Analyze if this is effect of locks: –SHOW PROCESSLIST –ENGINE INNODB STATUS –PERFORMANCE_SCHEMA.*_instances tables If yes rewrite application so queries which lock each other don't run concurrently If not try you can enable core files and use kill to create a core or attach debugger to the running process

14 Replication errors IO errors –Check error log first –Check connection and network interface –Try to connect to master using replication credentials All replication SQL errors can be checked using command line client too –They are single threaded, therefore it is usually easy to identify what caused error –SHOW SLAVE STATUS usually contains message about SQL error

15 Replication SQL errors Check error log for a query which caused the problem Check if table definitions are same on both master and slave Check if table on master and slave are synchronised Compare master and slave options. If there are different try these you have on master

16 Replication SQL errors Get query as slave gets it from master binary log mysqlbinlog binlog_name.00000X Use option –verbose to decode row events into SQL statements Analyze how real query would be executed on master

17 Sandbox Create environment same as production server, but which you can freely change and even destroy –Same server version –Same options

18 Sandbox MySQL Sandbox Easiest method to deploy copy of your production environment You just need package of MySQL-version-you-use- ***.tar.gz

19 Sandbox $make_sandbox mysql beta-linux-x86_64-glibc23.tar.gz unpacking /mysql beta-linux-x86_64-glibc23.tar.gz... The MySQL Sandbox, version (C) 2006,2007,2008,2009 Giuseppe Maxia installing with the following parameters: upper_directory = /users/ssmirnova/sandboxes

20 Sandbox sandbox server started Your sandbox server was installed in $HOME/sandboxes/msb_5_4_2

21 Sandbox Load dump of your production database into your sandbox Now you have working copy you can experiment with To dump only part of data: –CREATE TABLE test_problem LIKE problem; –INSERT INTO test_problem SELECT FROM problem WHERE [condition which exists in the original query, but executed properly]

22 Sandbox You also can create «sandbox» database in production server: –CREATE DATABASE sandbox –USE sandbox –CREATE TABLE problem LIKE production.problem –INSERT INTO problem SELECT * FROM production.problem [WHERE...]

23 Sandbox Make sure you don't kill production server if testing in «sandbox» database For scenarios which can kill server use separate MySQL server or, better, physical server

24 Links

25 ?

26 Thank you!

27

28 The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.