Oracle資料庫之系統表查詢

2021-08-15 05:48:27 字數 1476 閱讀 6067

一、系統表的定義及欄位含義;

1、v$process:

這個檢視提供的資訊,都是oracle服務程序的資訊,沒有客戶端程式相關的資訊

服務程序分兩類,一是後台的,一是dedicate/shared server

pid, serial#     這是oracle分配的pid

spid             這才是作業系統的pid

program          這是服務程序對應的作業系統程序名

2、v$session:

這個檢視主要提供的是乙個資料庫connect的資訊,

主要是client端的資訊,比如以下字段:

machine     在哪台機器上

terminal    使用什麼終端

osuser      作業系統使用者是誰

program     通過什麼客戶端程式,比如toad

process    作業系統分配給toad的程序號

logon_time  在什麼時間

username    以什麼oracle的帳號登入

command     執行了什麼型別的sql命令

sql_hash_value  sql語句資訊

3、有一些是server端的資訊:

paddr   即v$process中的server程序的addr

server  伺服器是dedicate/shared

二、查詢語句

1、檢視當前的資料庫連線數

select count(*) from v$process ;    --當前的資料庫連線數

2、資料庫允許的最大連線數

select value from v$parameter where name ='processes';  --資料庫允許的最大連線數

3、修改資料庫最大連線數

alter system set processes = 300 scope = spfile;  --修改最大連線數:

4、關閉/重啟資料庫

shutdown immediate; --關閉資料庫

startup; --重啟資料庫

5、檢視當前有哪些使用者正在使用資料

select osuser, a.username, cpu_time/executions/1000000||'s', b.sql_text, machine

from v$session a, v$sqlarea b

where a.sql_address =b.address

order by cpu_time/executions desc;  --檢視當前有哪些使用者正在使用資料

6、 --當前的session連線數

select count(*) from v$session  --當前的session連線數

7、當前併發連線數

select count(*) from v$session where status='active'; --併發連線數

oracle資料庫員工表查詢

孟子辰 2016 11 28 10 13 1 請從表emp中查詢工種是職員clerk或經理manager的雇員姓名 工資。select ename,sal from emp where job clerk or job manager 2 請在emp表中查詢部門號在10 30之間的雇員的姓名 部門號...

oracle 資料庫表結構查詢

oracle查詢使用者所有表的語句 select from all tab comments 查詢所有使用者的表,檢視等 select from user tab comments 查詢本使用者的表,檢視等 select from all col comments 查詢所有使用者的表的列名和注釋.s...

資料庫 oracle查詢表資訊

修改資料庫中一張表指定欄位的資料,該字段在其他表中也存在,需要同步修改 此時需要統計資料庫中所有包含該字段的表。獲取表字段 select from user tab columns where table name 使用者表 獲取表注釋 select from user tab comments w...