oracle性能调优之路,性能调优:ORACLE性能初步调整

性能调优:ORACLE性能初步调整以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!

1003181b8c4e1913de39794335f23661.png

在User Schema 上 用人工指定方式指定 Tmp 的tablespace 换句话说要人工定义一个tmp 的tablespace 给user schema ——为colm v这个user单独开一个临时表空间 个人认为调整之后效果不会有很明显的变化临时表空间的作用是当sql语句中出现order by group by(也就是需要排序的时候) 如果排序的数据比较少 就会在内存中排序 排序的数据量很大时 oracle会把排序的任务放在临时表空间中完成 内存中排序(逻辑排序)比在磁盘上排序(物理排序)理论上快 倍!所以临时表空间很大并不是一件好事情 说明sql中存在大量排序的动作 sql语句需要优化!    所以深圳那里需要看一下临时表空间的大小!

当然johanna的意见也会有一定的作用 临时表空间独立出来之后 就不会和sys system等一系列oracle 内部使用临时表空间的操作产生资源竞争!

请检查SQL 使用到的where 条件是否均有定index   除此以外 检查使用到的where 条件最好以index 之顺序来写——这部分比较复杂 也是性能最关键的地方 几乎所有的oracle专家都认为 %以上的性能调整都和sql语句优化有关 需要check所有的sql语句where后面的条件是否有用到index的必要   工程量比较浩大!需要一个个小心谨慎的check!

把index 做一次 dbms_stats dbms stats 是oracle内部的api 可以对index table进行分析 收集统计信息 这样oracle优化器就会有一个最佳的选择 使性能达到最佳方法如下 SQL>select tt table_name tt num_rows tt blocks tt empty_blocks tt avg_row_len from dba_tables tt where tt owner= COLMTEST ; SQL>select ttt index_name ttt num_rows ttt distinct_keys ttt avg_leaf_blocks_per_key ttt clustering_factor from dba_indexes ttt where ttt owner= COLMTEST ;

执行上述两条命令之后会发现除了table_name和index_name 其余列的统计信息都是不完全的

SQL>execute dbms_stats gather_schema_stats(ownname => COLMTEST cascade=>true)

执行完dbms_stats 再调用上述两句语句 会发现所有的列基本上都已经被填充!

PS 执行统计比较慢 相当于所有table index都扫描一遍的时间 COLMTEST 改一下另外 对单个表执行统计分析的语句如下 EXECUTE dbms_stats gather_table_stats (ownname=> citic tabname=> col_cust_id estimate_percent=> cascade=>true)

做过以上处理之后 再看情形   再依情况放参数

——参数暂时不用调整!

建议做一个STATSPACK通过Statspack我们可以很容易的确定Oracle数据库的瓶颈所在 记录数据库性能状态 迅速了解数据库运行状况

方法如下

安装Statspack安装Statspack拥有SYSDBA(connect / as sysdba)权限的用户登陆 需要在本地安装或者通过telnet登陆到服务器 ——客户端登录不可以

必要条件 先创建名称为perfstat的表空间 至少 M

在那台oracle数据库上用colmv 登录SQL*PLUS 然后输入SQL> connect sys/sys@(你们那里的sid) as sysdba SQL> alter system set timed_statistics = true System altered——使用statspack收集统计信息时建议将该值设置为 TRUE 否则收集的统计信息大约只能起到 %的作用

SQL> @C \oracle\ora \rdbms\admin\spcreate sql 输入 perfstat_password 的值   perfstat输入default_tablespace的值   perfstat输入temporary_tablespace 的值   temp

NOTE SPCPKG plete Please check spcpkg lis for any errors ——需要出现上述语句才算成功 否则请查看 lis文件并执行 进行重建SQL> @C \oracle\ora \rdbms\admin\spdrop sql SQL> @C \oracle\ora \rdbms\admin\spcreate sql

查看文件夹会产生三个文件C \oracle\ora \bin spcpkg lis spctab lis spcusr lis

——从下面开始都可以在客户端SQL_PLUS进行操作 手动执行STATSPACK收集统计信息SQL> show user USER为 PERFSTAT SQL> execute statspack snap      ——快照

然后需要经过 个小时(跑批需要包含在里面) 再执行SQL> execute statspack snap      ——快照

最后生成STATSPACK调整报告

SQL> @C:\oracle\ora \rdbms\admin\spreport sql; Current Instance ~~~~~~~~~~~~~~~~      DB Id    DB Name      Inst Num Instance   COLM                colm   Instances in this Statspack schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    DB Id    Inst Num DB Name      Instance     Host           COLM         colm         STEVENHUANG   Using  for database Id Using          for instance number   Completed Snapshots                              Snap                    Snap Instance     DB Name         Id   Snap Started    Level Comment colm         COLM           月 :                                                                                月 :                                          Specify the Begin and End Snapshot Ids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 输入 begin_snap 的值:  输入 end_snap 的值:  End   Snapshot Id specified:   Specify the Report Name ~~~~~~~~~~~~~~~~~~~~~~~ The default report file name is sp_ _   To use this name press to continue otherwise enter an alternative 输入 report_name 的值:  report txt   End of Report

查看产生的report 文档C \oracle\ora \bin\report txt lishixinzhi/Article/program/Oracle/201311/17298

分页:123

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Database Performance Tuning and Optimization Publisher: Springer | Pages: 510 | 2002-12-13 | ISBN: 0387953930 | PDF | 2 MB Product Description: Examples abound in database applications of well-formulated queries running slowly, even if all levels of the database are properly tuned. It is essential to address each level separately by focusing first on underlying principles and root causes, and only then proposing both theoretical and practical solutions. "Database Performance Tuning and Optimization" comprehensively addresses each level separately by focusing first on underlying principles and root causes, and then proposes both theoretical and practical solutions using Oracle 8i examples as the RDBMS. The book combines theory with practical tools (in the form of Oracle and UNIX shell scripts) to address the tuning and optimization issues of DBAs and developers, irrespective of whether they use Oracle. Topics and features: * An integrated approach to tuning by improving all three levels of a database (conceptual, internal, and external) for optimal performance * Balances theory with practice, developing underlying principles and then applying them to other RDBMSs, not just Oracle * Includes CD-ROM containing all scripts and methods utilized in the book * Coverage of data warehouses provides readers much needed principles and tools for tuning large reporting databases * Coverage of web-based databases * Appendix B shows how to create an instance and its associated database and all its objects * Provides useful exercises, references, and Oracle 8i and select 9i examples Based on nearly two decades of experience as an Oracle developer and DBA, the author delivers comprehensive coverage of the fundamental principles and methodologies of tuning and optimizing database performance. Database professionals and practitioners with some experience developing, implementing, and maintaining relational databases will find the work an essential resource. It is also suitable for professional short courses and self-study purposes.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值