转载请注明出处 :http://blog.csdn.net/guoyjoe/article/details/18456937 1、查出当前会话所对应的系统进程号:SPID=7376,如下语句(在第一个窗口执行) gyj@OCM select spid from v$session s,v$process p where s.paddr=p.addr and sid in(select disti
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/18456937
1、查出当前会话所对应的系统进程号:SPID=7376,如下语句(在第一个窗口执行)
gyj@OCM> select spid from v$session s,v$process p where s.paddr=p.addr and sid in(select distinct sid from v$mystat); SPID ------------------------ 7376
[oracle@mydb ~]$ gdb $ORACLE_HOME/bin/oracle 7376 GNU gdb Fedora (6.8-27.el5) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu"... (no debugging symbols found) Attaching to program: /u01/app/oracle/product/11.2.0/bin/oracle, process 7376 Reading symbols from /u01/app/oracle/product/11.2.0/lib/libodm11.so...(no debugging symbols found)...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libodm11.so Reading symbols from /u01/app/oracle/product/11.2.0/lib/libcell11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libcell11.so Reading symbols from /u01/app/oracle/product/11.2.0/lib/libskgxp11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libskgxp11.so Reading symbols from /lib64/librt.so.1...done. Loaded symbols for /lib64/librt.so.1 Reading symbols from /u01/app/oracle/product/11.2.0/lib/libnnz11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libnnz11.so Reading symbols from /u01/app/oracle/product/11.2.0/lib/libclsra11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libclsra11.so Reading symbols from /u01/app/oracle/product/11.2.0/lib/libdbcfg11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libdbcfg11.so Reading symbols from /u01/app/oracle/product/11.2.0/lib/libhasgen11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libhasgen11.so Reading symbols from /u01/app/oracle/product/11.2.0/lib/libskgxn2.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libskgxn2.so Reading symbols from /u01/app/oracle/product/11.2.0/lib/libocr11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libocr11.so Reading symbols from /u01/app/oracle/product/11.2.0/lib/libocrb11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libocrb11.so Reading symbols from /u01/app/oracle/product/11.2.0/lib/libocrutl11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libocrutl11.so Reading symbols from /usr/lib64/libaio.so.1...done. Loaded symbols for /usr/lib64/libaio.so.1 Reading symbols from /lib64/libdl.so.2...done. Loaded symbols for /lib64/libdl.so.2 Reading symbols from /lib64/libm.so.6...done. Loaded symbols for /lib64/libm.so.6 Reading symbols from /lib64/libpthread.so.0...done. [Thread debugging using libthread_db enabled] [New Thread 0x2b0b8fef0910 (LWP 7376)] Loaded symbols for /lib64/libpthread.so.0 Reading symbols from /lib64/libnsl.so.1...done. Loaded symbols for /lib64/libnsl.so.1 Reading symbols from /lib64/libc.so.6...done. Loaded symbols for /lib64/libc.so.6 Reading symbols from /lib64/ld-linux-x86-64.so.2...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 Reading symbols from /usr/lib64/libnuma.so.1...done. Loaded symbols for /usr/lib64/libnuma.so.1 Reading symbols from /lib64/libnss_files.so.2...done. Loaded symbols for /lib64/libnss_files.so.2 Reading symbols from /u01/app/oracle/product/11.2.0/lib/libnque11.so...done. Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libnque11.so 0x0000003f0d40d290 in __read_nocancel () from /lib64/libpthread.so.0 (gdb)
3、设一个断点,持有第一个Latch锁(预先知道函数kslgetl就是持有Latch的函数),并运行(c命令,即continue)(在第二个窗口执行)
(gdb) b kslgetl Breakpoint 1 at 0x8f96376 (gdb) c Continuing.
4、执行一个update语句,触发断点的操作,此时update被阻塞了(在第一个窗口执行)
gyj@OCM> update gyj_test set name='AAAAA' where id=1;
5、一执行updater操作,断点就停在这儿了(在第二个窗口执行)
Breakpoint 1, 0x0000000008f96376 in kslgetl () (gdb)
6、我们先来看update时持有第一个Latch锁所对应函数kslgetl ()的第一个参数是什么?用命令info all-register显示寄存器(在第二个窗口执行)
(gdb) info all-register rax 0x0 0 rbx 0x2000 8192 rcx 0xf27 3879 rdx 0x0 0 rsi 0x1 1 rdi 0x601082f0 1611694832 rbp 0x7fff1c5754d0 0x7fff1c5754d0 rsp 0x7fff1c5754d0 0x7fff1c5754d0 r8 0xf27 3879 r9 0xbaf3fa0 196034464 r10 0x0 0 r11 0xf27 3879 r12 0x927db800 2457712640 r13 0x601082f0 1611694832 r14 0x1 1 r15 0x1 1 rip 0x8f96376 0x8f96376 <kslgetl+4> eflags 0x246 [ PF ZF IF ] cs 0x33 51 ss 0x2b 43 ds 0x0 0 es 0x0 0 fs 0x0 0 gs 0x0 0 st0 0 (raw 0x00000000000000000000) ---Type <return> to continue, or q <return> to quit--- st1 0 (raw 0x00000000000000000000) st2 0 (raw 0x00000000000000000000) st3 0 (raw 0x00000000000000000000) st4 0 (raw 0x00000000000000000000) st5 0 (raw 0x00000000000000000000) st6 333296 (raw 0x4011a2be000000000000) st7 300384 (raw 0x401192ac000000000000) fctrl 0x27f 639 fstat 0x0 0 ftag 0xffff 65535 fiseg 0x0 0 fioff 0x9394e95 154750613 foseg 0x7fff 32767 fooff 0x1c573f50 475479888 fop 0x0 0 xmm0 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm1 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm2 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm3 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x8000000000000000, 0x8000000000000000}, v16_int8 = {0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, v8_int16 = {0xfffe, 0xffff, 0xffff, 0xffff, 0xfffe, 0xffff, 0xffff, 0xffff}, v4_int32 = {0xfffffffe, 0xffffffff, 0xfffffffe, 0xffffffff}, v2_int64 = {0xfffffffffffffffe, 0xfffffffffffffffe}, uint128 = 0xfffffffffffffffefffffffffffffffe} ---Type <return> to continue, or q <return> to quit--- xmm4 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm5 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x32, 0xa3, 0xd7, 0x2, 0x0 <repeats 12 times>}, v8_int16 = {0xa332, 0x2d7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x2d7a332, 0x0, 0x0, 0x0}, v2_int64 = {0x2d7a332, 0x0}, uint128 = 0x00000000000000000000000002d7a332} xmm6 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm7 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0xda, 0x87, 0xd7, 0x2, 0x0 <repeats 12 times>}, v8_int16 = {0x87da, 0x2d7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x2d787da, 0x0, 0x0, 0x0}, v2_int64 = {0x2d787da, 0x0}, uint128 = 0x00000000000000000000000002d787da} xmm8 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm9 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm10 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm11 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm12 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x18, 0xe, 0x73, 0x90, 0xb, 0x2b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xe18, 0x9073, 0x2b0b, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x90730e18, 0x2b0b, 0x0, 0x0}, v2_int64 = {0x2b0b90730e18, 0x0}, uint128 = 0x000000000000000000002b0b90730e18} xmm13 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} xmm14 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} ---Type <return> to continue, or q <return> to quit--- xmm15 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000} mxcsr 0x1fa1 [ IE PE IM DM ZM OM UM PM ] (gdb)
7、rdi/edi是第一个参数, rsi/esi是第二个参数,贴出info all-register命令所显示函数kslgetl ()的两个参数,如下
8、找到第一个参数0x601082f0,注意因我的OS是64位,前面要补8个0,在v$latch_children视图中地址的字母要大写,
sys@OCM> select name from v$latch_children where addr='00000000601082F0'; NAME ---------------------------------------------------------------- shared pool
10、发现Latch锁就是shared pool Latch。

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment