Oracle 创建表空间

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

----创建表空间并定义路径
create  tablespace nacos --表空间名
datafile 'D:/app/Administrator/oradata/nacos/nacos.dbf' 
size 500m  --大小初始值
autoextend on  --自动扩展
next 50m maxsize 20480m  --每次扩展50m,最大为20480m
extent management local;

----创建临时表空间并定义路径
create temporary tablespace nacos_temp
tempfile 'D:/app/Administrator/oradata/nacos/nacos_temp.dbf'
size 32m
autoextend on next 32m maxsize 1024m
extent management local;


----删除用户
----1.先查询要删除的用户连接情况,如果还有进行,则先关掉进行再删除用户
select username,sid,serial#,status from v$session where username='nacos'; 
alter system kill session '134,72'; 
alter system kill session '143,64'; 
----2删除用户
drop user nacos cascade;

----创建用户
create user nacos identified by nacos default tablespace nacos
temporary tablespace nacos_temp;
--给用户赋权限
grant connect,resource to nacos;
grant dba to nacos;
--修改用户名和密码
 alter user nacos identified by 123456
--给空表分配segment(字符)
alter system set deferred_segment_creation=false;
--查看当前表空间
select INSTANCE_NAME from v$instance;


版权声明:本文为qq_34952021原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。