oracle 查看dba账户,Oracle DBA常用查询「建议收藏」

oracle 查看dba账户,Oracle DBA常用查询「建议收藏」1.查询系统所有对象selectowner,object_name,object_type,created,last_ddl_time,timestamp,statusfromdba_objectswhereowner=upper(‘scott’)2.查看系统所有表selectowner,table_name,tablespace_namefromdba_table…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

1. 查询系统所有对象

select owner, object_name, object_type, created, last_ddl_time, timestamp, status

from dba_objects

where owner=upper(‘scott’)

2. 查看系统所有表

select owner, table_name, tablespace_name from dba_tables

3. 查看所有用户的表

select owner, table_name, tablespace_name from all_tables

4. 查看当前用户表

select table_name, tablespace_name from user_tables

5. 查看用户表索引

select t.*,i.index_type from user_ind_columns t, user_indexes i where

t.index_name = i.index_name and t.table_name = i.table_name

and t.table_name = 要查询的表

6. 查看主键

select cu.* from user_cons_columns cu, user_constraints au

where cu.constraint_name = au.constraint_name

and au.constraint_type = upper(‘p’) and au.table_name = 要查询的表

7. 查看唯一性约束

select column_name from user_cons_columns cu, user_constraints au

where cu.constraint_name = au.constraint_name and au.constraint_type =  upper(‘u’)

and au.table_name = 要查询的表

8. 查看外键

select * from user_constraints c where c.constraint_type = ‘r’ and c.table_name = 要查询的表

select * from user_cons_columns cl where cl.constraint_name = 外键名称

select * from user_cons_columns cl where cl.constraint_name = 外键引用表的键名

9. 查看表的列属性

select t.*,c.comments

from user_tab_columns t, user_col_comments c

where t.table_name = c.table_name and t.column_name = c.column_name and t.table_name = 要查询的表

10. 查看所有表空间

select tablespace_name from dba_data_files group by tablespace_name

############################################

11. 查看oracle最大连接数

sql>show parameter processes    #最大连接数

12. 修改最大连接数

sql>alter system set processes=value scope=spfile

–重启数据库

sql>shutdown force

sql>start force

13. 查看当前连接数

sql>select * from v$session where username is not null

14. 查看不同用户的连接数

sql>select username,count(username) from v$session where username is not null group by username #查看指定用户的连接数

15. 查看活动的连接数

sql>select count(*) from v$session where status=’active’ #查看并发连接数

16. 查看指定程序的连接数

sql>select count(*) from v$session where program=’jdbc thin client’ #查看jdbc连接oracle的数目

17. 查看数据库安装实例(dba权限)

sql>select * from v$instance

18. 查看运行实例名

sql>show parameter instance_name

19. 查看数据库名

sql>show parameter db_name

20. 查看数据库域名

sql>show parameter db_domain

21. 查看数据库服务名

sql>show parameter service_names

22. 查看全局数据库名

sql>show parameter global

23. 查看表空间使用率

— (1)

select dbf.tablespace_name,

dbf.totalspace “总量(m)”,

dbf.totalblocks as “总块数”,

dfs.freespace “剩余总量(m)”,

dfs.freeblocks “剩余块数”,

(dfs.freespace / dbf.totalspace) * 100 as “空闲比例”

from (select t.tablespace_name,

sum(t.bytes) / 1024 / 1024 totalspace,

sum(t.blocks) totalblocks

from dba_data_files t

group by t.tablespace_name) dbf,

(select tt.tablespace_name,

sum(tt.bytes) / 1024 / 1024 freespace,

sum(tt.blocks) freeblocks

from dba_free_space tt

group by tt.tablespace_name) dfs

where trim(dbf.tablespace_name) = trim(dfs.tablespace_name)

— (2)

select t.name “tablespace name”,

free_space,

(total_space – free_space) used_space,

total_space

from (select tablespace_name, sum(bytes / 1024 / 1024) free_space

from sys.dba_free_space

group by tablespace_name) free,

(select b.name, sum(bytes / 1024 / 1024) total_space

from sys.v_$datafile a, sys.v_$tablespace b

where a.ts# = b.ts#

group by b.name) t

where free.tablespace_name = t.name

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/189250.html原文链接:https://javaforall.net

(0)
上一篇 2026年4月14日 上午10:25
下一篇 2026年4月14日 上午10:31


相关推荐

  • 阿里巴巴Page-Agent:用自然语言控制网页界面的JavaScript GUI代理

    阿里巴巴Page-Agent:用自然语言控制网页界面的JavaScript GUI代理

    2026年3月13日
    3
  • python get pip.py_get-pip.py 安装

    python get pip.py_get-pip.py 安装如果过程中报 zlib 包 那么需要先执行 yuminstallzl devel 安装 zlib 然后重新编译安装 python 最后设置环境变量 pip 默认安装实在当前版本 python 目录的 bin 下 所以将此目录设置到环境变量中即可 linux 安装完成 window 安装步骤 第一步 直接用浏览器访问地址 https raw github com pypa pip master co

    2026年3月17日
    2
  • 史上最小白之RNN详解

    史上最小白之RNN详解1 前言网上目前已经有诸多优秀的 RNN 相关博客 但是我写博客的出发点主要是为了加深和巩固自己的理解 所以还是决定自己再进行一下总结和描述 如有不正确的地方欢迎指正 2 区分 RNN 循环神经网络 RecurrentNeu 递归神经网络 RecursiveNeu 你有没有发现他们的缩写都是 RNN 那他们两个是同一回事儿吗 网上有一些博客把这两就当

    2026年3月26日
    3
  • OpenGrok安装

    OpenGrok安装windows安装OpenGrok安装需要的几个工具1.JDK2.tomcat3.opengrk4.ctags1.软件安装1.1安装JDK下载地址:http://www.Oracle.com/technetwork/Java/javase/downloads/index.html从以上下载地址下载并安装。配置环境变量,我安装在H盘的,如下:J

    2022年5月1日
    87
  • CollectGarbage_The Collector

    CollectGarbage_The CollectorCollectgarbage- ItdoeswhatitsaysitdoesDefinitioncollectgarbage([opt[,arg]])Thisfunctionisagenericinterfacetothegarbagecollector.Itperformsdifferentfunctionsaccording

    2025年7月22日
    3
  • Scrapy 安装介绍以及基本操作

    Scrapy 安装介绍以及基本操作在写之前我们先来了解一下什么是 Scrapy Scrapy 是用纯 Python 实现一个为了爬取网站数据 提取结构性数据而编写的应用框架 用途非常广泛框架的力量 用户只需要定制开发几个模块就可以轻松的实现一个爬虫 用来抓取网页内容以及各种图片 非常之方便 Scrapy 使用了 Twisted tw st d 其主要对手是 Tornado 异步网络框架来处理网络通讯 可以加快我们的下载速度 不

    2026年3月20日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号