0% found this document useful (0 votes)
55 views2 pages

Table Spaces

The document discusses how to create, modify, and view tablespaces in an Oracle database. It describes using SQL commands like CREATE TABLESPACE to define new tablespaces with one or more datafiles, ALTER TABLESPACE to add or modify datafile properties like size and autoextend settings, and a SELECT query to view tablespace usage statistics including total size, free space, and percentage free for each tablespace.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views2 pages

Table Spaces

The document discusses how to create, modify, and view tablespaces in an Oracle database. It describes using SQL commands like CREATE TABLESPACE to define new tablespaces with one or more datafiles, ALTER TABLESPACE to add or modify datafile properties like size and autoextend settings, and a SELECT query to view tablespace usage statistics including total size, free space, and percentage free for each tablespace.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Tablespaces

Creacin de tablespaces

CREATE TABLESPACE nombre


DATAFILE '/path_name/datafile_name.dbf' SIZE 100m
AUTOEXTEND ON NEXT 1M MAXSIZE 1024M;

CREATE TABLESPACE nombre


DATAFILE '/path_name/datafile_name_01.dbf' SIZE 100M,
'/path_name/datafile_name_02.dbf' SIZE 100M,
'/path_name/datafile_name_03.dbf' SIZE 100M AUTOEXTEND OFF;

Modificacin de Tablespaces

ALTER TABLESPACE users ADD DATAFILE '/u02/oracle/rbdb1/users03.dbf' SIZE;


ALTER DATABASE DATAFILE '/u02/oracle/rbdb1/users03.dbf' AUTOEXTEND OFF;
ALTER DATABASE DATAFILE '/u02/oracle/rbdb1/users03.dbf' AUTOEXTEND ON
NEXT 512K MAXSIZE 250M;

Espacio Libre / Ocupado

SELECT df.tablespace_name TABLESPACE, df.total_space TOTAL_SPACE,


fs.free_space FREE_SPACE, df.total_space_mb TOTAL_SPACE_MB,
(df.total_space_mb - fs.free_space_mb) USED_SPACE_MB,
fs.free_space_mb FREE_SPACE_MB, ROUND(100 * (fs.free_space /
df.total_space),2) PCT_FREE FROM (SELECT tablespace_name,
SUM(bytes) TOTAL_SPACE, ROUND(SUM(bytes) / 1048576) TOTAL_SPACE_MB
FROM dba_data_files GROUP BY tablespace_name) df, (SELECT

tablespace_name, SUM(bytes) FREE_SPACE, ROUND(SUM(bytes) /1048576)


FREE_SPACE_MB FROM dba_free_space GROUP BY tablespace_name) fs
WHERE df.tablespace_name = fs.tablespace_name(+) ORDER BY
fs.tablespace_name;

You might also like