设为首页 加入收藏

TOP

oracle_创建表空间_临时表空间_修改表空间_以及自增长
2019-09-17 17:23:02 】 浏览:18
Tags:oracle_ 创建 空间 临时 修改 以及 增长

管理员用户登录oracle数据库

[oracle@DBORACLE ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jan 1 14:59:27 2019

Copyright (c) 1982, 2013, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> 

1、创建临时表空间

select name from v$tempfile;查出当前数据库临时表空间,主要是使用里面的存放路径;

得到其中一条记录/u01/oracle/app/oradata/DBPRIMARY/temp01.dbf

创建临时表空间:create temporary tablespace plncontrol_temp tempfile '/u01/oracle/app/oradata/DBPRIMARY/plncontrol_temp.dbf' size 200m reuse autoextend on next 40m maxsize unlimited;

2、创建表空间

select name from v$datafile;查询出当前数据库表空间,使用里面的路径

得到其中一条记录/u01/oracle/app/oradata/DBPRIMARY/system01.dbf

创建表空间:create tablespace plncontrol datafile '/u01/oracle/app/oradata/DBPRIMARY/plncontrol.dbf' size 200M reuse autoextend on next 80M maxsize unlimited default storage(initial 128k next 128k minextents 2 maxextents unlimited);

3、创建用户并指定表空间

create user plncontrol identified by plncontrol default tablespace plncontrol temporary tablespace plncontrol_temp;

4、赋予用户权限

grant connect,resource,dba to plncontrol;

5、查看表空间的名称及大小

select t.tablespace_name, round(sum(bytes / (1024 * 1024)), 0) ts_size from dba_tablespaces t, dba_data_files d where t.tablespace_name = d.tablespace_name group by t.tablespace_name; 

6、查看各表空间空闲情况

select tablespace_name, sum(bytes) / 1024 / 1024  from dba_free_space  group by tablespace_name;

7、更改数据表大小(2G)

alter database datafile '/u01/oracle/app/oradata/DBPRIMARY/WEBONLINEPRE.dbf' resize 2048m;

8、查看表空间是否自动增长

select file_name,tablespace_name,autoextensible from dba_data_files;

9、设置表空间自动增长

alter database datafile '/u01/oracle/app/oradata/DBPRIMARY/WEBONLINEPRE.dbf' autoextend on; //打开自动增长
alter database datafile '/u01/oracle/app/oradata/DBPRIMARY/WEBONLINEPRE.dbf' autoextend on next 200M; //每次自动增长200m
alter database datafile '/u01/oracle/app/oradata/DBPRIMARY/WEBONLINEPRE.dbf' autoextend on next 200M maxsize 2048M; //每次自动增长200m,数据表最大不超过2G

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇巧用这19条MySQL优化,效率至少提.. 下一篇用java开发图形界面项目,如何实..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目