達夢資料庫常用sql語句整理(1)

2021-10-10 20:25:15 字數 1785 閱讀 6460

select

*from v$tablespace

;

2.hmain 表空間檢視語句:

select

*from v$huge_tablespace;

3.檢視使用者占用的空間

使用系統函式 user_used_space 得到使用者占用空間的大小,函式引數為使用者名稱,返回值為占用的頁的數目。

select user_used_space(

'test_user'

);

4.檢視表占用的空間

以使用系統函式 table_used_space 得到表物件占用空間的大小,函式引數為模式名和表名,返回值為占用的頁的數目。

select table_used_space(

'sysdba'

,'test'

);

5.檢視表使用的頁數

以使用系統函式 table_used_pages 得到表物件實際使用頁的數目,函式引數為模式名和表名,返回值為實際使用頁的數目。

select table_used_pages(

'sysdba'

,'test'

);

6.檢視索引占用的空間

使用系統函式 index_used_space 得到索引占用空間的大小,函式引數為索引id,返回值為占用的頁的數目。

select index_used_space(

33555463

);

7.檢視索引使用的頁數

使用系統函式 index_used_pages 得到索引實際使用頁的數目,函式引數為索引id,返回值為實際使用頁的數目。

select index_used_pages(

33555463

);

8.檢視表定義

建立表後,可以通過 sp_tabledef 系統過程檢視表的定義。

call sp_tabledef(

'sysdba'

,'employee'

);

dm 通過提供的 tabledef 函式來顯示當前表的定義。當表多次進行 alter table 後,顯示的表定義將是最後一次修改後的建表語句。

9.檢視表中自增列資訊

ident_current:獲得表上自增列的當前值;

ident_seed:獲得表上自增列的種子資訊;

ident_incr:獲得表上自增列的增量資訊。

select ident_current(

'sysdba.ident_table');

select ident_seed(

'sysdba.ident_table');

select ident_incr(

'sysdba.ident_table'

);

10.檢視表的空間使用情況

table_used_space:已分配給表的頁面數;

table_used_pages:表已使用的頁面數。

select table_used_space(

'sysdba'

,'space_table');

select table_used_pages(

'sysdba'

,'space_table'

);

達夢資料庫常用SQL

達夢資料庫建立表 create table test table scid varchar2 10 primary key,scname varchar2 20 scsm number 6 scprice number 4,2 當前使用者 達夢資料庫 獲取當前使用者擁有的表 select table...

達夢資料庫使用者管理語句

使用dm管理工具,或查詢dba users sysusers資料字典可獲取資料庫使用者資訊。select from dba users select from sysusers 建立使用者前,規劃使用者的許可權 使用者下表 索引的儲存位置 規劃使用者密碼安全和資源管理。create user tes...

達夢資料查詢編碼 達夢常用sql

1 檢視儲存過程建立指令碼 select text from dba source where owner and type proc 注 owner是指使用者名稱,type可以檢視型別 比如檢視 建表等。2 檢視表的儲存大小 select segment name,bytes 1024 1024 ...