管理员用户登陆oracle数据库sql
[oracle@DBORACLE ~]$ sqlplus / as sysdba数据库
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jan 1 14:59:27 2019oracle
Copyright (c) 1982, 2013, Oracle. All rights reserved.app
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 optionside
SQL> spa
一、建立临时表空间it
select name from v$tempfile;查出当前数据库临时表空间,主要是使用里面的存放路径;io
获得其中一条记录/u01/oracle/app/oradata/DBPRIMARY/temp01.dbftable
建立临时表空间:create temporary tablespace plncontrol_temp tempfile '/u01/oracle/app/oradata/DBPRIMARY/plncontrol_temp.dbf' size 200m reuse autoextend on next 40m maxsize unlimited;登录
二、建立表空间
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);
三、建立用户并指定表空间
create user plncontrol identified by plncontrol default tablespace plncontrol temporary tablespace plncontrol_temp;
四、赋予用户权限
grant connect,resource,dba to plncontrol;
五、查看表空间的名称及大小
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;
六、查看各表空间空闲状况
select tablespace_name, sum(bytes) / 1024 / 1024 from dba_free_space group by tablespace_name;
七、更改数据表大小(2G)
alter database datafile '/u01/oracle/app/oradata/DBPRIMARY/WEBONLINEPRE.dbf' resize 2048m;
八、查看表空间是否自动增加
select file_name,tablespace_name,autoextensible from dba_data_files;
九、设置表空间自动增加
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; //每次自动增加200malter database datafile '/u01/oracle/app/oradata/DBPRIMARY/WEBONLINEPRE.dbf' autoextend on next 200M maxsize 2048M; //每次自动增加200m,数据表最大不超过2G