欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Oracle創(chuàng)建用戶與表空間的絕對(duì)干貨(建議收藏)

 更新時(shí)間:2022年09月06日 09:44:56   作者:開發(fā)大叔  
在JAVAEE工程當(dāng)中時(shí)常用的Oracle數(shù)據(jù)庫,作為一名后臺(tái)程序開發(fā)人員,掌握如何在Oracle創(chuàng)建用戶,表空間是一項(xiàng)必備的技能,下面這篇文章主要給大家介紹了關(guān)于Oracle創(chuàng)建用戶與表空間的相關(guān)資料,需要的朋友可以參考下

Oracle-創(chuàng)建用戶

查看表空間

select 
tablespace_name, file_id, file_name, 
round(bytes/(1024*1024),0) total_space_MB 
from 
dba_data_files 
order 
by 
tablespace_name;

Oracle 創(chuàng)建表空間

create tablespace 表空間名字 --空間名
datafile '數(shù)據(jù)存儲(chǔ)路徑\***.dbf' --路徑
size 5M --初始大小
autoextend on next 5M --表空間每次增長大小
maxsize 3000M --表空間最大內(nèi)存

Oracle 修改表空間大小

alter database datafile 'E:\DATA\ORACLE\.DBF' resize 20480m

—創(chuàng)建用戶

create user "****" identified by xyx2021 default tablespace "****";

—用戶授權(quán)

grant connect, resource to "***";
grant create session to "***";

—修改用戶BEE表空間

Alter user BEE default tablespace BEE 

–刪除表空間

drop tablespace fish;

總結(jié)

Oracle安裝完后,其中有一個(gè)缺省的數(shù)據(jù)庫,除了這個(gè)缺省的數(shù)據(jù)庫外,我們還可以創(chuàng)建自己的數(shù)據(jù)庫。

為了避免麻煩,可以用’Database Configuration Assistant’向?qū)韯?chuàng)建數(shù)據(jù)庫(這步一定要?jiǎng)?chuàng)建好,因?yàn)檫@里沒有做好,會(huì)在創(chuàng)建表空間時(shí)出錯(cuò)—我就在這里花了幾個(gè)小時(shí),暈)。

創(chuàng)建完數(shù)據(jù)庫后,并不能立即在數(shù)據(jù)庫中建表,必須先創(chuàng)建該數(shù)據(jù)庫的用戶,并且為該用戶指定表空間。

下面是創(chuàng)建數(shù)據(jù)庫用戶的具體過程:

1.假如現(xiàn)在已經(jīng)建好名為’test’的數(shù)據(jù)庫,此時(shí)在d:\oracle\oradata\目錄下已經(jīng)存在test目錄(注意:我的Oracle11g安裝在d:\oracle下,若你的Oracle安裝在別的目錄,那么你新建的數(shù)據(jù)庫目錄就在*\oradata\目錄下)。

2.在創(chuàng)建用戶之前,先要?jiǎng)?chuàng)建表空間:

其格式為:格式: create tablespace 表間名 datafile ‘數(shù)據(jù)文件名’ size 表空間大小;

如: SQL> create tablespace test_tablespace datafile ‘d:\oracle\oradata\test\test.dbf’ size 100M;

其中’test_tablespace’是你自定義的表空間名稱,可以任意取名;

‘d:\oracle\oradata\test\test.dbf’是數(shù)據(jù)文件的存放位置,’test.dbf’文件名也是任意??;

‘size 100M’是指定該數(shù)據(jù)文件的大小,也就是表空間的大小。

刪除命名空間

DROP TABLESPACE test INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;

3.現(xiàn)在建好了名為’test_tablespace’的表空間,下面就可以創(chuàng)建用戶了:

其格式為:格式: create user 用戶 名 identified by 密碼 default tablespace 表空間表;

如: SQL> create user testone identified by testone default tablespace test_tablespace;

默認(rèn)表空間’default tablespace’使用上面創(chuàng)建的表空間。

4.接著授權(quán)給新建的用戶:

SQL> grant connect,resource to testone; –表示把 connect,resource權(quán)限授予testone用戶

SQL> grant dba to testone; –表示把 dba權(quán)限授予給testone用戶 授權(quán)成功。

ok! 數(shù)據(jù)庫用戶創(chuàng)建完成,現(xiàn)在你就可以使用該用戶創(chuàng)建數(shù)據(jù)表了!

到此這篇關(guān)于oracle創(chuàng)建用戶過程詳解的文章就介紹到這了,更多相關(guān)oracle創(chuàng)建用戶內(nèi)容后續(xù)有時(shí)間會(huì)陸續(xù)更新,以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,初來乍到希望大家以后多多支持

相關(guān)文章

最新評(píng)論