1 查看当前
数据库中有神马用户:
select username from dba_users;
2猫猫tiger用户
conn scott/tiger
SQL> conn scott/tiger
ERROR:
ORA-28000: the account is locked
锁住了,也可能是多次输入错误的密码。
SQL> alter user scott account unlock;
User altered.
SQL> conn scott/tiger
ERROR:
ORA-28001: the password has expired
Changing password for scott
New password:
Retype new password:
Password changed
Connected.
SQL>
SQL>
SQL> conn scott/tiger
Connected.
3 查看scott用户能够有那些系统权限、对象权限
SQL> select * from user_sys_privs;
USERNAME PRIVILEGE ADM
------------------------------ ---------------------------------------- ---
SCOTT UNLIMITED TABLESPACE NO
(至少得有Create Session权限啊)
SQL> select * from user_tab_privs;
no rows selected
嘛也木有啊
4 查看 scott用户有那些表
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
DEPT
EMP
BONUS
SALGRADE
5 给scott点权限玩玩
SQL> conn / as sysdba
Connected.
SQL> grant select on hr.departments to scott;
Grant succeeded.
SQL> conn scott/tiger;
Connected.
SQL> select grantee,owner,table_name,grantor,privilege from user_tab_privs;
GRANTEE OWNER
------------------------------ ------------------------------
TABLE_NAME GRANTOR
------------------------------ ------------------------------
PRIVILEGE
----------------------------------------
SCOTT HR
DEPARTMENTS HR
SELECT
再给个系统权限,这个Create Table权限scott本身就有的
SQL> conn / as sysdba
Connected.
SQL> grant create table to scott;
Grant succeeded.
SQL> conn scott/tiger
Connected.
SQL> select * from user_sys_privs;
USERNAME PRIVILEGE ADM
------------------------------ ---------------------------------------- ---
SCOTT UNLIMITED TABLESPACE NO
SCOTT CREATE TABLE NO
6 user_tables 与 all_tables
user_tables是在该用户下自己的表,all_tables是包括着被授权的表。
每个用户看到的都不一样