可以執行以下語句:select username,serial#, sid from v$session; 查詢用戶會話alter system kill session 'serial#, sid '; 刪除相關用戶會話 建議以後臺登陸刪除用戶會話1、查詢oracle的連接數select coun ...
可以執行以下語句:
select username,serial#, sid from v$session; ---查詢用戶會話
alter system kill session 'serial#, sid ';---刪除相關用戶會話
建議以後臺登陸刪除用戶會話
1、查詢oracle的連接數
select count(*) from v$session;
2、查詢oracle的併發連接數
select count(*) from v$session where status='ACTIVE';
3、查看不同用戶的連接數
select username,count(username) from v$session where username is not null group by username;
4、查看所有用戶:
select * from all_users;
5、查看用戶或角色系統許可權(直接賦值給用戶或角色的系統許可權):
select * from dba_sys_privs;
select * from user_sys_privs;
6、查看角色(只能查看登陸用戶擁有的角色)所包含的許可權
select * from role_sys_privs;
7、查看用戶對象許可權:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
8、查看所有角色:
select * from dba_roles;
9、查看用戶或角色所擁有的角色:
select * from dba_role_privs;
select * from user_role_privs;
10、查看哪些用戶有sysdba或sysoper系統許可權(查詢時需要相應許可權)
select * from V$PWFILE_USERS;
修改資料庫允許的最大連接數:
alter system set processes = 300 scope = spfile;
查看游標數量
Select * from v$open_cursor Where user_name=''
查詢資料庫允許的最大連接數:
select value from v$parameter where name = 'processes';
或者:show parameter processes;
查詢資料庫允許的最大游標數:
select value from v$parameter where name = 'open_cursors'
查看oracle版本
select banner from sys.v_$version;
按降序顯示用戶"SYSTEM"為每個會話打開的游標數
select o.sid, osuser, machine, count(*) num_curs from v$open_cursor o, v$session s where user_name = 'SYSTEM' and o.sid=s.sid group by o.sid, osuser, machine order by num_curs desc;
以上轉載自 https://www.cnblogs.com/caogang/p/4546072.html
保留兩位小數以GB為單位顯示數據文件大小
SELECT ROUND(SUM(BYTES)/1024/1024/1024,2)||'GB' FROM DBA_DATA_FILES;
以MB為單位表空間分組顯示數據文件大小
SELECT TABLESPACE_NAME,SUM(BYTES)/1024/1024 AS MB FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME;
顯示資料庫中臨時文件的大小
SELECT SUM(BYTES)/1024/1024/1024 AS GB FROM DBA_TEMP_FILES;
顯示資料庫中日誌文件的大小
SELECT SUM(BYTES)/1024/1024/1024 AS GB FROM V$LOG;
顯示資料庫中數據文件、臨時文件、日誌文件的總大小
SELECT SUM(GB) AS GB
FROM(
SELECT SUM(BYTES)/1024/1024/1024 AS GB
FROM DBA_DATA_FILES
UNION ALL
SELECT SUM(BYTES)/1024/1024/1024
FROM DBA_TEMP_FILES
UNION ALL
SELECT SUM(BYTES)/1024/1024/1024
FROM V$LOG
);
SELECT ROUND(SUM(BYTES) / 1024 / 1024, 2) "USED(M)"
FROM DBA_SEGMENTS
GROUP BY OWNER, TABLESPACE_NAME
ORDER BY SUM(BYTES) DESC;
--1、查看所有表空間及表空間大小:
select tablespace_name ,sum(bytes) / 1024 / 1024 as MB from dba_data_files group by tablespace_name;
--2、查看所有表空間對應的數據文件:
select tablespace_name,file_name from dba_data_files;
--3、修改數據文件大小:
alter database datafile 'H:\ORACLE\PRODUCT\10.1.0\ORADATA\ORACLE\USERS01.DBF' RESIZE 10240M;
select file_name,bytes/1024/1024 MB from dba_data_files;