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