管理员用户登录oracle数据库
[[email protected] ~]$ 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
原文地址:https://www.cnblogs.com/lilihong/p/10204886.html