天萃荷净

分享一篇,关于Oracle数据库system表空间研究,不能将用户数据存放在system表空间的原因

为什么不建议客户把业务数据存放到SYSTEM表空间中,一直想通过试验的数据来说明问题,今天见老熊的邮件和同事的blog来说明把业务数据存放在SYSTEM表空间中效率的影响

1.查询Oracle数据库版本

SQL> select * from v$version;

BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

PL/SQL Release 11.2.0.3.0 - Production

CORE 11.2.0.3.0 Production

TNS for Linux: Version 11.2.0.3.0 - Production

NLSRTL Version 11.2.0.3.0 - Production

创建测试环境

SQL> conn chf/oracleplus

Connected.

SQL> create table t_oracleplus_u(id number) tablespace users;

Table created.

SQL> create table t_oracleplus_s(id number) tablespace system;

Table created.

SQL> select table_name,tablespace_name from user_tables;

TABLE_NAME TABLESPACE_NAME

------------------------------ ------------------------------

T_oracleplus_U USERS

T_oracleplus_S SYSTEM

2.非系统表空间测试

SQL> select STATISTIC#,NAME from v$statname where name='CPU used by this session';

STATISTIC# NAME

---------- ----------------------------------------------------------------

17 CPU used by this session

SQL> select * from v$mystat where STATISTIC#=17;

SID STATISTIC# VALUE

---------- ---------- ----------

189 17 33

SQL> set timing on

SQL> begin

2 for i in 1..200000 loop

3 insert into t_oracleplus_u values(i);

4 end loop;

5 end;

6 /

PL/SQL procedure successfully completed.

Elapsed: 00:00:05.97

SQL> select * from v$mystat where STATISTIC#=17;

SID STATISTIC# VALUE

---------- ---------- ----------

189 17 629

Elapsed: 00:00:00.00

测试结果显示,非系统表空间中的表插入200000条记录,使用时间为5.97秒;使用CPU为629-33=596

3.系统表空间测试

SQL> begin

2 for i in 1..200000 loop

3 insert into t_oracleplus_s values(i);

4 end loop;

5 end;

6 /

PL/SQL procedure successfully completed.

Elapsed: 00:00:14.00

SQL> select * from v$mystat where STATISTIC#=17;

SID STATISTIC# VALUE

---------- ---------- ----------

189 17 2019

Elapsed: 00:00:00.00

测试结果显示,对系统表空间中的表插入200000条记录,使用时间为14秒;使用CPU为2019-629=1390,基本上可以看出来无论是CPU消耗还是执行时间上,系统表空间占用都是非系统表空间两倍以上

4.影响Oracle性能分析原因

SQL> conn / as sysdba

Connected.

SQL> select * from (SELECT i.ksppinm NAME, i.ksppity TYPE, v.ksppstvl VALUE,

2 v.ksppstdf isdefault FROM x$ksppi i, x$ksppcv v WHERE i.indx = v.indx AND

3 i.ksppinm LIKE '/_%%' ESCAPE '/') where name like '%db_alw%';

NAME TYPE VALUE ISDEFAULT

------------------------------ ---------- --------------- ---------

_db_always_check_system_ts 1 TRUE TRUE

SQL> alter system set "_db_always_check_system_ts"=false;

System altered.

SQL> conn chf/oracleplus

Connected.

SQL> select * from v$mystat where STATISTIC#=17;

SID STATISTIC# VALUE

---------- ---------- ----------

127 17 1

Elapsed: 00:00:00.01

SQL> begin

2 for i in 1..200000 loop

3 insert into t_oracleplus_s values(i);

4 end loop;

5 end;

6 /

PL/SQL procedure successfully completed.

Elapsed: 00:00:06.03

SQL> select * from v$mystat where STATISTIC#=17;

SID STATISTIC# VALUE

---------- ---------- ----------

127 17 582

通过这里可以发现,修改_db_always_check_system_ts=false之后,system表空间的操作基本上和非系统表空间所差无几(执行时间6.01秒,占用CPU 581=582-1)

