Home Database Mysql Tutorial Oracle11g新特性:在线操作功能增强

Oracle11g新特性:在线操作功能增强

Jun 07, 2016 pm 03:12 PM
Function online Enhance operate new features characteristic

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 11g中在线处理功能得到了很大增强,其中包括在线修改表结构,在线创建或重建索引,建立不可见索引,表增加非空字段,在线DDL以及对象依赖性细化等。 在11g以前,DDL操作都要获取对象的排他锁,如果

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入

        11g中在线处理功能得到了很大增强,其中包括在线修改表结构,在线创建或重建索引,建立不可见索引,表增加非空字段,在线DDL以及对象依赖性细化等。

        在11g以前,DDL操作都要获取对象的排他锁,如果当时无法获取,则会马上报错:

         SQL> conn yangtk/yangtk@ytk102已连接。
        SQL> create table t (id number);
        表已创建。
        SQL> insert into t values (1);
        已创建 1 行。

        在当前会话不提交,保持对t表的锁。然后在另外的session登陆,尝试对t表进行ddl操作:

         SQL> conn yangtk/yangtk@ytk102已连接。
        SQL> set sqlp 'SQL2> '
        SQL2> truncate table t;
        truncate table t
        *第 1 行出现错误:
        ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源
        SQL2> drop table t;
        drop table t
        *第 1 行出现错误:
        ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源
        SQL2> alter table t add name varchar2(10);
        alter table t add name varchar2(10)
        *第 1 行出现错误:
        ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源
        SQL2> select * from v$version;
        BANNER
        ----------------------------------------------------------------
        Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
        PL/SQL Release 10.2.0.1.0 - Production
        CORE 10.2.0.1.0 Production
        TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
        NLSRTL Version 10.2.0.1.0 - Production

        这就是11g以前的DDL处理方式,在11g中,用户可以为DDL设置一个等待时间,这样DDL在获取不到排他锁时,会根据设置等待相应的时间,如果到时仍然获取不到锁,那么才会报错。

        登陆11g进行同样的处理:

         SQL> conn yangtk/yangtk@ora11g已连接。
        SQL> create table t (id number);
        表已创建。
        SQL> insert into t values (1);
        已创建 1 行。

        登陆第二个会话,发出DDL操作:

         SQL2> conn yangtk/yangtk@ora11g已连接。
        SQL2> set timing on
        SQL2> truncate table t;
        truncate table t
        *第 1 行出现错误:
        ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源, 或者超时失效
        已用时间: 00: 00: 00.07

        DDL仍然马上报错,这是由于控制DDL等待时间的初始化参数DDL_LOCK_TIMEOUT默认值是0,下面修改这个默认值:

         SQL2> alter session set ddl_lock_timeout = 5;
        会话已更改。
        已用时间: 00: 00: 00.06
        SQL2> truncate table t;
        truncate table t
        *第 1 行出现错误:
        ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源, 或者超时失效
        已用时间: 00: 00: 05.07

        如果在等待时间内第一个会话进行提交,那么DDL就可以获取到排他锁,从而开始操作。

         SQL2> alter session set ddl_lock_timeout = 60;
        会话已更改。
        已用时间: 00: 00: 00.04
        SQL2> truncate table t;
        返回会话1进行提交:
        SQL> commit;
        提交完成。

        会话2在会话1提交后,得到T表的锁,开始TRUNCATE操作:

         表被截断。
        已用时间: 00: 00: 13.03
        SQL2> select * from v$version;
        BANNER
        --------------------------------------------------------------------------
        Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production PL/SQL Release 11.1.0.6.0 - Production
        CORE 11.1.0.6.0 Production
        TNS for Linux: Version 11.1.0.6.0 - Production
        NLSRTL Version 11.1.0.6.0 - Production
        已用时间: 00: 00: 00.21

        注意,将DDL_LOCK_TIMEOUT参数设置过大也可能造成潜在的问题,虽然DDL还没有获取到排他锁,不能进行操作,但是它已经在T上增加了锁信息,这会导致后续的DML都会被锁住,直到DDL等待超时或锁住DDL的会话提交或回滚使得DDL顺利完成。

        这对于繁忙的系统可能造成很严重的问题,设置之前需要谨慎考虑。

[1] [2] [3] [4] [5] [6] 

Oracle11g新特性:在线操作功能增强

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)

The difference between vivox100s and x100: performance comparison and function analysis The difference between vivox100s and x100: performance comparison and function analysis Mar 23, 2024 pm 10:27 PM

Both vivox100s and x100 mobile phones are representative models in vivo's mobile phone product line. They respectively represent vivo's high-end technology level in different time periods. Therefore, the two mobile phones have certain differences in design, performance and functions. This article will conduct a detailed comparison between these two mobile phones in terms of performance comparison and function analysis to help consumers better choose the mobile phone that suits them. First, let’s look at the performance comparison between vivox100s and x100. vivox100s is equipped with the latest

