与用户帐户有关的知识

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是包括着被授权的表。
每个用户看到的都不一样




来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20399666/viewspace-703279/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/20399666/viewspace-703279/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值