在数据库默认情况下db_block_checking和db_block_checksum的值无论如何设置都不能对于SYSTEM表空间生效,也就是说SYSTEM表空间在没有修改_db_always_check_system_ts=false之前,对所有的块操作都要进行db_block_checking和db_block_checksum验证,从而使得数据块的操作效率较非SYSTEM表空间低下。对于一些插入较为频繁的aud$、FGA_LOG$、DEF$_AQCALL等表建议迁移到其他表空间

备注说明

DB_BLOCK_CHECKING

DB_BLOCK_CHECKING specifies whether or not Oracle performs block checking for database blocks.

Values:

OFF or FALSE

No block checking is performed for blocks in user tablespaces. However,

semantic block checking for SYSTEM tablespace blocks is always turned on.

LOW

Basic block header checks are performed after block contents change in memory

(for example, after UPDATE or INSERT statements, on-disk reads, or

inter-instance block transfers in Oracle RAC).

MEDIUM

All LOW checks and full semantic checks are performed for all objects except indexes

(whose contents can be reconstructed by a drop+rebuild on encountering a corruption).

FULL or TRUE

All LOW and MEDIUM checks and full semantic checks are performed for all objects.

Oracle checks a block by going through the data in the block, making sure it is logically

self-consistent. Block checking can often prevent memory and data corruption. Block checking

typically causes 1% to 10% overhead,depending on workload and the parameter value.

The more updates or inserts in a workload, the more expensive it is to turn on block checking.

You should set DB_BLOCK_CHECKING to FULL if the performance overhead is acceptable.

For backward compatibility, the use of FALSE (implying OFF) and TRUE (implying FULL) is preserved.

DB_BLOCK_CHECKSUM

DB_BLOCK_CHECKSUM determines whether DBWn and the direct loader will calculate a checksum

(a number calculated from all the bytes stored in the block) and store it in the cache header

of every data block when writing it to disk. Checksums are verified when a block is read -

only if this parameter is TYPICAL or FULL and the last write of the block stored a checksum.

In FULL mode, Oracle also verifies the checksum before a change application from update/delete

statements and recomputes it after the change is applied. In addition, Oracle gives every log block

a checksum before writing it to the current log.

Starting with Oracle Database 11g, most of the log block checksum is done by the generating foreground

processes, while the LGWR performs the rest of the work, for better CPU and cache efficiency.

Prior to Oracle Database 11g, the LGWR solely performed the log block checksum.

If this parameter is set to OFF, DBWn calculates checksums only for the SYSTEM tablespace,

but not for user tablespaces. In addition, no log checksum is performed when this parameter is set to OFF.

Checksums allow Oracle to detect corruption caused by underlying disks, storage systems, or I/O systems.

If set to FULL, DB_BLOCK_CHECKSUM also catches in-memory corruptions and stops them from making it to the disk.

Turning on this feature in TYPICAL mode causes only an additional 1% to 2% overhead. In the FULL mode it causes

4% to 5% overhead. Oracle recommends that you set DB_BLOCK_CHECKSUM to TYPICAL.

For backward compatibility the use of TRUE (implying TYPICAL) and FALSE (implying OFF) values is preserved.

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【学习笔记】Oracle表空间 数据存放system表空间影响数据库性能

