zoukankan      html  css  js  c++  java
  • oracle ORA-00060死锁查询、表空间扩容

    --查看被锁住的表
    select b.owner,b.object_name,a.session_id,a.locked_mode
    from v$locked_object a,dba_objects b
    where b.object_id = a.object_id;
    ----查看被锁住的会话
    select b.username,b.sid,b.serial#,logon_time 
    from v$locked_object a,v$session b
    where a.session_id = b.sid order by b.logon_time;
    
    --查看被阻塞的会话
    select * from dba_waiters;
    
    --查看引起死锁的会话
    select sess.sid,
       sess.serial#,
       lo.oracle_username,
       lo.os_user_name,
       ao.object_name,
       lo.locked_mode
       from v$locked_object lo,
       dba_objects ao,
       v$session sess
    where ao.object_id = lo.object_id and lo.session_id = sess.sid
    order by ao.object_name ;
    --释放锁或者杀掉ORACLE进程
    alter system kill session sid,.serial#

    --查看表空间大小和使用率
    select a.tablespace_name, total, free, total-free as used, substr(free/total * 100, 1, 5) as "FREE%", substr((total - free)/total * 100, 1, 5) as "USED%" from 
    (select tablespace_name, sum(bytes)/1024/1024 as total from dba_data_files group by tablespace_name) a, 
    (select tablespace_name, sum(bytes)/1024/1024 as free from dba_free_space group by tablespace_name) b
    where a.tablespace_name = b.tablespace_name
    order by a.tablespace_name;
    
    --某张表对应的数据库实例和表空间
    select owner,table_name,tablespace_name from dba_tables where table_name='BILLS_BREAK';
    --表空间下所表
    select table_name from dba_tables where tablespace_name='USERS';
    
    --表空间扩容
    --1.先查询表空间在物理磁盘上存放的位置
    SELECT tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 0) total_space 
    FROM dba_data_files where tablespace_name='USERS' ORDER BY tablespace_name ; 
    --2.改变数据文件的大小
    alter database datafile '/oracle/app/oradata/mytablespace/my_01.dbf' resize 256M;
    --3.验证
    select bytes/1024/1024, tablespace_name from dba_data_files where tablespace_name='USERS';
  • 相关阅读:
    (总结)CentOS Linux搭建SVN Server配置详解
    面试感悟----一名3年工作经验的程序员应该具备的技能
    SQL server 2008数据库的备份与还原(转)
    MyEclipse XX安装jad反编译插件
    c语言实现对传统单链表的创建、添加 遍历 删除 反转元素操作
    转>>Java工程师成神之路
    Programming reference for JavaScript
    elastic-job 的简单使用
    JAVA使用Ldap操作AD域
    nginx之location(root/alias)
  • 原文地址:https://www.cnblogs.com/maxmoore/p/8867353.html
Copyright © 2011-2022 走看看