How to Diagnose and Fix the ORA-00345 Invalid MAXEXTENTS Value Error in Oracle

If you have encountered the ORA-00345 error in Oracle, it means that the MAXEXTENTS value for a tablespace is invalid. This error can occur when trying to create or alter a tablespace.

Diagnosing the Error

To diagnose the ORA-00345 error, you can start by checking the MAXEXTENTS value for the affected tablespace. You can do this by querying the DBA_TABLESPACES view:

SELECT tablespace_name, max_extents
FROM dba_tablespaces
WHERE tablespace_name = 'your_tablespace_name';

This query will show you the current MAXEXTENTS value for the tablespace.

If the MAXEXTENTS value is set to 0 or a negative number, it will result in the ORA-00345 error. Additionally, if the MAXEXTENTS value exceeds the maximum allowed value for the database, it will also trigger the error.

Fixing the Error

To fix the ORA-00345 error, you can follow these steps:

1. Update the MAXEXTENTS value: If the MAXEXTENTS value is set to 0 or a negative number, you can update it to a valid value. The maximum allowed value for MAXEXTENTS is determined by the database’s block size and the maximum datafile size. You can use the following query to calculate the maximum allowed value for MAXEXTENTS:

SELECT block_size, file_size_limit
FROM v$parameter
WHERE name = 'db_block_size';

You can then set the MAXEXTENTS value to a valid number using the ALTER TABLESPACE statement:

ALTER TABLESPACE your_tablespace_name

Replace “your_tablespace_name” with the actual name of the tablespace and “valid_number” with a valid MAXEXTENTS value.

2. Check the maximum datafile size: If the MAXEXTENTS value exceeds the maximum datafile size allowed by the database, you can increase the maximum datafile size by modifying the DB_FILES parameter:

ALTER SYSTEM SET db_files = new_value SCOPE=SPFILE;

Replace “new_value” with the new maximum datafile size.

3. Review the tablespace storage parameters: Ensure that the tablespace’s storage parameters are configured correctly. You can use the DBA_TABLESPACES view to review the storage parameters and make any necessary adjustments.

4. Consider using AUTOEXTEND: Instead of manually setting the MAXEXTENTS value, you can consider enabling the AUTOEXTEND feature for the tablespace. This allows the tablespace datafiles to automatically extend as needed.


In conclusion, the ORA-00345 error in Oracle is typically caused by an invalid MAXEXTENTS value for a tablespace. By diagnosing the error and following the steps outlined above, you can effectively resolve the issue and prevent it from occurring in the future.

Remember to always consult the Oracle documentation and seek assistance from a database administrator if you are unsure about making changes to the database configuration.

Leave a Comment