整理匯總Oracle常用命令 方便你我他建站知識(shí)
導(dǎo)讀:1建站知識(shí)想統(tǒng)一整理Oracle中常用的命令語(yǔ)句,以后遇到,會(huì)不斷更新此博客中。為了以后方便查詢,因此整理此博客中網(wǎng)站建設(shè)seo網(wǎng)站優(yōu)化軟件。
起因
在做Hibernate批量插入時(shí),出現(xiàn)這個(gè)錯(cuò)誤org.hibernate.QueryTimeoutException:
錯(cuò)誤原因是表空間的容量不足,需要加大空間容量;那首先想到的是應(yīng)該查詢其容量,所以應(yīng)該想辦法查詢其容量以及增大其容量。
因此
想統(tǒng)一整理Oracle中常用的命令語(yǔ)句,以后遇到,會(huì)不斷更新此博客中。為了以后方便查詢,因此整理此博客中。
Oracle中常用的命令語(yǔ)句如下:
1.創(chuàng)建用戶
create user 用戶名 identified by 密碼
注意:用戶名和密碼最好是英文
如:create user sms identified by sms;
2.創(chuàng)建表空間
create tablespace 表空間名 datafile '存放路徑' size 大小
如:create tablespace ts_sms datafile 'F:\quanxianguanliruanjian\oracle\tablespace\sms.dbf' size 100m;
3.把表空間賦值給剛創(chuàng)建的用戶
alter user 用戶 default tablespace 表空間
如:alter user sms default tablespace ts_sms;
4.給用戶賦權(quán)
grant create sesseo網(wǎng)站優(yōu)化sion,create view,create table,unlimited tablespace to 用戶
如:grant create session,create view,create table,unlimited tablespace to sms;
或者直接把DBA的權(quán)限全部賦值給用戶,這樣用戶就有了創(chuàng)建序列等權(quán)限
grant dba to user; 如:grant dba to sms;
5.切換到新建的用戶登錄
conn 用戶/密碼
如:conn sms/sms;
其中1——5是新建用戶,到導(dǎo)入sql之間的過(guò)程。
6.刪除用戶
drop user 用戶名
如:drop user sms;
7.修改用戶的密碼
alter user 用戶名 identified by 新密碼
如:alter user test identified by test;
8.查看所有的用戶
select * from dba_users; 或者 select * from all_users; 或者 select * from user_users;
其中select * from user_users;只能看當(dāng)前的用戶
9.查看當(dāng)前用戶或DBA角色的權(quán)限
select * from user_sys_privs; select * from dba_sys_privs;
10.查看表空間的容量
SQL> selecttablespace_name "表空間" , bytes/1024/1024 "總?cè)萘縈B" fromdba_data_files;
結(jié)果如下:
11.查看表空間的使用情況,剩余情況
SQL> selecta.tablespace_name as 表空間, a.bytes/1024/1024 as 總?cè)萘縈B ,(a.bytes-b.bytes)/1024/1024 "使用容量MB",b.bytes/1024/1024 "剩余容量MB",round(((a.bytes-b.bytes)/a.bytes)*100,2) "使用百分比" from (select tablespace_name,sum(bytes) bytes fromdba_data_files group by tablespace_name) a,(select tablespace_網(wǎng)站優(yōu)化seo培訓(xùn)name,sum(bytes)bytes,max(bytes) largest from dba_free_space group by tablespace_name) b where a.tablespace_name=b.tablespace_nameorder by ((a.bytes-b.bytes)/a.bytes) desc;
聲明: 本文由我的SEOUC技術(shù)文章主頁(yè)發(fā)布于:2023-05-23 ,文章整理匯總Oracle常用命令 方便你我他建站知識(shí)主要講述你我他,方便,整理匯總Oracle常用命令 方便你我他網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請(qǐng)保留鏈接: http://www.bifwcx.com/article/web_5731.html
為你推薦與整理匯總Oracle常用命令 方便你我他建站知識(shí)相關(guān)的文章
-
通王TWCMS 2.0.3網(wǎng)站模板程序下載
(126)人喜歡 2024-01-15 -
Windows官方原版在哪里下載
(175)人喜歡 2024-01-15 -
WordPress網(wǎng)站模板發(fā)帖標(biāo)題顏色設(shè)置
(131)人喜歡 2024-01-07 -
修改discuz論壇帖子標(biāo)題80字符的長(zhǎng)度限制
(249)人喜歡 2024-01-07 -
wordpress程序調(diào)用不帶超鏈接的Tag標(biāo)簽
(234)人喜歡 2024-01-05 -
網(wǎng)站在不同時(shí)期需調(diào)整內(nèi)容更新的方向
(112)人喜歡 2023-08-12