作者为:? SHOUG成员 – ORACLE ACS高级顾问罗敏 某日与Oracle同事一同在某移动公司进行技术交流,涵盖12c、云技术、数据库整合、容灾、OEM等多个专题领域。临近中午时分,一直喷到了Oracle最适合于人工错误恢复的FLASHBACK技术。正在唾沫四溅之际,突然接到
作者为:?
SHOUG成员 – ORACLE ACS高级顾问罗敏
某日与Oracle同事一同在某移动公司进行技术交流,涵盖12c、云技术、数据库整合、容灾、OEM等多个专题领域。临近中午时分,一直喷到了Oracle最适合于人工错误恢复的FLASHBACK技术。正在唾沫四溅之际,突然接到客户DBA电话:“罗工,能不能暂停一下技术交流,我们正好有三张表刚被人意外删除了,能不能过来帮忙用你刚刚介绍的FLASHBACK技术把这三张表抢救回来?”
世界上怎么还有这么巧合的事情?已经由不得我有半分迟疑,特别是任何私心杂念了。诸如:“罗工,这不正好让你展现Oracle技术特点,给你次露脸机会了。”。“罗工,你不挺能吹的吗?看你能不能展示真才实学了”… …。于是,我端起笔记本电脑,直奔现场,一边下楼,一边赶紧看FLASHBACK相关资料。俗话说:临阵磨枪,不快也光。呵呵。
销售同事也看出了情形的紧迫和老罗的“窘”态,想尽一切可能在帮忙:帮我拆笔记本电源线,帮我提着矿泉水,更恨不得搀扶着正阅读文档,步履有点蹒跚的老罗同志一同下楼,哈哈!
待我赶到机器旁边时,资料也已经看完了,心中也有底了。于是,在简单询问了问题现象之后,赶脚让第三方公司DBA输入如下命令:
SELECT original_name, object_name,
type, ts_name, droptime, related, space
FROM user_recyclebin
WHERE can_undrop = ‘YES';
咦,怎么是空?再在sys用户下输入:
Select * from dba_recyclebin;
还是空!怎么回事?难道删除这三张表的客户不是意外操作,而是诚心搞破坏,用了“drop table … purge”命令,或者清空了回收站(Recycle Bin),从而彻底删除了这三张表?与客户进一步确认:这三张表的确是误删除的,没有使用上述命令。
既然如此,为什么回收站没有这三表表的数据呢?稍一思忖,想起来了!Oracle还有个初始化参数(RECYCLEBIN),可控制是否使用FLASHBACK DROP。一检查,果然如此!原来DBA把RECYCLEBIN设置成OFF,从而关闭了FLASHBACK DROP功能。唉!遗憾啊,老罗同志失去了一次露脸的机会,Oracle更失去一次展现技术特点的机会!
本来可以通过“flashback table
待一切恢复正常了,我还是询问DBA了:“为什么要关闭FLASHBACK DROP功能呢?”回答是:“你们Oracle Flashback太消耗资源了,影响性能,我们不敢打开。”
哦,原来如此。这也是本文的主题:从技术上言,Flashback不是单一技术,而是一个技术家簇。以下就是各种Flashback技术的综合对比:
Flashback技术 | 主要目的 | 级别 | 配置方式 | 技术原理 | 恢复期限 | 适应场景 |
Flashback Database | 快速恢复数据库 | 数据库级 | 基于存储在Flashback Recovery Area中的 Flashback log | 取决于Flashback Recovery Area容量和db_flashback_retention_target参数 |
|
|
Flashback Table | 整表恢复到指定时间 | 表级 | 缺省 | 基于Undo技术 | 取决于UNDO表空间大小,UNDO_retention参数 |
|
Flashback Query/ DBMS_FLASHBACK包 | 查询过去时间点的记录 | 记录级 | 缺省 | 基于Undo技术 | 取决于UNDO表空间大小,UNDO_retention参数 |
|
Flashback Drop | 快速恢复Drop Table操作 | 表级 | 缺省 | Recyclebin(该表所在的表空间) | 自动管理(FIFO算法)。由表空间的空闲空间确定 |
|
Flashback Versions Query | 访问事务历史情况 | 记录级 | 缺省 | 基于Undo技术 | 取决于UNDO表空间大小,UNDO_retention参数 |
|
Flashback Transaction Query | 查询UNDO语句 | 记录级 | 缺省 | 基于Undo技术 | 取决于UNDO表空间大小,UNDO_retention参数 |
|
11g Total-Recall(Flashback Data Archive) | 历史数据存储和利用 | 表级 | 需要配置 | 基于FDA区域 | 取决于FDA区域表空间大小 |
|
各位看见了吗?上述表格中每种Flashback技术原理、目的、是否是缺省配置、适应场景等都是不一样的。没错,某些Flashback技术,特别是Flashback Database是需要进行专门配置的,例如创建Flashback Recovery Area,还会产生大量Flashback log,也的确对性能有一定影响的。但是,很多Flashback技术一方面是缺省配置的,另一方面是基于Undo技术的,并不额外产生资源开销的,对性能的影响也非常有限。例如Flashback Drop技术仅仅在删除表时才会有一定操作,难道我们的系统成天都有Drop Table操作?大家没事天天删表玩儿?不可能吧,呵呵。
唉,这就是国内IT行业的常态之一:不分青红皂白;技术运用简单化;动辄一刀切;缺乏对相关技术的深入研究;什么新特性都不敢用;想当然地自己吓自己……
我们时候才能真正做到严谨、科学、务实、专业、积极、进取,充分评估、大胆运用各种IT新技术、新特性啊?
唉…………………
Related posts:
- Oracle Acs资深顾问罗敏 老罗技术核心感悟:牛! 11g的自动调优和SQL Profile
- Oracle Acs资深顾问罗敏 老罗技术核心感悟:自动扫描SQL语句工具?
- Oracle Acs资深顾问罗敏 老罗技术核心感悟:又一次臭显摆之后的感悟
- Oracle Acs资深顾问罗敏 老罗技术核心感悟:分表还是分区?
- Oracle Acs资深顾问罗敏 老罗技术核心感悟:Clusterware是成熟产品吗?
- Oracle闪回功能flashback详解
- 11g r2中对闪回数据归档的增强
- V$SQLCOMMAND SQL opcodes and names
- Oracle Controlfile控制文件中记录的信息片段sections
原文地址:Oracle Acs资深顾问罗敏 老罗技术核心感悟:失去了一次露脸机会, 感谢原作者分享。

