創建oracle用戶及表空間,window,linux下創建oracle用戶及表空間 對比 易於學習
1、window下創(chuàng)建oracle用戶及表空間
--創(chuàng)建數(shù)據(jù)表空間
create tablespace oras_data? --表空間的名字
logging
datafile 'D:\oracle\product\10.1.0\oradata\oras_data.dbf'?? --表空間的文件,注意據(jù)庫版本,我的是10.1.0
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;? --這里是讓表空間自動增長
--創(chuàng)建用戶並指定表空間
create user orasidentified by oras? --創(chuàng)建用戶及密碼
default tablespace oras_data;???? --把用戶指定那個表空間
--給用戶授予權(quán)限
grant dba,connect,resource,CTXAPP,create view to oras;--給用戶受的一些權(quán)限
2、linux下創(chuàng)建oracle用戶及表空間
操作步驟如下:
1、登錄linux,以oracle用戶登錄(如果是root用戶登錄的,登錄后用 su - oracle命令切換成oracle用戶)
2、以sysdba方式來打開sqlplus,命令如下: sqlplus "/as sysdba"
3、查看我們常規(guī)將用戶表空間放置位置:執(zhí)行如下sql:
select name from v$datafile;
上邊的sql一般就將你的用戶表空間文件位置查出來了。
--創(chuàng)建數(shù)據(jù)表空間
create tablespace oras_data? --表空間的名字
logging
datafile '/oracle/product/10.1.0/oradata/oras_data.dbf'?? --表空間的文件,注意據(jù)庫版本,我的是10.1.0
size 32m
autoextend on
next 32m maxsize 2048m
extent management local? --這里是讓表空間自動增長
--創(chuàng)建用戶並指定表空間
create user orasidentified by oras? --創(chuàng)建用戶及密碼
default tablespace oras_data???? --把用戶指定那個表空間
--給用戶授予權(quán)限
grant dba,connect,resource,CTXAPP,create view to oras;--給用戶受的一些權(quán)限
總結(jié):不同點,
1、 window下:
logging
datafile 'D:\oracle\product\10.1.0\oradata\oras_data.dbf'
2、Linux下:
logging
datafile '/oracle/product/10.1.0/oradata/oras_data.dbf'
3、Linux下:
里面的sql語句的末尾,一般不要加? ";" 號。會執(zhí)行不了。如下,應(yīng)該把后面的";"去掉。
grant dba,connect,resource,CTXAPP,create view to oras;--給用戶受的一些權(quán)限
別的都一樣了,很簡單的。
--###########################################
--查看所有表空間的使用多少
select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;
--查看指定的表空間被索引和表各占了多少表空間。
select SEGMENT_TYPE,owner,sum(bytes)/1024/1024 from
dba_segments
where tablespacE_name='ORAS_DATA'
group by segment_type,owner
--刪除用戶,會刪除此用戶名下的所有表和視圖
drop user oras cascade
--刪除表空間
drop?? tablespace?? oras_data?? including?? contents?? and?? datafiles
總結(jié)
以上是生活随笔為你收集整理的創建oracle用戶及表空間,window,linux下創建oracle用戶及表空間 對比 易於學習的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 存定期的技巧!定期存多久合算?
- 下一篇: 农民丰收卡怎么办?办理农民丰收卡有什么好