Oracle建立表空間和使用者

2021-06-12 22:15:14 字數 2699 閱讀 5191

oracle建立表空間和使用者                 

[sql]view plain

copy

建立表空間和使用者的步驟:  

使用者  

建立:create

user 使用者名稱 identified by

"密碼";  

授權:grant

create session to 使用者名稱;  

grant

create

table

to  使用者名稱;  

grant

create tablespace to  使用者名稱;  

grant

create

view

to  使用者名稱;  

[sql]view plain

copy

表空間  

建立表空間(一般建n個存資料的表空間和乙個索引空間):  

create tablespace 表空間名  

datafile ' 路徑(要先建好路徑)\***.dbf  '

size *m  

tempfile ' 路徑\***.dbf '

size *m  

autoextend on

--自動增長

--還有一些定義大小的命令,看需要

default storage(  

initial 100k,  

next 100k,  

);  

[sql]view plain

copy

例子:建立表空間  

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  

[sql]view plain

copy

使用者許可權  

授予使用者使用表空間的許可權:  

alter

user 使用者名稱 quota unlimited on 表空間;  

或 alter

user 使用者名稱 quota *m on 表空間;  

完整例子:

[sql]view plain

copy

--表空間

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 demo;  

--3.賦權

grant

connect,resource to demo;  

grant

create

anysequence

to demo;  

grant

create

anytable

to demo;  

grant

delete

anytable

to demo;  

grant

insert

anytable

to demo;  

grant

select

anytable

to demo;  

grant unlimited tablespace to demo;  

grant

execute

anyprocedure

to demo;  

grant

update

anytable

to demo;  

grant

create

anyview

to demo;  

[sql]view plain

copy

--匯入匯出命令   

ip匯出方式: exp demo/[email protected]: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  

Oracle建立表空間和使用者

oracle建立表空間和使用者 sql view plain copy 建立表空間和使用者的步驟 使用者 建立 create user 使用者名稱 identified by 密碼 授權 grant create session to使用者名稱 grant create table to使用者名稱 ...

Oracle建立表空間和使用者

oracle建立表空間和使用者 sql view plain copy 建立表空間和使用者的步驟 使用者 建立 create user 使用者名稱 identified by 密碼 授權 grant create session to使用者名稱 grant create table to使用者名稱 ...

Oracle建立表空間和使用者

oracle建立表空間和使用者 sql view plain copy print?建立表空間和使用者的步驟 使用者 建立 create user 使用者名稱 identified by 密碼 授權 grant create session to 使用者名稱 grant create table t...