oracle11g 建立使用者並授權

2022-03-13 00:13:21 字數 4019 閱讀 5370

oracle建立使用者並給使用者授權查詢指定表或檢視的許可權

用sys賬戶登入資料庫進行如下操作:

create user northbound identified by northbound

default tablespace "tbs_dninmsv31"

temporary tablespace "temp2"

quota unlimited on "tbs_dninmsv31";

grant "connect" to northbound;

alter user northbound default role none;

grant create session to northbound;

grant select on "dninmsv31"."v_dndevice" to northbound;

grant select on "dninmsv31"."v_dnsubne" to northbound;

grant select on "dninmsv31"."v_dnpackage" to northbound;

grant select on "dninmsv31"."v_dnport" to northbound;

注:在用northbound登入後查詢的時候要在檢視前加上dninmsv31,否則會報表或檢視不存在。

例如:select * from dninmsv31.v_dndevice;     --可以正常執行

select * from dninmsv31.tb_device where rownum<5;   --執行的時候會報表或檢視不存在

grant debug any procedure, debug connect session to hnckb;

grant select on sys.dba_pending_transactions to hnckb;

grant create view,create job,create synonym to hnckb;

grant connect,resource to hnckb;

1.標準角色

connect

resource

2.系統許可權

create view

create database link

create job

create synonym

unlimited tablespace

更改定額

命令:alter user 名稱 quota 0 on 表空間名

alter user 名字 quota (數值)k|m|unlimited on 表空間名;

使用方法:

a、控制使用者資料增長

b、當使用者擁有一定的資料,而管理員不想讓他在增加新的資料的時候。

c、當將使用者定額設為零的時候,使用者不能建立新的資料,但原有資料仍可訪問。

3.物件許可權

dba_pending_transactions (select)  — xa事務支援

grant select on sys.dba_pending_transactions to user;

4.建議開放

debug connect session                — 除錯儲存過程

例如:grant debug any procedure, debug connect session to hr;

oracle建立表空間、建立使用者、授權、授權物件的訪問以及檢視許可權

1.建立臨時表空間

oracle臨時表空間主要用來做查詢和存放一些緩衝區資料。臨時表空間消耗的主要原因是需要對查詢的中間結

果進行排序。

臨時表空間的主要作用:

索引create或rebuild

order by 或 group by

distinct 操作

union 或 intersect 或 minus

sort-merge joins

create temporary tablespace 「test_temp」

tempfile 『d:\oracle\product\10.2.0\oradata\gis\test_data.ora』

size 20m

autoextend on

next 32m maxsize 2048m

extent management local;

2.建立使用者表空間

create tablespace 「test_data」

logging

datafile 『d:\oracle\product\10.2.0\oradata\gis\test_data.ora』

size 20m

autoextend on

next 32m maxsize 2048m

extent management local;

3.建立使用者並設定其表空間

username:usertest

password:userpwd

create user usertest identified by userpwd

default tablespace test_data

temporary tablespace test_temp;

4.給使用者授權

grant

create session, create any table, create any view ,create any index, create any procedure,

alter any table, alter any procedure,

drop any table, drop any view, drop any index, drop any procedure,

select any table, insert any table, update any table, delete any table

to username;

首先授權使用者testuser兩個基本的角色許可權

connect角色:    –是授予終端使用者的典型權利,最基本的     

create    session    –建立會話

resource角色:    –是授予開發人員的    

create    cluster        –建立聚簇 

create    procedure     –建立過程 

create    sequence      –建立序列 

create    table         –建表 

create    trigger       –建立觸發器 

create    type          –建立型別

create    operator      –建立操作者

create    indextype     –建立索引型別

create    table         –建立表

授權角色給使用者的sql語句:

grant role to username;

5.檢視使用者許可權

檢視所有使用者

select * from dba_users;

select * from all_users;

select * from user_users;

檢視使用者系統許可權

select * from dba_sys_privs;

select * from user_sys_privs;

檢視使用者物件或角色許可權

select * from dba_tab_privs;

select * from all_tab_privs;

select * from user_tab_privs;

檢視所有角色

select * from dba_roles;

檢視使用者或角色所擁有的角色

select * from dba_role_privs;

select * from user_role_privs;

Oracle 11g建立表空間,並授權使用者

分為四步 第1步 建立臨時表空間 create temporary tablespace 臨時表空間名稱 tempfile d oracledata 臨時表空間名稱 編號 如01 dbf size 50m autoextend on next 50m maxsize unlimited extent...

oracle11G 建立表空間並使用

1.建立 create tablespace ts1 datafile c ts ts1.dbf size 20m 表空間大小20m autoextend on next 2m maxsize 100m 當表空間滿了,自動拓展2m,最大拓展到100m extent management local ...

oracle11g之使用者管理

建立使用者 create user 使用者名稱 identified by 密碼 注意 必須是擁有特權使用者的賬號才能建立使用者 修改使用者密碼 注意 必須是擁有特權使用者的賬號才能修改使用者的密碼 刪除使用者 必須是擁有drop user的許可權才能刪除使用者 刪除使用者時,如果使用者已經建立了表...