1,sqlplus 登入 dba 账号

sqlplus / as sysdba

2,对于用户的操作,以下的操作都以用户 test1/test1 为例

1,创建用户,并查看是否创建成功

create user test1 identified by test1;
select * from dba_users t where t.username = 'TEST1';

2,用户授权,权限大概分三种 (connect 连接, resource 数据,dba 管理员)

授予连接权限和数据权限的语句,完成这一步,我们就可以用客户端连接改用户了

grant connect, resource to test1;

3,修改用户密码

将 test1 账号的 密码修改为 test2

alter user test1 identified by test2; 

4,设置密码不过期

alter profile default limit password_life_time unlimited;

5,删除用户

drop user test1;          -- 普通账号
drop user test1 cascade;  -- 带数据权限的

3,一些查询

1,关于用户的查询

select * from dba_users;       -- 查询数据库下的所有用户(需要 dba 权限)
select * from all_users;       -- 查询数据库下的所有用户(相对于上一条,查询结果字段比较少)
select * from user_users;      -- 查询当前用户的相关信息
select userenv ('language') from dual;  -- 查询字符集

2,关于用户下的表的查询

select * from user_tables;     -- 查询当前用户下的所有表
select * from user_sequences;  -- 查询当前用户下的所有序列
select t.name from user_source t where t.type = 'TRIGGER' group by t.name; -- 查询当前用户下所有触发器

相关文章:

  • 2021-12-29
  • 2021-08-31
  • 2021-08-02
  • 2022-01-06
  • 2022-02-27
  • 2022-12-23
  • 2022-01-15
  • 2021-05-16
猜你喜欢
  • 2021-12-06
  • 2022-12-23
  • 2022-01-31
  • 2021-05-08
  • 2021-04-14
  • 2021-06-19
  • 2022-02-09
相关资源
相似解决方案