banner



How To Find Oracle Database Size In Gb

In this Oracle tutorial, nosotros volition acquire how to check database size in oracle 21c. Nosotros are working on the latest version of oracle i.e. 21c merely the steps shared will work on other versions as well. Also, we will cover these topics.

  • Database size in oracle 21c
  • DB size in oracle 11g
  • Full database size in oracle 21c
  • Database size in oracle in GB
  • Database size in oracle 12c
  • Find database size in oracle SQL developer
  • Logical database size in oracle 21c
  • Increase database size in oracle 21c
  • Increment database cavalcade size 21c
  • Database table size in oracle 21c

Database size in oracle 21c

Oracle database is the combination of multiple objects, files, tablespaces, users, etc. Each one of them plays an important role in storing and organizing the data in such a way and so it can be presented in minimum fourth dimension as and when required.

The database values are recorded in bytes (smallest unit of measurement of retentivity after nibble) and these bytes tin can exist converted into kilobytes (kb), Megabytes (MB), Gigabytes (GB), and so on.

Below table shows the memory unit chart every bit per it 1024 bytes = 1kb, 1024 kb = 1MB, and and then on.

1 KB 1024 Bytes
one MB 1024 KB
1 GB 1024 MB
1 TB 1024 GB
i Lead 1024 TB

Dividing the value by 1024 once will requite database size in kb, twice will give value in megabytes (MB), and so on.

All of the databases are divided into 3 parts:

  • Data files: It holds the information of all the files, object, tablespaces, users etc.
  • Temp Files: It keeps a record of all the temporary files in oracle database.
  • Log files: Each activity on oracle database is recorded in the form of logs and these logs are stored in the log files.
database size in oracle

In the upcoming sections, we will larn how to write queries using these objects to fetch the size of the database in oracle 21c.

Also, check: Oracle check database condition

DB size in oracle 11g

Oracle database 11g was in one case one of the pop databases but at present nosotros have new versions like 12c, 19c, and 21c (latest). About of the companies have upgraded from 11g to other versions.

We assume that since y'all are reading this section that means you are looking for a way to calculate the database size and so we are going to share the steps for calculating database size in oracle 11g.

Using the below script you lot can summate the size of the oracle database 11g:

                      -- view total file and bytes            SELECT *  FROM DBA_DATA_FILES;            -- add all the bytes and display size of database            SELECT SUM(BYTES) AS "Size in Byte" FROM DBA_DATA_FILES;            -- brandish size of database in KB            SELECT SUM(BYTES)/1024 AS "Size in KB" FROM DBA_DATA_FILES;            -- display size of database in MB            SELECT SUM(BYTES)/1024/1024 Every bit "Size in MB" FROM DBA_DATA_FILES;                  

In the to a higher place script, dba_data_files holds the information in the bytes and using the sum aggregate function we have added all the bytes together. Later we have divided the value by 1024 to get the values in kb and MB.

Read: Connect to oracle database

Full Database Size in Oracle 21c

In oracle, full database size tin be calculated by checking the size of the database folder available inside the oradata folder.

All the databases are present inside the oradata binder. In our case, the default orcl folder is nowadays which holds the information of Data files, temp files, and log files.

The below image shows the total size and path of the orcl database in oracle 21c:

full database size in oracle 21c
full database size in oracle 21c

In our oracle query, we have to combine the results of data, temp, and log files to go the full database size in oracle.

There are multiple ways to combine the result of oracle queries merely the virtually efficient and preferred mode is using the union all clause in oracle.

Example Script:

In the beneath script, nosotros have calculated the total database size in oracle past combining temp files, data files, and log files. Matrimony All clause allows us to combine the results of multiple queries.

          SELECT SUM(BYTES)/1024/1024/1024 AS "Total Size" FROM (SELECT BYTES FROM V$LOG      Wedlock ALL       SELECT BYTES FROM V$DATAFILE      UNION ALL       SELECT BYTES FROM Five$TEMPFILE);        

Output:

In the below output, the total size is 4 GB and .53 megabytes. This information is slightly unlike from the above prototype because the database keeps growing.

Full Database Size in Oracle using SQLPLUS
Full Database Size in Oracle using SQLPLUS

Read: Oracle get database name

Database Size in Oracle in GB

Database size is calculated in bytes in the oracle database merely you lot convert the value of bytes in gigabytes (GB) by dividing the bytes iii times past 1024.

database size in oracle in gb
Database size in oracle in GB

Carve up the oracle database size value in bytes by 1024 10 1024 x1024 to go the oracle database size in Gigabytes (GB).

In our previous section – Full Database Size in Oracle we take demonstrated an case where the size of the database is calculated in GB.

Read: Oracle Database vs MySQL Database

Database size in oracle 12c

Earlier the release of Oracle 19c, oracle version 12c was i of the pop oracle database version that was widely used by individuals and organizations due to its clustering feature.

Most of the organizations have upgraded to 19c simply there are companies who still find oracle version 12c uniform with their requirements.

Even Docker hub provides 12c has the latest version for docker containers. They have non still launched the docker file for oracle 19c and above.

The commands shared and so far in this blog will piece of work for oracle 12c likewise. Apply the below script to see the size of the database in different categories.

                      -- data files            SELECT SUM(BYTES)/1024/1024 AS "Data FILE SIZE IN MB"  FROM V$DATAFILE;            -- temp files            SELECT SUM(BYTES)/1024/1024 As "TEMPERORY SIZE IN MB"                        FROM V$TEMPFILE;            -- log files            SELECT SUM(BYTES)/1024/1024 Equally "LOGS IN  MB" FROM Five$LOG;        

