--(1)创建新用户
create user liu identified by liu;
create user oda identified by oda;
--(2)给新创建的用户赋予权限:
grant dba to liu;--赋予 dba 的权限
grant dba to oda;
--(3)查看用户
select * from user_users;
--(4)修改用户密码
alter user liu identified by liu2017; //修改liu用户密码为liu2017
--(5)看当前库的用户信息(有没有被锁等)
select * from dba_users;
--(6)解锁app用户
alter user liu account unlock;
--(7)查看所有用户及用户所在的表空间
select username,default_tablespace from dba_users;
-------------------------表空间--------------------------------------
--(1)查看表空间名及存储路径:
select tablespace_name,file_name from dba_data_files;
--(2)查看表空间的名称及大小
SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size
FROM dba_tablespaces t, dba_data_files d
WHERE t.tablespace_name = d.tablespace_name
GROUP BY t.tablespace_name;
--(3)查看表空间物理文件的名称及大小
SELECT tablespace_name,
file_id,
file_name,
round(bytes / (1024 * 1024), 0) total_space
FROM dba_data_files
ORDER BY tablespace_name;
--(4)查看表空间是否自动增长
SELECT FILE_NAME,TABLESPACE_NAME,AUTOEXTENSIBLE FROM dba_data_files;