oracle建表空间、创建用户

SELECT * FROM dba_tablespaces ;

--删除表空间
drop tablespace 表空间名 including contents and datafiles ;

--创建表空间
create tablespace 表空间名 datafile '+DATA_ORA' size 20G ;
alter tablespace 表空间名 add datafile '+DATA_ORA' size 20G ;

--创建用户
create user 用户名 identified by 密码 default tablespace 表空间名;


--修改用户密码
alter user 用户名 identified by 密码 ;

--查看被锁的用户
SELECT * FROM dba_users t where t.username like '用户名' ;

--给用户解锁
alter user 用户名 account unlock;


--给用户赋予权限
grant connect,resource,create session,create table,create any index,create sequence,create any procedure,create view,drop any table,drop any index,drop any sequence,drop any procedure,drop any view,select any table  to 用户名  ;

alter user 用户名 quota 0 on USERS  ;
alter user 用户名 quota unlimited on 表空间名 ;

--查看会话
SELECT * FROM v$session t where t.pADDR = '与进程的ADDR'

--查看进程
SELECT * FROM v$process where spid = '进程id';

--根据某一个进程ID查看会话
SELECT t.* FROM v$process p, v$session t where p.ADDR = t.PADDR and p.SPID = '进程id' ;

--根据某一个进程ID查看该进程执行的SQL语句
SELECT a.* FROM v$sqlarea a, v$session n, v$process p where a.SQL_ID = n.SQL_ID and n.PADDR = p.ADDR and p.SPID = '进程id' ;


--杀掉会话
alter system kill session 'sid,serial#';

猜你喜欢

转载自bian1024.iteye.com/blog/1622537