0、准备工作
SQL> createtablespace tbs_peenboo
2 datafile '/home/oracle/app/oracle/oradata/orcl/tbs_peenboo01.dbf'
3 size20m autoextend on next 5m maxsize 2G
4 logging
5 extent management local
6 segment space management auto
7 default nocompress;
Tablespace created.
SQL> create userpeenboo
2 default tablespace tbs_peenboo temporary tablespace temp
3 quota unlimited on tbs_peenboo
4 identified by pb1234
5 password expire
6 account unlock;
User created.
SQL> grant createsession,alter session,create table,create view,create synonym, create cluster,create database link,createsequence,create trigger,create type,create procedure,create operator to dev;
Grant succeeded.
SQL> grantdev,resource,dba to peenboo with admin option;
Grant succeeded.
##注:授予权限一定要非常小心,且进行验证。
SQL> select *from dba_role_privs where grantee='PEENBOO';
GRANTEE GRANTED_ROLE ADM DEF
----------------------------------------------------------- ---
PEENBOO DBA YES YES
PEENBOO RESOURCE YES YES
PEENBOO DEV YES YES
SQL> revoke dba frompeenboo;
SQL> select *from dba_role_privs
2 where grantee='PEENBOO';
GRANTEE GRANTED_ROLE ADM DEF
------------------------------------------------------------ --- ---
PEENBOO RESOURCE YES YES
PEENBOO DEV YES YES
SQL> conn peenboo
Enter password:
ERROR:
ORA-28001: thepassword has expired
Changing passwordfor peenboo
New password:
Retype new password:
Password changed
Connected.
SQL>