高效删除多碎片的字典管理表空间

在Oracle8i版本中,当一个字典管理(DMT)的表空间由于长期数据更新而产生大量碎片之后,通常我们的做法需要将原先放置在DMT表空间中的表move到本地管理(LMT)表空间来重组数据以减少空间碎片。move完毕以后,原先的DMT表空间需要删除以回收空间,但是删除表空间对于fet的级联操作,导致删除DMT表空间非常耗费时间。

在字典管理类型下,fet中存储数据库目前可以使用的空闲块信息,uet存储数据库目前已经被使用的数据块信息。当删除表空间时,Oracle需要把fet中跟此表空间相关的所有的记录都一一删除,如果表空间碎片很多,那么这一步操作将耗费很长的时间。

SQL>select ts#,count(*) from fet$ group by ts#;

TS# COUNT(*)
———- ———-
0 817
1 12160
3 440932
4 15775
5 5300
6 314997

6 rows selected.

在这个数据库中TS#=3和6的表空间正需要做删除的操作,而fet中分别存在440932和314997条记录,在删除表空间时跟踪了一下,平均每秒钟Oracle能够清理fet的3条记录。

SQL> select 440932/3/3600 from dual;

440932/3/3600
————-
40.827037

SQL> select 314997/3/3600 from dual;

314997/3/3600
————-
29.1663889

可以看到删除表空间3需要40个小时,而对于表空间6也需要29小时左右。当然,实际上,随着fet$表中记录的减少,Oracle的处理将会越来越快。当然,无论如何,这始终是一个很耗费时间的操作。

在某些情况下,这么长的时间可能是无法接受的,那么如何高速执行删除此类高碎片率的表空间呢?在itpub中有人提出了非常有效的方法-修改fet$基表,结合碎片。

在itpub的这个例子中,因为需要删除的表空间中仍然还存在对象,所以操作起来需要更加小心谨慎,而对于一个已经move了所有对象的表空间,操作步骤更少。

1. 将fet$中所有属于需要drop的表空间中的数据文件的block#>2的记录全部删除
2. update这些数据文件的block#=2的记录,将length字段更新为blocks-1(blocks值可以从dba_data_files视图中获得)

可惜的是,由于是产品库,客户出于保险起见,最终没有同意这样的删除方法,少了一次实践的机会。

Oracle TimesTen体验

Oracle TimesTen

Oracle于2005年收购过来的内存数据库Oracle TimesTen In-Memory Database能够为电信行业的实时计费系统、证券行业的股票交易系统等超高并发量的企业应用提供一个较全功能的Oracle数据库内存内缓存,因为数据全部预先Load进入内存,所以自然拥有超快的反应速度。

根据Oracle的宣传,TimesTen可以达到惊人的TPS,该测试的运行环境是具有4颗主频为3.0GHz的Intel CPU的Linux操作系统。

目前TimesTen刚发布了最新的7.0版本,在这个版本中有一些新功能值得注意。

  • 根据时间规则或者读取频率规则来将表自动Ageout出内存。
  • 跟Oracle数据库的兼容性有了进一步的提高,大量扩展了TimesTen中的SQL功能,比如Decode函数,Rownum伪列,Merge功能,Minus功能。同时支持更多的Oracle数据类型,比如NUMBER, VARCHAR2, DATE, TIMESTAMP等。
  • 每个表中的字段数扩展到1000(在上一个版本中只允许最多创建255个字段)。
  • 高可用性得到提升,比如可以自动刷新的只读缓存组,允许实时更新Oracle数据库的同步缓存组,通过这些功能,TimeTen数据库表现的更像一个高级复制中的多主节点。
  • 跨版本的兼容性,这是对于开发人员很重要的功能,7.0和6.0的TimesTen可以互相兼容,也就是如果以前用6.0的客户端可以直接连接7.0的Server,而新的7.0客户端也能连接旧版本的6.0数据库。
  • 这个版本开始支持Windows x86 64bit操作系统和SUSE Linux Enterprise Server 10。
  • 下面简单做一个Windows平台上的TimesTen跟Oracle数据库相连的应用测试,一个READONLY Cache Group定时刷新Oracle数据库中的表。

    1. 安装TimesTen 7.0,在Windows平台上这跟安装其他任何一种应用程序一样简单,setup.exe,然后next好了。

    — 未完待续

    Oracle招聘

    Sales Consultant Data Management Solutions (Database)
    Consulting

    * Beijing, Shanghai, Guangzhou

    SPECIFIC RESPONSIBILITIES :

    1. Partner with sales account managers by providing the necessary support to compete effectively with key competitors
    2. Develop, present and demonstrate Oracle Data Management Solutions to prospective customers based on detailed customer requirements.
    3. Understand the dependencies on other Oracle and 3rd party software components to develop complete solutions for customers
    4. Support the development of customer workshops, pilots and proof-of-concepts
    5. Be the recognised subject matter expert for Data Management Solutions, learn and maintain product knowledge and transfer knowledge to Sales, other Sales Consultants, and other relevant constituients within the Oracle and Partner community
    6. Provide necessary input into RFI’s and RFP’s
    7. As an integral member of the sales team, contribute in detailed qualification of opportunities, formulation of strategies and technical approaches, plans for presales campaigns.

    RELEVANT TRAINING & EXPERIENCE:

    1. 3-5 years of specific business experience in Data Management Solutions
    2. Successful sales consulting experience, selling and positioning Data Management Solutions
    3. Excellent depth in subject matter area : Data Management Solutions
    a) University Qualification in Computer Science, Electrical Engineering or equivalent
    b) Have experience in dealing with CIO’s and IT directors to understand their needs
    c) Experience in one or more of the following: Java, C, PL/SQL, XML
    d) Experience in one or more of the following:: DB2, Informix, Sybase
    4. Excellent presentation and communication skills both written, oral and presentation
    5. Self motivator with the ability to work independently (as required)
    6. Very good project planning and time management skills
    7. English Language Fluency
    8. Chinese Language Fluency : Mandarin
    Desirable:
    1. Architecture Design / Development experience in data management centric infrastructure
    2. OCP Certification is a plus

    KEY RELATIONSHIPS:

    Internal
    Technology Sales Teams
    Other product line Sales Consultants
    Enterprise Architects

    External
    Customers and Partners

    COMPETENCIES :

    Consultative Selling
    Customer Need Analysis
    Communication / Presentation / Demonstration Skills
    Customer Responsiveness
    Quality Orientation
    Motivational Fit
    Resilience

    如果有人有兴趣,请给我邮件,附带中英文简历
    邮件发到 lori.zhang [at] oracle.com