Oracle建立表空間和用戶方式
1、建立表空間、用戶(文檔模式)
用戶
建立:create user 用戶名 identified by "密碼"; 授權(quán):grant create session to 用戶名; grant create table to 用戶名; grant create tablespace to 用戶名; grant create view to 用戶名;
表空間
建立表空間(一般建N個(gè)存數(shù)據(jù)的表空間和一個(gè)索引空間):
create tablespace 表空間名 datafile ' 路徑(要先建好路徑)\***.dbf ' size *M tempfile ' 路徑\***.dbf ' size *M autoextend on --自動(dòng)增長(zhǎng) --還有一些定義大小的命令,看需要 default storage( initial 100K, next 100k, );
例子:創(chuàng)建表空間
create tablespace DEMOSPACE datafile 'E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf' size 1500M autoextend on next 5M maxsize 3000M; 刪除表空間 drop tablespace DEMOSPACE including contents and datafiles
用戶權(quán)限
授予用戶使用表空間的權(quán)限:
alter user 用戶名 quota unlimited on 表空間; 或 alter user 用戶名 quota *M on 表空間;
2、完整示例(懶人模式)
--表空間 CREATE TABLESPACE sdt DATAFILE 'F:\tablespace\demo' size 800M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; --索引表空間 CREATE TABLESPACE sdt_Index DATAFILE 'F:\tablespace\demo' size 512M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; --2.建用戶 create user demo identified by demo default tablespace sdt; --3.賦權(quán) grant connect,resource to demo; grant create any sequence to demo; grant create any table to demo; grant delete any table to demo; grant insert any table to demo; grant select any table to demo; grant unlimited tablespace to demo; grant execute any procedure to demo; grant update any table to demo; grant create any view to demo;
3、數(shù)據(jù)庫(kù)導(dǎo)入、導(dǎo)出
--導(dǎo)入導(dǎo)出命令 ip導(dǎo)出方式: exp demo/demo@127.0.0.1:1521/orcl file=f:/f.dmp full=y exp demo/demo@orcl file=f:/f.dmp full=y imp demo/demo@orcl file=f:/f.dmp full=y ignore=y
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
oracle wm_concat 列轉(zhuǎn)行 逗號(hào)分隔
oracle wm_concat函數(shù),用于列轉(zhuǎn)行,逗號(hào)分隔本文將詳細(xì)介紹此功能的應(yīng)用2012-11-11oracle數(shù)據(jù)排序后獲取前幾行數(shù)據(jù)的寫法(rownum、fetch方式)
項(xiàng)目中用到Oracle分組查詢?nèi)∶拷M排序后的前N條記錄,group?by?只能返回每個(gè)組的單條統(tǒng)計(jì),下面這篇文章主要給大家介紹了關(guān)于oracle數(shù)據(jù)排序后獲取前幾行數(shù)據(jù)的寫法(rownum、fetch方式),需要的朋友可以參考下2022-12-12Oracle排名函數(shù)(Rank)實(shí)例詳解
這篇文章主要介紹了Oracle排名函數(shù)(Rank)實(shí)例詳解,需要的朋友可以參考下2014-06-06Oracle中實(shí)現(xiàn)類似于Mysql中的Field()函數(shù)功能
這篇文章主要詳細(xì)介紹了在Oracle中如何實(shí)現(xiàn)類似于Mysql中的Field()函數(shù)功能,本文主要通過(guò)代碼示例介紹了Oracle中的Decode()函數(shù)和Oracle中的row_number,需要的朋友可以參考下2023-06-06Oracle數(shù)據(jù)庫(kù)如何獲取當(dāng)前自然周,當(dāng)前周的起始和結(jié)束日期
Oracle數(shù)據(jù)庫(kù)如何獲取當(dāng)前自然周,當(dāng)前周的起始和結(jié)束日期問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-12-12