- 浏览: 60864 次
- 性别:
- 来自: 深圳
文章分类
最新评论
使用方法:
Execution Environment:
SQL*Plus
Access Privileges:
Requires to access some V$ dynamic views. If used on an Apps instance, connect as APPS.
In general, connect into SQL*Plus as main application schema owner, or as SYSTEM.
If application schema owner (APPS or any other) does not have access to data dictionary
dynamic views, use included script SQLAGRNT.SQL to grant access to required views.
Usage:
sqlplus apps/<pwd>
SQL>START SQLAREAT;
Instructions:
1. Unzip file SQLA.zip into dedicated directory on db server preserving case
on all scripts (UPPER CASE). Example: SQLAREAT.SQL
2. If you are using script SQLAREAT.SQL for the first time, connect as main
application user (APPS if using Oracle Apps) and execute:
# sqlplus apps/<pwd>
SQL> START SQLACREA.SQL;
This step creates a staging repository that is used by SQLAREAT.SQL
If not sure if the staging repository has been created or not, simply
execute SQLACREA.SQL and it will re-create it.
If you get PLS-00201 errors, execute SQLAGRNT.SQL as SYSTEM, SYS or
INTERNAL
3. Once the staging repository is created, execute:
# sqlplus apps/<pwd>
SQL> START SQLAREAT.SQL;
4. SQLAREAT.SQL creates an HTML spool file with most expensive SQL.
Execute this script manually or within a cron job. Suggested frequency
is every 15 minutes during peak time (high system load window).
5. If SQLAREAT.SQL is used over a period of time (i.e. peak hours), use
included SQLAREAR.SQL to extract most expensive SQL observed during a
range of snapshots captured previously by SQLAREAT.SQL:
# sqlplus apps/<pwd>
SQL> START SQLAREAR.SQL <p_process_type> <p_snap_id_from> <p_snap_id_to>;
SQL> START SQLAREAR.SQL LR 1 4;
Where p_process_type is LR for logical reads or PR for physical reads
6. In addition to SQLAREAT.SQL and SQLAREAR.SQL, use the SQLAREAS.SQL to
report additional statistics.
# sqlplus apps/<pwd>
SQL> START SQLAREAS.SQL;
7. If you need to uninstall this tool, execute commands below and remove
scripts SQLA* from dedicated directory
# sqlplus apps/<pwd>
SQL> START SQLADROP.SQL
If you ever executed SQLAGRNT.SQL, use SQLAREVK.SQL when uninstalling
8. For feedback, email author carlos.sierra@oracle.com
PROOFREAD THIS SCRIPT BEFORE USING IT! Due to differences in the way text
editors, e-mail packages, and operating systems handle text formatting (spaces,
tabs, and carriage returns), this script may not be in an executable state
when you first receive it. Check over the script to ensure that errors of
this type are corrected. The script will produce an output file named
SQLAREATnnnn.HTML. This file can be viewed in a browser or uploaded for support
analysis.
Execution Environment:
SQL*Plus
Access Privileges:
Requires to access some V$ dynamic views. If used on an Apps instance, connect as APPS.
In general, connect into SQL*Plus as main application schema owner, or as SYSTEM.
If application schema owner (APPS or any other) does not have access to data dictionary
dynamic views, use included script SQLAGRNT.SQL to grant access to required views.
Usage:
sqlplus apps/<pwd>
SQL>START SQLAREAT;
Instructions:
1. Unzip file SQLA.zip into dedicated directory on db server preserving case
on all scripts (UPPER CASE). Example: SQLAREAT.SQL
2. If you are using script SQLAREAT.SQL for the first time, connect as main
application user (APPS if using Oracle Apps) and execute:
# sqlplus apps/<pwd>
SQL> START SQLACREA.SQL;
This step creates a staging repository that is used by SQLAREAT.SQL
If not sure if the staging repository has been created or not, simply
execute SQLACREA.SQL and it will re-create it.
If you get PLS-00201 errors, execute SQLAGRNT.SQL as SYSTEM, SYS or
INTERNAL
3. Once the staging repository is created, execute:
# sqlplus apps/<pwd>
SQL> START SQLAREAT.SQL;
4. SQLAREAT.SQL creates an HTML spool file with most expensive SQL.
Execute this script manually or within a cron job. Suggested frequency
is every 15 minutes during peak time (high system load window).
5. If SQLAREAT.SQL is used over a period of time (i.e. peak hours), use
included SQLAREAR.SQL to extract most expensive SQL observed during a
range of snapshots captured previously by SQLAREAT.SQL:
# sqlplus apps/<pwd>
SQL> START SQLAREAR.SQL <p_process_type> <p_snap_id_from> <p_snap_id_to>;
SQL> START SQLAREAR.SQL LR 1 4;
Where p_process_type is LR for logical reads or PR for physical reads
6. In addition to SQLAREAT.SQL and SQLAREAR.SQL, use the SQLAREAS.SQL to
report additional statistics.
# sqlplus apps/<pwd>
SQL> START SQLAREAS.SQL;
7. If you need to uninstall this tool, execute commands below and remove
scripts SQLA* from dedicated directory
# sqlplus apps/<pwd>
SQL> START SQLADROP.SQL
If you ever executed SQLAGRNT.SQL, use SQLAREVK.SQL when uninstalling
8. For feedback, email author carlos.sierra@oracle.com
PROOFREAD THIS SCRIPT BEFORE USING IT! Due to differences in the way text
editors, e-mail packages, and operating systems handle text formatting (spaces,
tabs, and carriage returns), this script may not be in an executable state
when you first receive it. Check over the script to ensure that errors of
this type are corrected. The script will produce an output file named
SQLAREATnnnn.HTML. This file can be viewed in a browser or uploaded for support
analysis.
- SQLA.zip (70.7 KB)
- 下载次数: 0
发表评论
-
oracle11g提示服务不可用
2014-09-26 17:36 570今天遇到一个问题,本地1521端口启用,但远程不能访问 修改监 ... -
手工用户创建,老是记不住,记录
2014-09-18 13:53 317Oracle创建表空间、创建用户以及授权、查看权限 创建临 ... -
gdul
2014-08-15 15:16 469一直想自己也写个dul工具,无奈理解得不够深入 几天前看到别人 ... -
SQL调优
2014-06-20 14:14 379网上看到如下sql: 留一个线索在此 select /*+ ... -
表闪回
2014-06-19 16:13 330使用delete删除数据的情况,如果是truncate只能用数 ... -
外键约束
2014-06-19 16:02 389删除一个表时,提示有外键约束,ORA-02292: 违反完整约 ... -
get_ddl使用
2014-05-19 16:45 421查看oracle中表定义等,需要使用dbms_metadata ... -
PL/SQL语法
2014-05-09 11:38 375今天写plsql,很久没写了,很简单的,也不想参看以前写的,怎 ... -
归档日志满的处理
2014-05-04 10:07 750只是一个记录贴,方便查阅。完全没有新意 归档日志一般需要保留 ... -
数据的导出导入
2013-12-30 12:41 352异构数据库之间数据交换,主要使用txt文本文件 以下记录一个工 ... -
exp增量
2013-12-17 17:09 342很久没有写文章了,今天遇到一个老问题,exp增量备份 记 ... -
查找oracle的操作日志
2013-12-17 16:48 551今天程序有些功能不能用了,查了一下,发现某些表对象删除了 ... -
数结构的查询
2013-09-27 18:33 0很早之前就使用过该功能,每次都记不住,每次都要搜索 索性记录一 ... -
面试中的SQL
2013-09-27 12:07 450虽然有些时间没有面试过了 在我的印象中,sql中行列转换的问题 ... -
oracle SQL特性使用
2013-09-27 11:25 377oracle分析函数 统计记录中类似1/222这样的记录 se ... -
oracle内部原理
2013-09-26 11:17 951总是以为对oracle很了解,已经使用了好多年,基本是增、删、 ... -
oracle跟踪程序执行的SQL
2013-09-24 15:34 1103专门记录一下,对于系统调优很重要 1.oracle的10046 ... -
ORA-01555处理
2013-09-22 16:44 588有时表太大,导出时出现1555错误,可以采用分段方式处理。 以 ... -
BLOB字段操作
2013-09-18 10:00 884置为空或NULL update blob_test set b ... -
统计表的大小
2013-09-11 17:29 360统计用户表的大小: SELECT * FROM ( SEL ...
相关推荐
1、1=1,1=2的使用,在SQL语句组合时用的较多 “where 1=1” 是表示选择全部 “where 1=2”全部不选, 如: if @strWhere !='' begin set @strSQL = 'select count(*) as Total from [' + @tblName + '] where ' + ...
### 经典SQL语句详解 #### 数据库操作(DDL) **创建数据库:** ```sql CREATE DATABASE database-name; ``` 此命令用于创建新的数据库。`database-name`为要创建的数据库名称。 **删除数据库:** ```sql DROP ...
根据提供的文件信息,我们可以归纳出一系列重要的SQL知识点与技巧,这些内容主要涵盖了数据库管理语言(DDL)、数据操作语言(DML)、数据控制语言(DCL)等关键领域,并且涉及了具体的SQL语句示例。下面将对这些...
- 运行一条示例SQL语句来触发监控,例如:`db2 "SELECT COUNT(a.empno), b.deptno, b.deptname FROM employee a, department b WHERE a.workdept = b.deptno GROUP BY b.deptno, b.deptname"`。 - 此SQL语句用于...
### SQL查询语句使用 #### 简介 SQL(Structured Query Language)是一种用于管理关系数据库的标准语言。本文档旨在为初学者提供简单实用的SQL查询语句介绍,包括基本的SELECT语句、条件筛选、排序以及联合查询等...
Top SQL 是指那些对数据库性能影响最大、资源消耗最多的 SQL 语句。这些 SQL 语句可能会导致数据库性能下降、资源浪费,从而影响整个系统的稳定性和可靠性。 定位 Top SQL 的方法有很多,常见的方法包括: 1. 通过...
它通过 `sys.dm_exec_query_stats` 视图来获取查询统计信息,并使用 `CROSS APPLY` 连接到 `sys.dm_exec_sql_text` 视图来获取具体的 SQL 语句文本。排序依据是物理读取的最大值 (`max_physical_reads`)。 #### 五...
从给定的文件信息中,我们可以总结出一系列关于SQL语句的技巧与知识,涵盖了从基本操作到高级功能的应用。以下是对这些知识点的详细解析: ### SQL语句技巧及知识汇总 #### 1. 转换日期格式 在SQL Server中,可以...
动态地构造SQL语句来获取表中的所有字段,可以使用以下方法: ```sql DECLARE @list VARCHAR(1000) = '', @sql NVARCHAR(1000); SELECT @list = @list + ',' + b.name FROM sysobjects a, syscolumns b WHERE a.id =...
从给定的文件信息中,我们可以提炼出一系列与SQL语句相关的知识点,这些知识点对于初学者来说非常实用,能够帮助他们更好地理解和应用SQL查询、管理数据库等操作。下面,我们将详细解析这些知识点: ### 1. 按照...
- 查询语句: `SELECT TOP 1 SUM(btotal - remains) AS a FROM book GROUP BY byear ORDER BY a DESC;` - 此处存在逻辑错误,正确的做法是先确定今年的具体年份,再基于该年份的书籍计算借出数量,并进行排序。 ...
SQL语句字符串分割 在数据库管理系统中,字符串分割是一个非常常见的问题,特别是在处理逗号分割的字符串数据时。今天,我们将讨论如何在 T-SQL 中获取逗号分割的字符串数据中的元素。 方法一:利用循环逐个取出...
这条 SQL 语句主要用于从表 `tablename` 中选取每组 `b` 值相同的记录中 `a` 字段最大值的记录。这种查询方式可以广泛应用于各种场景,比如: - **论坛每月排行榜**:每个月根据用户的发帖数量来排序,找出每个月...
10、说明:几个简单的基本的sql语句 选择:select * from table1 where 范围 插入:insert into table1(field1,field2) values(value1,value2) 删除:delete from table1 where 范围 更新:update table1 set field1...
### 简单常用SQL语句 - 适合起步程序员 #### 一、基础知识与操作 **1. 创建数据库** 创建数据库是SQL中最基本的操作之一,它允许用户建立一个新的数据库实例来存储数据。语法如下: ```sql CREATE DATABASE ...
1、1=1,1=2的使用,在SQL语句组合时用的较多 “where 1=1” 是表示选择全部 “where 1=2”全部不选, 如: if @strWhere !='' begin set @strSQL = 'select count(*) as Total from [' + @tblName + '] where ' +...
标题“实用SQL语句大家可以看看哈”暗示了文档内容将涉及一系列在实际工作中频繁使用的SQL语句。这表明,无论是初学者还是经验丰富的数据库管理员,都能从中获得价值。 #### 描述解析 描述提到“一些比较实用的sql...
Select 语句的基本使用 Select 语句是 Transact-SQL 中最基本也是最重要的一种查询语句,用于从数据库中检索数据。下面将详细介绍 Select 语句的基本使用。 一、 简单查询 简单的 Transact-SQL 查询只包括选择...