In the below output, the yellowish text is the script and the red marked area is the output. The data file is consuming 3575 MB, the temporary (sorry for the spelling mistake) file is consuming 484 MB and the Log file is using 600 MB. Adding all of these volition give the total database size in oracle.

database size in oracle 12c
database size in oracle 12c

So, in this fashion, we can find out the database size in oracle 12c.

Read our blog – How to Install Oracle on Docker.

Discover database size in oracle SQL developer

SQL Programmer is a free tool provided past oracle to run huge SQL queries. It provides both graphical and a command-line interface to perform SQL operations.

SQL developer tool allows you to connect with multiple accounts and PDBs all at in one case so make sure you are checking the size of the right database in oracle.

In the below image we have executed the plan in the above section – Full Database Size in Oracle on the SQL programmer tool.

find database size in oracle SQL developer
discover database size in Oracle SQL developer

Logical database size in oracle 21c

Oracle Database 21c is the combination of physical and logical storage. Physical storage includes data files and os block whereas logical storage includes tablespace, segment, extent, and oracle data block.

All the space occupied by tables and indexes in the oracle database comes under the logical database. And it is stored inside the dba_segments tables.

Utilize the below script to view all the data stored inside the dba_segments table.

          SELECT * FROM DBA_SEGMENTS;        

There is a column with the name Bytes which holds the data of the size of each row in the dba_segments table. Adding up all the bytes row will give the size of the logical database in oracle 21c.

          SELECT SUM(BYTES)/1024/1024 AS "SIZE IN MB" FROM DBA_SEGMENTS;        

In the beneath output of the higher up script, the size of the Logical database is 2010.5 MB. You lot can catechumen this value into GB by dividing it past 1024.

logical database size in oracle
logical database size in oracle

Read: Connect to Oracle Database using Python

Increase database size in oracle 21c

In oracle database Limited Edition (XE) user information cannot exceed 12GB. Since this iversion of oracle is gratuitous so it has some limitations. Exceeding this limit will throw an error: ORA-12592.

Hither is an official document and Licensing information from oracle which states the limitations of the oracle database 21c.

You lot can upgrade to Oracle Database 21c Standard or Enterprise Edition in guild to increase the size of the oracle database officially.

Oracle database 21c standard edition provides a maximum database size of 2 Petabytes (Atomic number 82) whereas Enterprise edition provides 4294 Petabytes (Lead).

The workaround for this problem is the database size can be increased by adding more than datafiles or tablespace to an existing database. We tried and information technology worked for us simply we are not sure. We followed the steps shared for 10g on the official documentation.

Increase database column size 21c

There are mainly 2 problems that are related to Increasing database column size keywords in oracle database 21c.

First is you have created a table now yous want to increase the table data type. for instance, earlier you have set the value of the first name cavalcade as varchar(10) just now you have realized that users take a long first proper noun.

This problem can be solved using Alter Table argument in oracle. In the below syntax fill the data for the table name, col_name, and data_type.

          ALTER TABLE <table_name> Modify <col_name> <data_type>;        

Here is an instance, to demonstrate increased database column size in oracle 21c.

                      -- create new table            CREATE Table EMPLOYEE(     EMP_ID INTEGER,     EMP_NAME VARCHAR2(10) );            -- view table structure            DESC EMPLOYEE;            -- increase database column size            ALTER Tabular array EMPLOYEE MODIFY EMP_NAME VARCHAR2(100);            -- view increased size            DESC EMPLOYEE;        

In the beneath output of the higher up script, the varchar(ten) value has been modified to varchar(100) which ways the user will be able to fill more characters.

Increase database column size
Increment database column size

The second problem is related to SQL PLUS if you want to show the output in a unmarried line or an organized manner then you lot can control it by increasing the cavalcade size in the oracle database.

In the below syntax, replace col_name with the proper noun of the cavalcade whose size y'all desire to increase.

          cavalcade <col_name> format a10;        

Read: How to create a database in Oracle 19c

Database table size in oracle 21c

A database table is present within the dba_segments and user_segments. Y'all can utilise either of them to fetch the size of a database table in oracle 21c.

Tables are displayed under the cavalcade Segment Name in oracle database21c. Use the below script to brandish all the table names with their size in Megabytes (MB).

                      SELECT SEGMENT_NAME, BYTES/1024/1024 Every bit "MB" FROM USER_SEGMENTS;        

If y'all wish to view the size of a particular tabular array use where clause in oracle database 21c. In the case, we have created a tabular array and then checked the size of that table.

                      -- create table            CREATE Table EMPLOYEE(     EMP_ID INTEGER,     EMP_NAME VARCHAR2(10) );            -- view the size of tabular array            SELECT SEGMENT_NAME, BYTES/1024/1024 Every bit "MB" FROM DBA_SEGMENTS WHERE segment_name='EMPLOYEE';        

The below prototype is the output of the higher up code, yellow text the script, and the red marked area is the event of the script.

Ezoic

Database table size in oracle
Database table size in oracle

You lot may also similar to read the post-obit Oracle tutorials.

  • Oracle Change Database Name
  • How to Cheque Oracle Database Version
  • How to Get List all Tables in Oracle
  • Connect Excel to Oracle Database

In this tutorial, we have learned how to check database size in oracle. Also, nosotros take covered these topics.

  • Database size in oracle
  • DB size in oracle 11g
  • Total database size in oracle
  • Database size in oracle in gb
  • Database size in oracle 12c
  • Find database size in oracle SQL developer
  • Logical database size in oracle
  • Increase database size in oracle
  • Increment database column size
  • Database table size in oracle

Source: https://sqlserverguides.com/database-size-in-oracle/

Posted by: paulinoalonese.blogspot.com

0 Response to "How To Find Oracle Database Size In Gb"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel