A tablespace is full
When to use it
An application fails with ORA-01653, ORA-01654, ORA-01688 or ORA-30036, or the daily check shows a tablespace close to 100 percent.
Run this
Start with the facts for that tablespace. Script: 03_quick_tablespace_check.sql. Full version in Administration › Storage management › Tablespaces.
--------------------------------------------------------------------------------
-- Script: check_ts_quick.sql
-- Descrição: Verificação rápida de tablespace (passar nome como parâmetro)
-- Uso: @check_ts_quick.sql USERS
--------------------------------------------------------------------------------
SET LINESIZE 180
SET PAGESIZE 100
SET VERIFY OFF
COLUMN tablespace_name FORMAT A20
COLUMN total_gb FORMAT 999.99 HEADING 'TOTAL_GB'
COLUMN used_gb FORMAT 999.99 HEADING 'USADO_GB'
COLUMN free_gb FORMAT 999.99 HEADING 'LIVRE_GB'
COLUMN pct FORMAT 999.99 HEADING '%_USADO'
PROMPT === RESUMO TABLESPACE: &1 ===
SELECT
tablespace_name,
ROUND(SUM(bytes)/1024/1024/1024, 2) AS total_gb,
ROUND(SUM(bytes)/1024/1024/1024 -
NVL((SELECT SUM(bytes)/1024/1024/1024
FROM dba_free_space
WHERE tablespace_name = '&1'), 0), 2) AS used_gb,
ROUND(NVL((SELECT SUM(bytes)/1024/1024/1024
FROM dba_free_space
WHERE tablespace_name = '&1'), 0), 2) AS free_gb,
ROUND((1 - NVL((SELECT SUM(bytes) FROM dba_free_space WHERE tablespace_name = '&1'), 0) /
SUM(bytes)) * 100, 2) AS pct
FROM
dba_data_files
WHERE
tablespace_name = UPPER('&1')
GROUP BY
tablespace_name;
PROMPT
PROMPT === DATAFILES ===
COLUMN file_name FORMAT A60
COLUMN size_mb FORMAT 99,999.99
COLUMN auto FORMAT A4
SELECT
file_id,
SUBSTR(file_name, -50) AS file_name,
ROUND(bytes/1024/1024, 2) AS size_mb,
autoextensible AS auto
FROM
dba_data_files
WHERE
tablespace_name = UPPER('&1')
ORDER BY
file_id;
SET VERIFY ON
The usual options, as examples to prepare for review:
-- Option 1: let an existing file grow
ALTER DATABASE DATAFILE '<FILE_NAME>' AUTOEXTEND ON NEXT 1G MAXSIZE 32767M;
-- Option 2: resize an existing file
ALTER DATABASE DATAFILE '<FILE_NAME>' RESIZE 20G;
-- Option 3: add a file (ASM or OMF: no file name needed)
ALTER TABLESPACE YOUR_TABLESPACE ADD DATAFILE SIZE 10G AUTOEXTEND ON NEXT 1G MAXSIZE 32767M;
How to read the output
- Check
autofor each file. If autoextend is already on and the file is at its maximum, growing it is not an option. - A smallfile datafile with an 8K block size cannot exceed about 32 GB. That is why
32767Mappears so often. - Before adding space, confirm that the filesystem or ASM diskgroup has room: Reference › Storage and capacity › ASM Diskgroup Monitoring and Management.
What to do next
- Confirm the tablespace name from the error message.
- Run the check and decide which option fits.
- Check free space on disk or in ASM.
- Write the exact command and have it reviewed. Adding a datafile cannot be undone simply.
- After the change, run the check again and ask the application team to retry.
Risk level
CHANGES THE DATABASE This changes configuration or objects. Run it only with an approved change and a rollback step written down.