ACID attributes include atomicity, consistency, isolation and durability, and are the cornerstone of database design. 1. Atomicity ensures that the transaction is either completely successful or completely failed. 2. Consistency ensures that the database remains consistent before and after a transaction. 3. Isolation ensures that transactions do not interfere with each other. 4. Persistence ensures that data is permanently saved after transaction submission.

MySQL is not only a database management system (DBMS) but also closely related to programming languages. 1) As a DBMS, MySQL is used to store, organize and retrieve data, and optimizing indexes can improve query performance. 2) Combining SQL with programming languages, embedded in Python, using ORM tools such as SQLAlchemy can simplify operations. 3) Performance optimization includes indexing, querying, caching, library and table division and transaction management.

MySQL uses SQL commands to manage data. 1. Basic commands include SELECT, INSERT, UPDATE and DELETE. 2. Advanced usage involves JOIN, subquery and aggregate functions. 3. Common errors include syntax, logic and performance issues. 4. Optimization tips include using indexes, avoiding SELECT* and using LIMIT.

MySQL is an efficient relational database management system suitable for storing and managing data. Its advantages include high-performance queries, flexible transaction processing and rich data types. In practical applications, MySQL is often used in e-commerce platforms, social networks and content management systems, but attention should be paid to performance optimization, data security and scalability.

The relationship between SQL and MySQL is the relationship between standard languages and specific implementations. 1.SQL is a standard language used to manage and operate relational databases, allowing data addition, deletion, modification and query. 2.MySQL is a specific database management system that uses SQL as its operating language and provides efficient data storage and management.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

Key metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.

Usingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB


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

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),