Oracle Database 用户相关

Posted by     "lxg" on Monday, August 5, 2024

使用sysdba登陆

sqlplus sys/oracle as sysdba

查询DBA权限用户

select GRANTEE as username,admin_option from dba_role_privs where GRANTED_ROLE='DBA'

使用账号密码登录

sqlplus username/password  如:普通用户登录  sqlplus scott/tiger
sqlplus username/password as sysdba 如:sqlplus sys/admin as sysdba
sqlplus username/password@net_service_name 如: sqlplus scott/tiger@orcl
sqlplus username/password@//host:port/sid 

创建用户

create user lxg identified by "lxg"   
default tablespace lxg; 

删除用户

加了cascade就可以把用户连带的数据全部删掉。

drop user lxg cascade;

查看用户

查看数据库中所有的用户,前提是dba权限

select * from dba_users; 

查看当前账号能管理的用户

select * from all_users; 

查看当前用户信息

select * from user_users; 

给lxg用户修改密码

alter user lxg identified by lxg123456;
``



## 给lxg用户赋权  
``` sql
grant connect,resource to lxg;  
grant create any sequence to lxg;  
grant create any table to lxg;  
grant delete any table to lxg;  
grant insert any table to lxg;  
grant select any table to lxg;  
grant unlimited tablespace to lxg;  
grant execute any procedure to lxg;  
grant update any table to lxg;  
grant create any view to lxg;  

「真诚赞赏,手留余香」

Little Star Blog

真诚赞赏,手留余香

使用微信扫描二维码完成支付