1. 程式人生 > >oracle建立使用者及表空間,收回許可權,授予角色等sql整合

oracle建立使用者及表空間,收回許可權,授予角色等sql整合

--建立使用者
--create user userName identified by password; 
--建立表空間
--create tablespace tableSpaceName datafile '/home/oracle/app/oracle/oradata/orcl/tableSpaceName.dbf' size 200M;

--建立好表空間,還需要將表空間分配給使用者. 
--alter user userName default tablespace tableSpaceName; 
--給使用者分配了表空間,使用者還不能登陸(沒有登入許可權),因此還需要為使用者分配許可權 
--grant create
session,create table,create view,create sequence,unlimited tablespace to userName; --建立儲存過程的許可權 --grant create any procedure to userName; --grant execute any procedure to userName; --收回使用者所有許可權或者角色 REVOKE 使用者所具有的角色或者許可權名 FROM 使用者; --REVOKE roleName||prmName FROM userName; --檢視使用者許可權 --select * from
dba_sys_privs t where t.grantee='USERNAME'; --查詢使用者通過role賦權所得到的許可權: --SELECT * FROM DBA_ROLE_PRIVS T WHERE T.grantee='USERNAME'; --select privilege from dba_sys_privs where grantee='USERNAME' --union --select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where
grantee='USERNAME' ); --建立角色 --create role roleName; --給角色許可權 或者使用者授權 --grant create session,create table,create view,create sequence to roleName; --修改使用者角色 --刪除角色 --drop role roleName; --登入授權; --grant connect to roleName;