How to determine MAXSIZE of existing tablespace - oracle

I need to determine the MAXSIZE that was set for a tablespace when it was created (Oracle 10g)
I'm sure I'm missing something obvious, but the information isn't immediately apparent in the information in DBA_TABLESPACES.

In 11g this query would give you the answer, but I notice you're on 10g and alas the useful column is missing.
select tablespace_name, max_size
from dba_tablespaces
/
In 10g you will have to
select tablespace_name
, initial_extent + (next_extent * (max_extents-1)) as calc_max_size
from dba_tablespaces
/
Remember that this is the default maximum size. In practice you will be limited by the size of the datafiles assigned to the tablespace, which might be much less than this theoretical maximum.
edit
#Paul 's comment is pertinent. I suppose the correct answer would be to say that the maximum size of a tablespace is a meaningless, indeed almost fictional, concept. The size of a tablespace is actually determined by its datafiles, and its potential maximum maximum size is determined by the maximum number of datafiles which can be assigned. The SQL Reference has this to say on the topic:
A bigfile tablespace contains only one datafile or tempfile, which can contain up to approximately 4 billion (232) blocks. The maximum size of the single datafile or tempfile is 128 terabytes (TB) for a tablespace with 32K blocks and 32TB for a tablespace with 8K blocks.
A smallfile tablespace is a traditional Oracle tablespace, which can contain 1022 datafiles or tempfiles, each of which can contain up to approximately 4 million ([2 to the power of 22]) blocks.
So perhaps this is a more useful query ...
select tablespace_name
, count(*) as no_of_data_files
, sum(maxblocks) as max_size
from dba_data_files
group by tablespace_name
/
...with the caveat that it only applies to the currently assigned datafiles.
edit 2
MAXSIZE applies to the datafile not the tablespace. That is why the MAXSIZE keyword is discussed in the documentation for the filespec clause rather than under CREATE TABLESPACE.

It all depends on whether the data file is auto extensible or not.
So you get the the right information from DBA_DATA_FILES:
If AUTOEXTENSIBLE is set to YES then you need the total sum of MAXBYTES.
If AUTOEXTENSIBLE is set to NO then you need the total sum of BYTES.
MAX_SIZE in DBA_TABLESPACES has nothing to do with the maximum size of the tablespace itself. According to Oracle documenation it is the
"Default maximum size of segments"
So the right query is:
select TABLESPACE_NAME, sum(decode(AUTOEXTENSIBLE, 'YES', MAXBYTES, BYTES)) MAX_SIZE
from DBA_DATA_FILES
group by TABLESPACE_NAME;
This has been tested on 11g but it should also work on 10g. It gives you the maximum size of each tablespace in bytes.
The same thing goes for TEMP tablespaces:
select TABLESPACE_NAME, sum(decode(AUTOEXTENSIBLE, 'YES', MAXBYTES, BYTES)) MAX_SIZE
from DBA_TEMP_FILES
group by TABLESPACE_NAME;

Maxsize is an attribute of dba_data_files

select tablespace_name, maxbytes/1024/1024 MAX_SIZE from dba_data_files;

select tablespace_name, round(sum(bytes)/1024/1024, 2) as free_space from dba_free_space group by tablespace_name;

Related

Oracle: How much data is there (GB or MB) stored in a BLOB column in a Table?