What exactly is self-media? What are its main features and functions? What exactly is self-media? What are its main features and functions? Mar 21, 2024 pm 08:21 PM

With the rapid development of the Internet, the concept of self-media has become deeply rooted in people's hearts. So, what exactly is self-media? What are its main features and functions? Next, we will explore these issues one by one. 1. What exactly is self-media? We-media, as the name suggests, means you are the media. It refers to an information carrier through which individuals or teams can independently create, edit, publish and disseminate content through the Internet platform. Different from traditional media, such as newspapers, television, radio, etc., self-media is more interactive and personalized, allowing everyone to become a producer and disseminator of information. 2. What are the main features and functions of self-media? 1. Low threshold: The rise of self-media has lowered the threshold for entering the media industry. Cumbersome equipment and professional teams are no longer needed.

Linux Deploy operation steps and precautions Linux Deploy operation steps and precautions Mar 14, 2024 pm 03:03 PM

LinuxDeploy operating steps and precautions LinuxDeploy is a powerful tool that can help users quickly deploy various Linux distributions on Android devices, allowing users to experience a complete Linux system on their mobile devices. This article will introduce the operating steps and precautions of LinuxDeploy in detail, and provide specific code examples to help readers better use this tool. Operation steps: Install LinuxDeploy: First, install

What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? Mar 21, 2024 pm 04:16 PM

As Xiaohongshu becomes popular among young people, more and more people are beginning to use this platform to share various aspects of their experiences and life insights. How to effectively manage multiple Xiaohongshu accounts has become a key issue. In this article, we will discuss some of the features of Xiaohongshu account management software and explore how to better manage your Xiaohongshu account. As social media grows, many people find themselves needing to manage multiple social accounts. This is also a challenge for Xiaohongshu users. Some Xiaohongshu account management software can help users manage multiple accounts more easily, including automatic content publishing, scheduled publishing, data analysis and other functions. Through these tools, users can manage their accounts more efficiently and increase their account exposure and attention. In addition, Xiaohongshu account management software has

Huawei Mate60 Pro screenshot operation steps sharing Huawei Mate60 Pro screenshot operation steps sharing Mar 23, 2024 am 11:15 AM

With the popularity of smartphones, the screenshot function has become one of the essential skills for daily use of mobile phones. As one of Huawei's flagship mobile phones, Huawei Mate60Pro's screenshot function has naturally attracted much attention from users. Today, we will share the screenshot operation steps of Huawei Mate60Pro mobile phone, so that everyone can take screenshots more conveniently. First of all, Huawei Mate60Pro mobile phone provides a variety of screenshot methods, and you can choose the method that suits you according to your personal habits. The following is a detailed introduction to several commonly used interceptions:

What is PHP used for? Explore the role and functions of PHP What is PHP used for? Explore the role and functions of PHP Mar 24, 2024 am 11:39 AM

PHP is a server-side scripting language widely used in web development. Its main function is to generate dynamic web content. When combined with HTML, it can create rich and colorful web pages. PHP is powerful. It can perform various database operations, file operations, form processing and other tasks, providing powerful interactivity and functionality for websites. In the following articles, we will further explore the role and functions of PHP, with detailed code examples. First, let’s take a look at a common use of PHP: dynamic web page generation: P

Understanding VSCode: What is this tool used for? Understanding VSCode: What is this tool used for? Mar 25, 2024 pm 03:06 PM

"Understanding VSCode: What is this tool used for?" 》As a programmer, whether you are a beginner or an experienced developer, you cannot do without the use of code editing tools. Among many editing tools, Visual Studio Code (VSCode for short) is very popular among developers as an open source, lightweight, and powerful code editor. So, what exactly is VSCode used for? This article will delve into the functions and uses of VSCode and provide specific code examples to help readers

What are the uses of mobile and Jiaqin apps? What are the uses of mobile and Jiaqin apps? Mar 27, 2024 pm 09:01 PM

Mobile Hejiaqin APP is a comprehensive software that integrates family management, intelligent control, and family communication. It aims to create a comfortable, intelligent and harmonious home environment for users through intelligent and convenient operations. Through this application, users can easily control and manage various smart devices at home and enjoy the convenience brought by smart life. So what are the specific functions of the Mobile and Jiaqin App? Users who want to know more about it can follow this article to learn more about it! Tutorial on how to use the Mobile and Jiaqin app: What are the uses of the Mobile and Jiaqin app? Even if you don’t know IT, you can easily manage the network. 2. No matter how many smart products you have, one app is enough. 3. Even if you are thousands of miles away from home, you can still "go home" to watch it. See 4. Rich functions, enjoy smart life

See all articles