Table of Contents
SHOUG成员 – ORACLE ACS高级顾问罗敏
Home Database Mysql Tutorial Oracle Acs资深顾问罗敏 老罗技术核心感悟:失去了一次露脸机会

Oracle Acs资深顾问罗敏 老罗技术核心感悟:失去了一次露脸机会

Jun 07, 2016 pm 04:40 PM
oracle technology core consultant

作者为:? 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 to before drop”一条简单命令,在数秒钟之内就能恢复被误删除表,结果害得客户从生产系统去重新抓取数据,同时恢复被删除的索引、Constraint等数据,整整折腾了一个多小时。客户庆幸的是:幸亏生产系统还有数据,否则叫天不应,喊地不灵。

待一切恢复正常了,我还是询问DBA了:“为什么要关闭FLASHBACK DROP功能呢?”回答是:“你们Oracle Flashback太消耗资源了,影响性能,我们不敢打开。”

哦,原来如此。这也是本文的主题:从技术上言,Flashback不是单一技术,而是一个技术家簇。以下就是各种Flashback技术的综合对比:

Flashback技术 主要目的 级别 配置方式 技术原理 恢复期限 适应场景
Flashback Database 快速恢复数据库 数据库级 基于存储在Flashback Recovery Area中的 Flashback log 取决于Flashback Recovery Area容量和db_flashback_retention_target参数
  • 大规模数据误操作
  • 应用测试
  • 与Data Guard综合使用
Flashback Table 整表恢复到指定时间 表级 缺省 基于Undo技术 取决于UNDO表空间大小,UNDO_retention参数
  • 各种DML错误的表级恢复

 

Flashback Query/ DBMS_FLASHBACK包 查询过去时间点的记录 记录级 缺省 基于Undo技术 取决于UNDO表空间大小,UNDO_retention参数
  • 恢复错误记录
  • 对历史记录进行分析、统计
Flashback Drop 快速恢复Drop Table操作 表级 缺省 Recyclebin(该表所在的表空间) 自动管理(FIFO算法)。由表空间的空闲空间确定
  • 错误Drop 表操作
Flashback Versions Query 访问事务历史情况 记录级 缺省 基于Undo技术 取决于UNDO表空间大小,UNDO_retention参数
  • 访问事务历史情况
  • 安全审计
Flashback Transaction Query 查询UNDO语句 记录级 缺省 基于Undo技术 取决于UNDO表空间大小,UNDO_retention参数
  • 查询事务详细情况
  • 查询UNDO_SQL语句
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:

  1. Oracle Acs资深顾问罗敏 老罗技术核心感悟:牛! 11g的自动调优和SQL Profile
  2. Oracle Acs资深顾问罗敏 老罗技术核心感悟:自动扫描SQL语句工具?
  3. Oracle Acs资深顾问罗敏 老罗技术核心感悟:又一次臭显摆之后的感悟
  4. Oracle Acs资深顾问罗敏 老罗技术核心感悟:分表还是分区?
  5. Oracle Acs资深顾问罗敏 老罗技术核心感悟:Clusterware是成熟产品吗?
  6. Oracle闪回功能flashback详解
  7. 11g r2中对闪回数据归档的增强
  8. V$SQLCOMMAND SQL opcodes and names
  9. Oracle Controlfile控制文件中记录的信息片段sections
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to check tablespace size of oracle How to check tablespace size of oracle Apr 11, 2025 pm 08:15 PM

To query the Oracle tablespace size, follow the following steps: Determine the tablespace name by running the query: SELECT tablespace_name FROM dba_tablespaces; Query the tablespace size by running the query: SELECT sum(bytes) AS total_size, sum(bytes_free) AS available_space, sum(bytes) - sum(bytes_free) AS used_space FROM dba_data_files WHERE tablespace_

How to view instance name of oracle How to view instance name of oracle Apr 11, 2025 pm 08:18 PM

There are three ways to view instance names in Oracle: use the "sqlplus" and "select instance_name from v$instance;" commands on the command line. Use the "show instance_name;" command in SQL*Plus. Check environment variables (ORACLE_SID on Linux) through the operating system's Task Manager, Oracle Enterprise Manager, or through the operating system.

How to encrypt oracle view How to encrypt oracle view Apr 11, 2025 pm 08:30 PM

Oracle View Encryption allows you to encrypt data in the view, thereby enhancing the security of sensitive information. The steps include: 1) creating the master encryption key (MEk); 2) creating an encrypted view, specifying the view and MEk to be encrypted; 3) authorizing users to access the encrypted view. How encrypted views work: When a user querys for an encrypted view, Oracle uses MEk to decrypt data, ensuring that only authorized users can access readable data.

How to uninstall Oracle installation failed How to uninstall Oracle installation failed Apr 11, 2025 pm 08:24 PM

Uninstall method for Oracle installation failure: Close Oracle service, delete Oracle program files and registry keys, uninstall Oracle environment variables, and restart the computer. If the uninstall fails, you can uninstall manually using the Oracle Universal Uninstall Tool.

How to delete all data from oracle How to delete all data from oracle Apr 11, 2025 pm 08:36 PM

Deleting all data in Oracle requires the following steps: 1. Establish a connection; 2. Disable foreign key constraints; 3. Delete table data; 4. Submit transactions; 5. Enable foreign key constraints (optional). Be sure to back up the database before execution to prevent data loss.

How to solve the problem of closing oracle cursor How to solve the problem of closing oracle cursor Apr 11, 2025 pm 10:18 PM

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

How to check invalid numbers of oracle How to check invalid numbers of oracle Apr 11, 2025 pm 08:27 PM

Oracle Invalid numeric errors may be caused by data type mismatch, numeric overflow, data conversion errors, or data corruption. Troubleshooting steps include checking data types, detecting digital overflows, checking data conversions, checking data corruption, and exploring other possible solutions such as configuring the NLS_NUMERIC_CHARACTERS parameter and enabling data verification logging.

How to create cursors in oracle loop How to create cursors in oracle loop Apr 12, 2025 am 06:18 AM

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

See all articles