Oacle常用語句

2022-07-24 10:27:10 字數 2098 閱讀 2949

--查詢資料庫中表的記錄數  按記錄數排名

select  * from user_tables t where t.num_rows is not  null  order by t.num_rows  desc

--查詢資料庫中表的儲存空間, 按空間大小排名

select * from user_segments s  where s.bytes  is not null  order by s.bytes desc

--查詢資料庫表空間是否是自動擴充套件

select a.file_name,a.tablespace_name,a.autoextensible from dba_data_files a

--查詢資料庫各表空間的分割槽情況

select a.tablespace_name,count(*) from user_tab_partitions a

group by a.tablespace_name

--檢視資料庫的分割槽表

select * from user_part_tables 

--檢視oracle表所有注釋

select * from user_tab_comments 

--獲取字段注釋:

select * from user_col_comments

--檢視表空間使用率

select a.tablespace_name"表空間名",

total"表空間大小",

free"表空間剩餘大小",

(total - free)"表空間使用大小",

total / (1024*1024*1024)"表空間大小(g)",

free / (1024*1024*1024)"表空間剩餘大小(g)",

(total - free) / (1024*1024*1024)"表空間使用大小(g)",

round((total - free) / total,4) *100"使用率 %"

from (select tablespace_name, sum(bytes) free

from dba_free_space

group by tablespace_name) a,

(select tablespace_name, sum(bytes) total

from dba_data_files

group by tablespace_name) b

where a.tablespace_name = b.tablespace_name

mysql常用語句 MySQL常用語句

create table student id int primary key auto increment comment 學號 name varchar 200 comment 姓名 age int comment 年齡 comment 學生資訊 修改表注釋 alter table studen...

php mysql 常用語句 mysql常用語句

一 修改mysql使用者密碼 mysql h localhost u root p 命令列登入 update user set password password 123456 where user root 二 資料庫操作 show databases 顯示資料庫 create database ...

sql常用語句

use myoa select from delete from department where departmentid 1 insert department departmentid,departmentname values 1,技術部 update department set depa...