博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle关于用户信息的一些SQL语句
阅读量:5272 次
发布时间:2019-06-14

本文共 2571 字,大约阅读时间需要 8 分钟。

--查看用户信息

select * from dba_users where
--temporary_tablespace='TEMP_ETL2'
username like '%DGP_ETL%'

--查询用户权限

select * from dba_sys_privs
where grantee like '%ZBA_CZC%'
order by 1

--查看用户下的角色

select * from dba_role_privs
where grantee like '%ZBA_CZC%'
order by 1

--查看角色下的权限

select * from role_sys_privs where role=xujin1;

--查询用户使用表空间限制

select a.*,max_bytes/1024/1024/1024 GB from DBA_TS_QUOTAS a where username='DGP_ETL';

--修改用户对表空间的使用权

alter user DGP_ETL quota unlimited on TBS_DGP;
alter user DGP_ETL quota 100M on TBS_DGP;
create user anqing identified by anqing default tablespace users temporary tablespace temp quota 10M on users;

--查询用户信息

select * from dba_users where username='UNIONMON'

--解锁用户

alter user ZB_HESPER account unlock

--创建新用户

create user unionmon identified by "unionmon" default tablespace SYSTEM temporary tablespace TEMP profile DEFAULT;

--修改用户默认表空间

ALTER USER UNIONMON DEFAULT TABLESPACE SYSTEM;

--修改用户默认临时表空间

ALTER USER ZBG_DWA temporary TABLESPACE TEMP_ETL1;

--查询dblike

SELECT * FROM DBA_DB_LINKS
where
--host like '%132.35.224.165%'
db_link like '%DSSDB_DFW%'

---创建dblink

create public database link DSSDB_DFW connect to oratest identified by oratest2017
using ' (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.161.35.133)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orassoc)
)
)';

--删除dblink
drop public database link dblinkname;

--查看用户回话限制
select a.username,b.profile,b.limit from dba_users a,dba_profiles b
where b.profile=a.profile
and b.profile not in ( 'SYS_PROFILE','DEFAULT')
and resource_name='SESSIONS_PER_USER'
--and b.profile like '%SESS_ZBA_CZC%'
--and a.users like '%%'

--修改PROFILE

alter profile SESS_ZBA_DEV limit sessions_per_user 8

--批量创建profile

select 'create profile '||username||'_LIMIT sessions_per_user 20' from dba_users

--批量赋予用户profile

select 'alter user '||username||' profile '||username||'_LIMIT' from dba_users

--创建一个profile限制会话连接数20个名字叫sess_xx
create profile sess_bingo limit sessions_per_user 20

--将profile sess_xx给用户xxx

alter user scott profile DEFAULT;
alter user scott profile sess_bingo

--查看sga的shared poll
select bytes/1024/1024/1024 from v$sgastat where name = 'free memory' and pool='shared pool'

--12c查看内存/cpu/进程/回话
select hostname,round(100-free_mem_gb/total_mem_gb*100)||'%' as "MEM",
cpu_idle,amount_process,time_id,amount_sess
from system.daily_mon@link_12c_mon
where to_char(time_id,'mmdd')=0410
and to_char(time_id,'hh24') between '15' and '16'
order by time_id,1

--日志异常

select * from v$log
order by status,first_time

转载于:https://www.cnblogs.com/liusuForget/p/10077962.html

你可能感兴趣的文章
C++垃圾回收器的实现
查看>>
(二)数据加密技术
查看>>
Iptables和Firewall-selinux
查看>>
C#设置程序自启动
查看>>
Hadoop基准测试(一)
查看>>
Linux下解压缩文件命令总结
查看>>
通过cookie验证用户登录
查看>>
js-数组和字符串转化
查看>>
客户端链接如何判断Socket的实时连接
查看>>
读书笔记十四:TCP/IP详解之TCP的成块数据流
查看>>
print语句中逗号(,)和反斜杠(\)的区别
查看>>
contentType
查看>>
Java中HashMap和TreeMap的区别深入理解
查看>>
【2012年终总结】之四 获得CPU信息,剪贴板
查看>>
【转载】c++内存布局
查看>>
深入理解JVM--类的执行机制
查看>>
从Oracle向PPAS移行不成功时的处理
查看>>
Oracle 学习第一篇
查看>>
node js 库的安装
查看>>
[LeetCode] Climbing Stairs
查看>>