惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Latest news
Latest news
T
Troy Hunt's Blog
V
Vulnerabilities – Threatpost
L
LINUX DO - 热门话题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
V
V2EX
博客园 - 司徒正美
B
Blog RSS Feed
AWS News Blog
AWS News Blog
MyScale Blog
MyScale Blog
Scott Helme
Scott Helme
Cisco Talos Blog
Cisco Talos Blog
Last Week in AI
Last Week in AI
NISL@THU
NISL@THU
博客园 - Franky
P
Proofpoint News Feed
博客园_首页
C
CERT Recently Published Vulnerability Notes
雷峰网
雷峰网
S
Schneier on Security
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
WordPress大学
WordPress大学
The Hacker News
The Hacker News
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Microsoft Azure Blog
Microsoft Azure Blog
T
The Exploit Database - CXSecurity.com
Engineering at Meta
Engineering at Meta
罗磊的独立博客
T
The Blog of Author Tim Ferriss
D
Darknet – Hacking Tools, Hacker News & Cyber Security
I
Intezer
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
K
Kaspersky official blog
SecWiki News
SecWiki News
云风的 BLOG
云风的 BLOG
美团技术团队
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Security Latest
Security Latest
C
Cyber Attacks, Cyber Crime and Cyber Security
B
Blog
S
Security Affairs

博客园 - 疯子峰

oracle性能分析 诡异的socket连接失败 ELK配置watcher 多进程 vs 多线程 关于时间 ELK日志平台 Java web项目 wordpress之客户端发布文章 神舟笔记本安装ubuntu 10.10 安装vs2010 AOP, Aspect-oriented programming 获取淘宝商品描述和价格 - 疯子峰 - 博客园 SPQuery查询语法简要说明(转) - 疯子峰 - 博客园 SPEmailEventReceiver 之导入附件EXCEL 为incoming mail绑定事件,SPEmailEventReceiver 安装Windows 2003更新后导致moss 无法访问 - 疯子峰 Ubuntu 的启动过程概览 linux 全局配置文件 vim 用户配置
oracle性能分析2
疯子峰 · 2017-10-26 · via 博客园 - 疯子峰

Oracle性能分析

软件环境:Oracle 11g , 双机RAC.

问题: 

大表(千万级行记录)查询、操作慢,经常超时终端(ORA-01013: 用户请求取消当前的操作)

分析:

1)分区表

2)历史数据归档

解决:

采用方案2)。

  • 创建历史表
create table {tablename}_his as select * from {tablename} where ...
  • 禁用除主键之外的索引
alter index {indexname} unusable;
  • 删除表数据。数据量太大(7444741)无法直接删除(执行半小时无反应中断),需批量删除。(rac环境需要到具体机器上执行)

declare  
   cursor mycursor is SELECT  ROWID FROM {tablename} WHERE ltl_time < to_date('2017-08-01','YYYY-mm-dd') order by rowid;  
   type rowid_table_type is  table  of rowid index by pls_integer;
   v_rowid   rowid_table_type;
BEGIN
   open mycursor;
   loop
     fetch   mycursor bulk collect into v_rowid  limit 5000;   --------每次处理5000行,也就是每5000行一提交
     exit when v_rowid.count=0;
     forall i in v_rowid.first..v_rowid.last
        delete from {tablename} nologging  where rowid=v_rowid(i);
     commit;
   end loop;
   close mycursor;
END;
  • 重建索引
alter index {indexname} rebuild;