建立臨時表空間數據庫
CREATE TEMPORARY TABLESPACE test_temp
TEMPFILE 'C:\oracle\product\10.1.0\oradata\orcl\test_temp01.dbf'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;
建立用戶表空間oracle
CREATE TABLESPACE test_data
LOGGING
DATAFILE 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\TEST_DATA01.DBF'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;
建立用戶並制定表空間spa
CREATE USER username IDENTIFIED BY password
DEFAULT TABLESPACE TEST_DATA
TEMPORARY TABLESPACE TEST_TEMP;
給用戶授予權限orm
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;
將role這個角色授與username,也就是說,使username這個用戶能夠管理和使用role所擁有的資源對象
GRANT role TO username;
給用戶撤銷權限資源
基本語法同grant,關鍵字爲revokeit
例如:revoke drop any view,drop any table from scott;table
-----------------------------------------------查看用戶權限---------------------------------------------------------
查看全部用戶test
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;
-------遇到no privileges on tablespace 'tablespace '
alter user userquota 10M[unlimited] on tablespace;
normal 是普通用戶 ;sysdba擁有最高的系統權限,登錄後是 sys;sysoper主要用來啓動、關閉數據庫,sysoper 登錄後用戶是 public;sysdba和sysoper屬於system privilege,也稱爲administrative privilege,擁有例如數據庫開啓關閉之類一些系統管理級別的權限。