管理員用戶登錄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資料庫
[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