Oracle 常用SQL命令(1)

基本查询指令

select * from V$PWFILE_USERS //查看dba用户
select * from v$version //查看oracle版本以及系统版本
select * from session_privs;// 查看当前用户拥有的权限值
select * from user_role_privs查询当前用户角色
select * from user_sys_privs查询当前用户系统权限
  
  
select username,password from dba_users; //查看所有用户密码hash
select * from dba_sys_privs where grantee=’SYSTEM’;查系统权限
grant select any dictionary to system with admin option;登陆不上OEM时候需要此权限
Select name,password FROM user$ Where name=’SCOTT’; //低版本查看单用户密码
Select username,decode(password,NULL,’NULL’,password) password FROM dba_users; //查看用户hash
create user bob identified by iloveyou;建用户bob密码iloveyou
grant dba to bob;赋予bob DBA权限
grant execute on xmldom to bob 赋予用户execute  
Create ROLE "javauserpriv" NOT IDENTIFIED
Create ROLE "javasyspriv" NOT IDENTIFIED 当提示role ‘JAVASYSPRIV’ does not exist使用
select grantee from dba_role_privs where granted_role=’DBA’; 检查那些用户有DBA权限
select * from dba_directories;查看路径所在目录  
select * from V$PWFILE_USERS //查看dba用户
select * from v$version //查看oracle版本以及系统版本
select * from session_privs;// 查看当前用户拥有的权限值
select * from user_role_privs查询当前用户角色
select * from user_sys_privs查询当前用户系统权限

select username,password from dba_users; //查看所有用户密码hash
select * from dba_sys_privs where grantee=’SYSTEM’;查系统权限
grant select any dictionary to system with admin option;登陆不上OEM时候需要此权限
Select name,password FROM user$ Where name=’SCOTT’; //低版本查看单用户密码
Select username,decode(password,NULL,’NULL’,password) password FROM dba_users; //查看用户hash
create user bob identified by iloveyou;建用户bob密码iloveyou
grant dba to bob;赋予bob DBA权限
grant execute on xmldom to bob 赋予用户execute

转自网络

发表评论