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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 安卓ExpandableListView的详细使用教程(附代码解析过程)

    安卓ExpandableListView的详细使用教程(附代码解析过程)ExpandableListView又称可扩展的ListView,它可以实现点击父项展开子项的效果,本文实现了一个比较精美的ExpandableListView。

    2022年6月30日
    15
  • 什么是系统平均负载(Load average)

    什么是系统平均负载(Load average)一、什么是系统平均负载(Loadaverage)?在Linux系统中,uptime、w、top等命令都会有系统平均负载loadaverage的输出,那么什么是系统平均负载呢?LoadAver

    2022年7月3日
    20
  • 线程VS进程「建议收藏」

    线程VS进程「建议收藏」什么是线程、什么是进程在Java中要同时执行(如果是单核,准确的说是交替执行)多个任务,使用的是多线程,而要理解线程,我们先要了解什么是进程什么是线程。一般的定义:进程是指在操作系统中正在运行的一个应用程序,线程是指进程内独立执行某个任务的一个单元。怎么理解呢?比如说QQ是是一个进程,如果你在和A朋友语音聊天的同时和B朋友打字聊天,同时还在QQ群下载图片,这三个操作就相当于开启了三个线程,可以说有了线程之后我们设计的程序就可以一边执行A操作,一边执行B操作了。线程和进程有什么区别呢?首先最直观的

    2022年7月15日
    8
  • 编译命令行终端 swift

    编译命令行终端 swift

    2022年1月13日
    40
  • 八、装饰者模式—巴厘岛,奶茶店的困扰! #和设计模式一起旅行#[通俗易懂]

    善于思考,方法总比问题多!故事背景我和漂亮的模式MM来到巴厘岛,这里火山爆发刚刚结束不久,一切要重新开始,来到这个地方几天后,觉得这个地方还是不错,于是就决定在这里开一个奶茶店,因为这里游客比较多,流量大,反正之前我们也没有开店的体验,那么一拍即合,开个奶茶店,体验一下了。 奶茶店的名字:Beautiful Life milk tea!名字起好了,那么我们就开始想如…

    2022年2月27日
    34
  • Server SAN_Windows存储卷设备

    Server SAN_Windows存储卷设备目前,实现云环境中数据的高效存储是云计算提供服务的基本要求。云计算和云存储已经成为提供信息和在线功能的首选方法。云计算和云存储已经成为解决普通IT问题和挑战的热门话题。以数据中心网络为基础的分布式存储是构建云计算的物理实体。通常熟知的存储设备是和计算机主板I/O接口(如IDE、SCSI)相连接的硬盘,由本机操作系统负责读写及管理,这是传统的数据存储技术,称为DAS(直接附加存储)。如果添加网络,可以实现文件共享,这是基于局域网(IP)的文件共享设备,能消除对多个文件服务器的需求。存储作为云计算提供I

    2022年10月28日
    0

发表回复

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

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