创建表空间
CREATE SMALLFILE TABLESPACE TTKDTEST datafile '/opt/oracle/oradatas/otwb/dbf.DMP' SIZE 100M REUSE AUTOEXTEND ON NEXT 2048K MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
删除test用户
drop user wmsloc cascade;
创建test用户
create user wrtest identified by wrtest;
授权test用户
grant connect,resource,dba to wrtest;
--选择性授权
grant select on sy_user to user
commit;
更改表空间
select 'alter table '|| table_name ||' move tablespace tablespacename;' from user_all_tables;
select 'alter index '|| index_name ||' rebuild tablespace tablespacename;' from user_indexes;
重建索引
select 'alter index '|| index_name ||' rebuild;' from user_indexes;
正在运行的SQL
SELECT b.sid oracleID,
b.username 登录Oracle用户名,
b.serial#,
spid 操作系统ID,
paddr,
sql_text 正在执行的SQL,
b.machine 计算机名
FROM v$process a, v$session b, v$sqlarea c
WHERE a.addr = b.paddr
AND b.sql_hash_value = c.hash_value and b.username='TMS'
--查出oracle当前的被锁对象
SELECT l.session_id sid,
s.serial#,
l.locked_mode 锁模式,
l.oracle_username 登录用户,
l.os_user_name 登录机器用户名,
s.machine 机器名,
s.terminal 终端用户名,
o.object_name 被锁对象名,
s.logon_time 登录数据库时间
FROM v$locked_object l, all_objects o, v$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid
ORDER BY sid, s.serial#;