oracle維護資訊 備註!

2021-09-01 09:56:10 字數 2213 閱讀 6476

檢視oracle 會話詳細資訊

select

p.spid srv_pid, p.username srv_user, p.terminal srv_term, p.program srv_prog,

s.sid, s.serial#, s.username db_user, s.logon_time, s.status, s.osuser cli_user, s.process cli_pid, s.machine cli_host, s.terminal cli_term, s.program cli_prog

from v$process p, v$session s

where p.addr = s.paddr(+)

and p.pid <> 1;

select * from v$session t order by t.last_active_time desc;

desc v$session

檢視程序使用時間

select osuser,a.username,cpu_time/executions/1000000||'s',sql_fulltext,

machine from v$session a,v$sqlarea b

where a.sql_address=b.address order by cpu_time/executions desc

1.查詢資料庫當前程序的連線數:

select count(*) from v$process;

2.檢視資料庫當前會話的連線數:

select count(*) from v$session;

3.檢視資料庫的併發連線數:

select count(*) from v$session where status='active';

4.檢視當前資料庫建立的會話情況:

select sid,serial#,username,program,machine,status from v$session;

5.查詢資料庫允許的最大連線數:

select value from v$parameter where name = 'processes';

或者命令:show parameter processes;

檢視oracle執行過的sql語句:

select * from v$sqlarea t order by t.last_active_time desc;

oracle檢視鎖,殺會話

select * from v$lock where ctime<3600;

檢視哪些會話加鎖

select sid, serial# from v$session where sid='';

根據查出來的sid,查詢serial

alter system kill session 'sid,serial#';

殺死會話

select spid from v$process where addr=(select paddr from v$session where sid=); 

kill -9 spid

直接用作業系統命令殺死程序,更常用

檢視當前開啟的游標數。

select   name,value   from   v$sysstat where name='opened cursors current';
資料庫中允許的最大游標數

show parameter open_cursors;

修改最大游標

alter system set open_cursors=1000;

//開啟游標的個數

select count(*) from v$open_cursor

//檢視某個使用者開啟的游標

select * from v$open_cursor where user_name='police'

Oracle 查詢表資訊(字段 備註)

獲取表字段 select from user tab columns where table name 使用者表 order by column name 獲取表注釋 select from user tab comments where table name 使用者表 order by table...

Oracle 查詢表資訊(字段 備註)

sql view plain copy 獲取表字段 select from user tab columns where table name 使用者表 order by column name 獲取表注釋 select from user tab comments where table name...

MySQL查詢備註資訊

在mysql下執行完下面這個建表語句後。如何從資料字典中,檢索出這個表的字段的相關資訊?drop table if exists test table create table test table test id int not null auto increment primary key co...