用户视图
SQL> desc dba_users;
LINEID NAME TYPE$ NULLABLE
---------- --------------------------- -------------- --------
1 USERNAME VARCHAR(128) N
2 USER_ID INTEGER N
3 PASSWORD VARCHAR(8) Y
4 ACCOUNT_STATUS VARCHAR(24) Y
5 LOCK_DATE VARCHAR(26) Y
6 EXPIRY_DATE DATETIME(6) Y
7 DEFAULT_TABLESPACE VARCHAR(128) Y
8 TEMPORARY_TABLESPACE VARCHAR(4) Y
9 CREATED DATETIME(6) Y
10 PROFILE VARCHAR(32767) Y
11 INITIAL_RSRC_CONSUMER_GROUP VARCHAR(1) Y
LINEID NAME TYPE$ NULLABLE
---------- ------------------- ----------- --------
12 EXTERNAL_NAME VARCHAR(1) Y
13 PASSWORD_VERSIONS INTEGER Y
14 EDITIONS_ENABLED VARCHAR(1) Y
15 AUTHENTICATION_TYPE VARCHAR(19) Y
16 NOWDATE DATETIME(0) Y
16 rows got
SQL> select username,user_id,account_status from dba_users;
LINEID USERNAME USER_ID ACCOUNT_STATUS
---------- ---------- ----------- --------------
1 SYSSSO 50331651 OPEN
2 SYSDBA 50331649 OPEN
3 SYS 50331648 OPEN
4 SYSAUDITOR 50331650 OPEN
used time: 7.868(ms). Execute id is 8.
创建用户:
SQL> create user test identified by test limit connect_time 3;
密码要求报错
create user test identified by test limit connect_time 3;
[-2504]:Error in line: 1
Password length invalid.
used time: 2.490(ms). Execute id is 0.
SQL> create user test identified by teste123456;
executed successfully
used time: 5.843(ms). Execute id is 11.
创建成功
用户登录
SQL> conn test/teste123456
Server[LOCALHOST:5236]:mode is normal, state is open
login used time: 3.894(ms)
查询当前用户
SQL> select username from user_users;
LINEID USERNAME
---------- --------
1 TEST
used time: 6.011(ms). Execute id is 12.
查询当前用户
SQL> select user();
LINEID USER()
---------- ------
1 TEST
used time: 0.616(ms). Execute id is 13.
创建表
SQL> create table test as select * from sysobjects;
create table test as select * from sysobjects;
[-5515]:Error in line: 1
No create table privilege.
used time: 0.320(ms). Execute id is 0.
没有权限
SQL> conn sysdba/Dm1234567;
Server[LOCALHOST:5236]:mode is normal, state is open
login used time: 2.912(ms)
赋权
SQL> grant dba to test;
executed successfully
used time: 5.195(ms). Execute id is 14.
SQL> conn test/teste123456;
Server[LOCALHOST:5236]:mode is normal, state is open
login used time: 3.391(ms)
创建表成功
SQL> create table test as select * from sysobjects;
executed successfully
used time: 7.681(ms). Execute id is 15.
查看
SQL> select count(*) from test;
LINEID COUNT(*)
---------- --------------------
1 1324
used time: 0.629(ms). Execute id is 16.
SQL> conn SYSDBA/Dm1234567
Server[LOCALHOST:5236]:mode is normal, state is open
login used time: 3.068(ms)
更改用户密码
SQL> alter user sysdba identified by sysdba;
executed successfully
used time: 4.710(ms). Execute id is 17.
SQL> alter user test limit session_per_user 10, connect_idle_time unlimited;
executed successfully
used time: 3.690(ms). Execute id is 18.
删除用户
SQL> drop user test;
drop user test;
[-2639]:Error in line: 1
Try to drop depended object [TEST].
used time: 0.643(ms). Execute id is 0.
有内容需要使用cascade
SQL> drop user test cascade;
executed successfully
used time: 30.408(ms). Execute id is 19.
SQL>
打开dm manager 可以管理