创建表空间与用户
切换oracle用户
su - oracle
连接数据库
sqlplus /nolog
conn /as sysdba
创建临时表空间,路径和临时表空间名都可以自己指定
create temporary tablespace MES_TEMP tempfile '${ORACLE_HOME}\oradata\MES_TEMP.bdf' size 100m reuse autoextend on next 20m maxsize unlimited;
创建表空间.路径和表空间名都可以自己指定
create tablespace MES datafile '${ORACLE_HOME}\oradata\MES.dbf' size 100M reuse autoextend on next 40M maxsize unlimited default storage(initial 128k next 128k minextents 2 maxextents unlimited);
创建用户并指定表空间
create user mes identified by mes default tablespace MES temporary tablespace MES_TEMP;
或者使用默认表空间
create user mes identified by mes
给用户授权
grant dba to mes;
grant connect,resource to mes;
grant select any table to mes;
grant delete any table to mes;
grant update any table to mes;
grant insert any table to mes;
用户创建完成,可以使用新用户测试连接
删除临时表空间
查询临时表空间文件
select name from v$tempfile;
删除临时表空间文件
drop tablespace MES_TEMP including contents and datafiles;
重新查询临时表空间文件
select name from v$tempfile;
临时表空间删除成功,
删除表空间
查询表空间文件
select name from v$datafile;
停止表空间使用
alter tablespace MES offline;
删除表空间文件
drop tablespace MES including contents and datafiles;
重新查询表空间文件
select name from v$datafile;
表空间删除成功
删除用户
drop user mes cascade;