I have 3 columns in table which are of blob size.
I would like to calculate how much data is in JPEG PHOTO i.e not whole table size but size of data in particular column using Oracle.
How may i? (I have ADmin user and this table is in other user. Other.Employee table
You can get the size of a particular value with the dbms_lob.getlength function, and then aggregate that across all of the values in the table with:
sum(dbms_lob.getlength(jpegphoto))
You can then divide that number of bytes by [a suitable value] to get mebabytes, mebibytes etc.:
select
sum(dbms_lob.getlength(jpegphoto)) as b,
sum(dbms_lob.getlength(jpegphoto)) / 1024 as kib,
sum(dbms_lob.getlength(jpegphoto)) / (1024*1024) as mib,
sum(dbms_lob.getlength(jpegphoto)) / (1024*1024*1024) as gib
from employee
fiddle with a couple of really small BLOBs just to demonstrate the principle.

Oracle 12 limits

I'm newbie on Oracle and I want to know the following limitations on Oracle 12 :
Maximum Database Size
Maximum Table Size
Maximum Row Size
Maximum Rows per Table
Maximum Columns per Table
Maximum Indexes per Table
Currently I found these limitations
Maximum Database Size = 8000T
Maximum Table Size
Maximum Row Size
Maximum Rows per Table = Unlimited
Maximum Columns per Table = 1000
Maximum Indexes per Table = Unlimited
Thank you for your help
All this information is in the docs:
Physical limits:
https://docs.oracle.com/database/121/REFRN/GUID-939CB455-783E-458A-A2E8-81172B990FE9.htm
Logical limits:
https://docs.oracle.com/database/122/REFRN/logical-database-limits.htm
Maximum row size:
For Oracle8, Release 8.0 and later, the answer is 4,000GB (or 4GB per
LOB, 1,000 LOBs per table). Just take the maximum varchar2 size (4000)
or char size (2000) and add them up—4000x1000=4,000,000 bytes of
structured data.

Oracle Tablespace Size Increment

How to increase the size of table space post its max limit. if the max limit is defined as 100M and still later I need to increase it. I have written a query consisting of max size of 100M and now i want to increase it..Please let me know method for the same.
Alter tablespace datafile 'xxx' size 200m;
Also, you can switch "autoextend on" for datafile.

Oracle 10g Table size after deletion of multiple rows

As part of maintenance, we remove a considerable amount of records from one table and wish to dispose of this space for other table. The thing is that I'm checking the size of the table and it shows the same original size before the delete. What am I missing here?
To check the size, I'm looking at the dba_segments.
There are some concepts you need to know about tables before you can really understand space usage. I will try and give you the 5 second tour ...
A table is made up of extents, these can vary in size, but lets just assume they are 1MB chunks here.
When you create a table, normally 1 extent is added to it, so even though the table has no rows, it will occupy 1MB.
When you insert rows, Oracle has a internal pointer for the table known as the high water mark (HWM). Below the HWM, there are formatted data block, and above it there are unformated blocks. It starts at zero.
If you take a new table as an example, and start inserting rows, the HWM will move up, giving more and more of that first extent to be used by the table. When the extent is all used up, another one will be allocated and the process repeats.
Lets says you fill a three 1MB extents and then delete all the rows - the table is empty, but Oracle does not move the HWM back down, or free those used extents. So the table will take 3MB on disk even though it is empty, but there is 3MB of free space to be reused in it. New inserts will go into that space below the HWM until it is filled up again before the HWM is move again.
To recover the space, if your table is using ASSM, you can use the command:
alter table t1 shrink space;
If you are not using ASSM, the you need to think about a table reorg to recover the space.
If you want to "reclaim" the space, the easiest method is:
ALTER TABLE table MOVE TABLESPACE different_tablespace;
ALTER TABLE table MOVE TABLESPACE original_tablespace;
Providing you have:
Some downtime in which to do it
A second tablespace with enough space to transfer the table into.
Take a look at this site
about the table size after deleting rows.
Space is effectively reused when you delete. Your database will not show any new free
space in dba_free_space -- it will have more blocks on freelists and more empty holes in
index structures.
SELECT SUM(BYTES)
FROM DBA_SEGMENTS
WHERE SEGMENT_NAME LIKE 'YOUR TABLE NAME%';
You will get the right answer.

What is the maximum physical table size in Oracle?

Is there some limit on the maximum total amount of data that can be stored in a single table in Oracle?
I think there shouldn't be because tables are anyways stored as a set of rows and rows can be chained as well. Does such a limit exist?
See Physical Database Limits and Logical Database Limits documentation.

Resources