Oracle性能优化 之 游标及SQL
Oracle性能优化 之 游标及SQL,这些SQL语句严格来说是无法共享游标(也就是共享执行计划)的,但是这些语句所需要执行计划其实都
一、游标
我们要先说一下游标这个概念。
从Oracle数据库管理员的角度上说,游标是对存储在库缓存中的可执行对象的统称。SQL语句是存储在库缓存中的,它是游标。除了它之外,还有Oracle的存储过程也是存储在库缓存中的可执行对象,从Oracle DBA的角度上说,它也是游标。Oracle也把它算为游标,在某些和游标相关的视图中,也会显示存储过程的一些信息的。但从开发者的角度说,只有SQL语句才是游标。
二、关于游标的视图
你的应用程序或许是用Java、Pro*C等语言开发的,也可能有中件间,等等,对于DBA来说,我们不必过多的关心这些。以一个常见的三层应用为例, 如下图:
类似的图我们在很多地方都可以看到,假设这是一个三层J2EE应用。客户端调用的Java应用程序存放在中间的应用服务器层,应用程序的执行由应用服务器负责。
如上图这段Java应用程序,它的执行就是应用应用服务器的任务。但是,当执行到executeQuery ("select * from Test")语句时,这条Java语句要求从数据库服务器中查询表Test。发下图:
这条语句的执行,是由数据库服务器负责的。数据库服务器只负责以最快的速度将“Select * from test”执行完毕。其他的它一概不负责。我们作为DBA,只要保证SQL语句可以更快的执行就行了,至于应用程序逻辑方面的问题,不由我们负责。也就是说,作为DBA,我们不必负责具体代码的问题,我们只负责SQL语句的执行。每条送交Oracle执行的SQL语句,无论这条语句是你手动在SQL*Plus命令窗口中敲入的,还是应用服务器传送给Oracle要求执行的,它们都以一样的方式被传递到Oracle中,由服务器进程执行。这些SQL语句的执行情况、具体的执行计划等数据资料会在一些视图中被记录下来,以供DBA追踪问题、调优SQL的执行。

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]
