Oracle的功能性sql
作者:互联网
--创建表空间
CREATE TABLESPACE FSNEWDATAFILE 'E:\oracle\oracledata\oradata\FSNEW' SIZE 30G
EXTENT MANAGEMENT LOCAL
UNIFORM SIZE 1M;
--查看当前用户所有表
select * from user_tables;--查看所有用户及其表空间
select username,default_tablespace from dba_users ;select * from all_users;
--删除用户及其所有配置
drop user zjh CASCADE;--修改用户的表空间
alter user fsnew default tablespace fsnew;--删除表空间
drop tablespace FSNEW including contents and datafiles cascade constraint;--修改表空间状态
alter tablespace FSNEW online;select * from dba_tablespaces;
select name from v$datafile;
alter tablespace FSNEW rename datafile 'E:\oracledata\FSNEW' to 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\XXX';
alter database rename file 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF' to 'E:\oracledata\orcl\SYSTEM01.DBF'; CREATE USER case IDENTIFIED BY case DEFAULT TABLESPACE XXX;
GRANT RESOURCE,DBA,CONNECT TO case ; grant alter any table to case with admin option;
grant create session to case with admin option;
grant delete any table to case with admin option;
grant select any table to case with admin option;
grant unlimited tablespace to case with admin option;
grant update any table to case with admin option; select 'create or replace synonym ' || synonym_name || ' for fsnew.' || table_name || ';'
from user_synonyms;
--create or replace synonym T_CZ_FAX for fsnew.T_CZ_FAX; select * from t_srhs_hsxtcs t for update;
select banner||':'||(select utl_inaddr.get_host_name() from dual) version from v$version where rownum=1 --解决锁表
SELECT l.session_id sid,
s.serial#
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# ; alter system kill session '128,3778';
alter system kill session '153,2841';
标签:case,功能性,session,tablespace,sql,Oracle,FSNEW,alter,select 来源: https://www.cnblogs.com/casefour/p/11724450.html