1.增加数据库用户:(user01/pwd)
2.给用户user01授权:
3.删除用户:
4.解锁用户:
5.修改用户密码:
6.显示当前连接用户:
9.查看属于某用户创建的表或字段(记得用户名要大写):
拥有表:
10.显示当前连接用户默认表空间:
11.查看当前库的所有数据表:
create user user01
identified by pwd
default tablespace users
Temporary TABLESPACE Temp;
2.给用户user01授权:
grant connect,resource,dba to user01;
grant sysdba to user01;
commit;
3.删除用户:
drop user user01;
4.解锁用户:
alter user scott account unlock;
5.修改用户密码:
alter user scott identified by tiger;
6.显示当前连接用户:
方法1:SHOW USER
方法2:SELECT USER FROM dual;
7.切换连接用户:
切换成普通用户:conn scott/tiger;
切换成DBA用户:conn sys/密码 AS SYSDBA;
(conn 可以用“connect”替换)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
8.通过DBA用户连接数据库后,可以从dba_users视图中查询得到Oracle用户的口令加密串:
SQL> select username,password from dba_users where username='SYS';
9.查看属于某用户创建的表或字段(记得用户名要大写):
拥有表:
select table_name from all_tables where owner = 'SCOTT';
字段:
select table_name, column_name, data_type
from all_tab_columns
where owner = 'SCOTT'
and table_name = 'DEPT';
10.显示当前连接用户默认表空间:
select username,default_tablespace from user_users;
(在PL/SQL Developer上显示可能会不准确)
11.查看当前库的所有数据表:
SQL> select TABLE_NAME from all_tables;