ORACLE 的一些操作

2021-08-25 12:41:55 字數 711 閱讀 1138

檢視表建立時間

select ao.*

from all_objects ao

where object_name = 'module'

and object_type = 'table';

select * from user_tables;

select username,count(username) from v$session where username is not null group by username ;

/**­

*遞迴查詢­

*表結構,id,name,url,parentid,remark,­

*/­select a.*,level from module a ­

start with id in('2c9081f7223e302b01223e302bb30000') --樹頂級節點­

connect by prior id=parentid --prior 是遞迴必要關鍵字,如果沒有prior 則只查詢一級不會遞迴查下去

:start with ...connect by 的用法, start with 後面所跟的就是就是遞迴的種子。

遞迴的種子也就是遞迴開始的地方 connect by 後面的"prior" 如果預設:則只能查詢到符合條件的起始行,並不進行遞迴查詢;

connect by prior 後面所放的字段是有關係的,它指明了查詢的方向

oracle的一些操作

1.select count from v session select count from v process 檢視當前總會話數和程序數,這兩個檢視就是跟會話及程序有關的重要檢視啦,資訊都是從這裡面取的。2.查詢那些應用的連線數此時是多少 select b.machine,b.program c...

oracle的一些操作

dba可以檢視資料庫有多少個使用者 select username from dba users dba如何檢視oracle有多少個表空間。select tablespace name from dba tablespaces 檢視乙個表空間有多少張表,而且表空間名字是字串,區分大小寫 select...

ORACLE 一些操作語句

查詢表的外來鍵 包括名稱,引用表的表名和對應的鍵名,下面是分成多步查詢 select from user constraints c where c.constraint type r and c.table name 要查詢的表 查詢外來鍵約束的列名 select from user cons c...