Oracle中用system存数据,【学习笔记】Oracle表空间 数据存放system表空间影响数据库性能...相关推荐

  1. dul恢复oracle数据,学习笔记:Oracle dul数据挖掘 使用DUL数据恢复软件恢复分区表中...

    使用Oracle dul数据恢复工具对Oracle数据库分区表中的数据进行恢复 创建SALES分区表案例 CREATE TABLE SALES ( PRODUCT_ID VARCHAR2(5), SA ...

  2. oracle protocol=beq 不可用,学习笔记:Oracle数据库坏块 深入研究obj$坏块导致exp/expdp不能执行原因...

    天萃荷净 深入研究Oracle坏块obj$导致exp/expdp不能执行导出的原因 上篇(案例:Oracle出现obj$坏块exp/expdp导出不能导出的解决办法ORA-01578 ORA-0111 ...

  3. oracle修改asm参数文件,学习笔记:Oracle RAC参数文件管理 修改创建asm中的spfile文件...

    天萃荷净 Oracle rac创建修改asm中的spfile文件内容 create spfile to asm --查看sid SQL> show parameter instance_name ...

  4. oracle in查询 一直等待,学习笔记:Oracle awr 分析解决inactive transaction branch等待事件...

    天萃荷净 通过Oracle AWR报告分析inactive transaction branch等待事件的原因 分析一份awr,发现不太熟悉的等待事件"inactive transactio ...

  5. 大数据学习笔记一:大数据的发展历程--MapReduce,Hive,Yarn,Hadoop,Spark,Flink

    大数据学习系列文章:大数据-博客专栏 今天在学习极客时间专栏:<从0开始学大数据> 从预习 01 | 大数据技术发展史:大数据的前世今生到预习 03 | 大数据应用领域:数据驱动一切,系统 ...

  6. 大数据学习笔记:初探大数据世界

    文章目录 一.大数据时代 (一)第三次信息化浪潮 (二)信息科技支撑大数据时代 1.存储设备容量不断增加 2.CPU处理能力大幅提升 3. 网络带宽不断增加 (三)大数据时代来临 (四)大数据发展历程 ...

  7. 大数据学习笔记01:大数据概述

    文章目录 一.Zebra项目缺点 二.大数据概述 1.大数据时代 (1)第三次信息化浪潮 (2)信息科技为大数据时代提供技术支撑 A. 存储设备容量不断增加 B. CPU处理能力大幅提升 C. 网络带 ...

  8. 大数据学习笔记45:Sqoop - 数据迁移工具

    文章目录 一.Sqoop概述 二.下载.安装和配置Sqoop 1.下载sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz 2.将sqoop-1.4.7.bin__hadoop-2 ...

  9. 大数据学习笔记之2~大数据特征

  10. oracle 11g dul,学习笔记:Oracle dul数据挖掘 导出Oracle11G数据文件坏块中表中

    试验模拟导出Oracle 11G数据库中数据文件坏块中表中的数据 以前一直以为dul对应的版本只能恢复最高的数据库版本一致,今天测试发现dul 10可以恢复11g最新版的数据库. 模拟环境SQL> ...

最新文章

  1. Smali插桩打日志
  2. boost::incremental_components用法的测试程序
  3. Easy Tech:什么是I帧、P帧和B帧?
  4. Python中的错误处理
  5. Python装饰器的实现和万能装饰器
  6. ERROR! The server quit without updating PID file (/usr/local/var/mysql/apple,卸载,重装一个,我的方案
  7. cocos2d中CCSprite的使用总结 【转】
  8. python常遇到的各类问题解决办法
  9. Git 团队协作中常用检查术语 WIP PTAL CC LGTM 等解释
  10. php怎么添加文字,怎么在视频里加文字 在视频中添加文字
  11. 商务云PHP网络验证系统,易如意PHP网络验证系统1.3【开源】+调用模块源码
  12. 中移动入侵防御设备集采,总限价1.6亿;爱立信斩获95个5G商用合同
  13. datetime计算天数
  14. win7系统安装网银助手时提示您尚未正确安装错误的两种解决方法图文教程
  15. Photoshop CS2 视频教程-PS色彩范围(转)
  16. 超好看的3D烟花代码(html+css+js)带音乐
  17. 计算机网路络课设_学生宿舍网络规划与设计
  18. 智力题_环回到原点问题
  19. 【C++碎碎念】命名空间
  20. ul如何在一排显示并且自动换行

热门文章

  1. 2022-2027年中国大理石板材市场竞争态势及行业投资潜力预测报告
  2. 中国的LPR改革及其意义
  3. [杂谈]系统盘安装在其他电脑上能正常启动吗?
  4. Vue:如何保持导航栏的高亮状态
  5. demoireing
  6. 制作自己的openwrt刷机包_手机刷机包如何制作?自己如何制作刷机包?
  7. 【matlab】求空间两个向量之间的夹角
  8. 更改zabbix数据库mandatory
  9. linux541权限代表什么,linux中用户对文件的权限
  10. 小白入门篇:量化大神Eric跟你聊量化交易