`
yangsj19870829
  • 浏览: 42331 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Oracle集群实例会话管理

阅读更多

Terminating Sessions On a Specific Cluster Instance

You can use the ALTER SYSTEM KILL SESSION statement to terminate a session on a specific instance. When a session is terminated, any active transactions of the session are rolled back, and resources held by the session (such as locks and memory areas) are immediately released and available to other sessions.

Using this statement enables you to maintain strict application service-level agreements in Oracle RAC environments. Often, the goal of a service-level agreement is to execute a transaction in a specified time limit. In an Oracle RAC environment, this may require terminating a transaction on an instance and retrying the transaction on another instance within a specified time frame.

To terminate sessions, follow these steps:

  • Query the value of the INST_ID column in the GV$SESSION dynamic performance view to identify which session to terminate

  • Run the ALTER SYSTEM KILL SESSION and specify the session index number (SID) and serial number of a session that you identified with theGV$SESSION dynamic performance view.

    KILL SESSION 'integer1, integer2[, @integer3]'
    
    • For integer1, specify the value of the SID column.

    • For integer2, specify the value of the SERIAL# column.

    • For the optional integer3, specify the ID of the instance where the session to be killed exists. You can find the instance ID by querying the GV$ tables.

    To use this statement, your instance must have the database open, and your session and the session to be terminated must be on the same instance unless you specify integer3.

If the session is performing some activity that must be completed, such as waiting for a reply from a remote database or rolling back a transaction, then Oracle Database waits for this activity to complete, marks the session as terminated, and then returns control to you. If the waiting lasts a minute, then Oracle Database marks the session to be terminated and returns control to you with a message that the session is marked to be terminated. The PMON background process then marks the session as terminated when the activity is complete.

The following examples provide a three scenarios in which a user identifies and terminates a specific session.

Example 1   Identify and terminate the session on an busy instance

In this example, assume that the executing session is SYSDBA on the instance INST_ID=1. The SYSDBA first queries the GV$SESSION view for theSCOTT user's session to identify the session to terminate, and then runs the ALTER SYSTEM KILL SESSION statement to terminate the session on the instance INST_ID=2. The ORA-00031 message is returned because some activity must be completed before the session can be terminated.

SQL> SELECT SID, SERIAL#, INST_ID FROM GV$SESSION WHERE USERNAME='SCOTT';
 
       SID    SERIAL#    INST_ID
---------- ---------- ----------
        80          4          2
 
SQL> ALTER SYSTEM KILL SESSION '80, 4, @2';
alter system kill session '80, 4, @2'
*
ERROR at line 1:
ORA-00031: session marked for kill
SQL>
Example 2   Identify and terminate the session on an idle instance

In this example, assume that the executing session is SYSDBA on the instance INST_ID=1. The session on instance INST_ID=2 is terminated immediately when Oracle Database executes the statement within 60 seconds.

SQL> SELECT SID, SERIAL#, INST_ID FROM GV$SESSION WHERE USERNAME='SCOTT';
 
       SID    SERIAL#    INST_ID
---------- ---------- ----------
        80          6          2
 
SQL> ALTER SYSTEM KILL SESSION '80, 6, @2';
 
System altered.
 
SQL> 
Example 3   Using the IMMEDIATE parameter

The following example include the optional IMMEDIATE clause to immediately terminate the session without waiting for outstanding activity to complete.

SQL> SELECT SID, SERIAL#, INST_ID FROM GV$SESSION WHERE USERNAME='SCOTT';
 
       SID    SERIAL#    INST_ID
---------- ---------- ----------
        80          8          2
 
SQL> ALTER SYSTEM KILL SESSION '80, 8, @2' IMMEDIATE;
 
System altered.
 
SQL> 

See Also:

Oracle Database Administrator's Guide for more information about terminating sessions
分享到:
评论

相关推荐

    oracle10G集群

    Oracle Real Application Clusters (RAC) 是Oracle 10G集群的核心组件,允许多台服务器共同处理一个单一的数据库实例,从而实现了故障转移和负载均衡。 在Oracle 10G RAC中,每个节点都有自己的内存结构(SGA)和...

    Oracle 12c数据库实例深入浅出

    - **定义**: Oracle RAC是一种集群技术,允许多个数据库实例同时管理同一个数据库。 - **特点**: 数据库与数据库实例之间存在一对多的关系,提高了系统的可用性和性能。 - **优势**: 提高了数据库的可用性、可...

    Oracle10g RAC集群技术.rar

    - **Instance Failure**: 当一个实例故障时,其上的会话和事务会自动转移到其他实例,保证服务不间断。 - **Locking and Concurrency**: GCS和GES确保多实例下的并发控制,避免数据冲突。 - **Parallel Execution**:...

    Oracle BIEE集群部署

    - **负载均衡**:Cluster Controller 作为 Presentation Server 访问 BI Server 群集的入口,它能够根据各个 BI Server 实例上承载的会话数量动态分配负载。 - **存储库同步**:为了确保数据的一致性,需要在网络...

    ORACLE的实例的浅谈.pdf

    在非RAC环境下,一个数据库通常由一个实例装载和打开,但在Oracle的真正应用集群(Real Application Clusters, RAC)环境中,多个实例可以在多台服务器上同时装载和打开同一个数据库,实现高可用性和负载均衡。...

    大话Oracle_RAC__集群_高可用性_备份与恢复241-400

    在“大话Oracle_RAC__集群_高可用性_备份与恢复”系列文档中,我们能够深入学习到关于RAC的构建、管理和维护的关键知识点。 首先,构建Oracle RAC涉及到多个步骤。这包括安装Oracle Grid Infrastructure,它是RAC的...

    Oracle WebLogic Server 10.3 集群指导手册[代码]

    1. 部署到单个服务器实例,然后通过管理控制台将其推送到集群。 2. 直接部署到集群,应用会自动分发到所有成员。 3. 使用WLST(WebLogic Scripting Tool)进行自动化部署。 五、集群配置与管理 1. 负载均衡策略:...

    Oracle weblogic10.3.1.0.0集群配置手册

    总结,Oracle WebLogic 10.3.1.0.0集群配置是一项复杂而重要的工作,它要求管理员对WebLogic Server有深入理解,同时掌握集群技术的基本原理和实践操作。通过《Oracle WebLogic 10.3.1.0.0 集群配置手册》及相关的...

    Oracle-dba.zip_Oracle-dba_dba_oracle_oracle dba_oracle 管理

    Oracle数据库管理员(DBA)是IT领域中的关键角色,负责维护和优化Oracle数据库系统,确保数据的安全性、可用性和性能。本压缩包“Oracle-dba.zip”提供了丰富的Oracle DBA相关资源,尤其对DBA新手而言,是一份极具...

    Oracle RAC集群之测试RAC数据库集群功能.pdf

    Oracle RAC(Real Application Clusters)集群是一种高可用性解决方案,它允许多个数据库实例同时访问同一物理数据库,实现负载均衡和故障切换。本篇主要介绍如何对Oracle RAC集群进行功能测试,尤其是负载均衡测试...

    精通oracle 10g的管理

    Oracle 10g是Oracle公司推出的数据库管理系统的一个重要版本,其在企业级数据管理领域具有广泛的应用。精通Oracle 10g的管理意味着你需要掌握一系列关键技术和概念,以确保数据库的高效、稳定运行。以下是对Oracle ...

    Oracle 10g管理及应用》-王路群-电子教案及练习.rar

    7. **性能优化**:数据库性能是关键,Oracle 10g有丰富的性能监控和调优工具,如V$视图、AWR(自动工作区管理报告)、ASH(活动会话历史)等。学习者需要了解如何分析性能瓶颈,优化SQL查询,以及调整初始化参数来...

    Oracle 管理员手册(PDF)

    - 会话管理:控制并发会话,避免资源争抢和死锁。 6. **安全性** - 用户管理:创建、修改和删除用户,理解默认权限,以及角色的使用。 - 权限与角色:学习GRANT和REVOKE语句,以及如何通过角色进行权限管理。 -...

    weblogic的集群与配置图文方法

    在WebLogic的管理控制台中,管理员可以观察到集群的状态,如集群中各节点的健康状况、会话信息等,从而对集群进行有效管理。 总结来说,WebLogic集群通过创建一个管理服务器和多个节点服务器的结构,实现了应用的高...

    Oracle数据库系统应用实例集锦与编程技巧

    本资源《Oracle数据库系统应用实例集锦与编程技巧》深入探讨了Oracle数据库在实际工作中的应用和编程技术,旨在帮助用户提升数据库管理技能和解决实际问题的能力。 一、Oracle数据库基础 Oracle数据库采用SQL语言...

    在RHEL3上将单一实例数据库转换为OracleRAC10g共享.pdf

    Oracle 集群就绪服务(CRS)是Oracle RAC的核心组件,负责集群的管理和监控。它提供了集群的高可用性,包括资源管理和故障恢复。在RHEL3上安装CRS软件,确保在所有集群节点上执行相同的安装步骤,以实现集群的冗余和...

    Oracle笔记(DBA管理)

    - 会话管理:讨论了如何监控和管理数据库会话,以减少资源争抢,提高系统响应时间。 - PGA与SGA内存管理:详解了这两类内存结构的组成和作用,以及如何调整相关参数以提升性能。 3. **备份与恢复** - RMAN备份:...

    Oracle数据库管理员教程

    Oracle提供了许多性能监控工具,如V$视图、AWR(自动工作区管理报告)、ASH(活动会话历史)。DBA需要掌握如何分析SQL语句执行计划,识别性能瓶颈,并通过调整SQL、索引、内存结构等方式进行性能优化。 六、备份与...

    精通oracle 10g系统管理

    8. **集群与RAC**:Oracle 10g Real Application Clusters (RAC) 提供高可用性和负载均衡,允许多台服务器共享同一数据库实例。理解RAC的原理和配置,包括GCS(Global Cache Service)和GES(Global Enqueue Service...

Global site tag (gtag.js) - Google Analytics