UrbanPro
true

Learn Oracle Database from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Datafile

R
Rajasekharreddy K.
15/12/2016 0 0

Overview of Data files
    
    A table space in an Oracle database consists of one or more physical datafiles. A datafile can be associated with only one tablespace and only one database.

At least one datafile is required for the SYSTEM and SYSAUX tablespaces of a database.

Your database should contain several other tablespaces with their associated datafiles or tempfiles.

Initialization Parameter: db_files

    When starting an Oracle Database instance, the DB_FILES initialization parameter indicates the amount of SGA space to reserve for datafile information and thus, the maximum number of datafiles that can be created for the instance. This limit applies for the life of the instance. You can change the value of DB_FILES (by changing the initialization parameter setting), but the new value does not take effect until you shut down and restart the instance.

When you check parameter db_files, you will see that it matches the amount of datafiles inside the database:

SQL> show parameter db_files;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_files                             integer     200

db_files is set the 200 (default value), exactly the same as the amount of datafiles inside the database:

SQL> select count(*) from dba_data_files;

  COUNT(*)
----------
         4


    If the db_files parameter is set the 200 (default value), exactly the same as the amount of dba_data_files inside the database also 200 then we can't add the datafiles as well as we can't create the tablespace.

if we try to create tablespace we can get this error ORA-00059: maximum number of DB_FILES exceeded


When determining a value for DB_FILES, take the following into consideration:

If the value of DB_FILES is too low, you cannot add datafiles beyond the DB_FILES limit without first shutting down the database.
If the value of DB_FILES is too high, memory is unnecessarily consumed.


DBA_DATA_FILES: information about each datafile, including the tablespace to which it belongs and the file ID.

select * from dba_data_files;

DBA_EXTENTS: Contains the file ID of the datafile containing the extent.

DBA_FREE_SPACE: describes the free extents in all tablespaces in the database.

V$DATAFILE: Contains datafile information from the control file.

V$DATAFILE_HEADER: Contains information from datafile headers


Creating Datafiles and Adding Datafiles to a Tablespace:

You can create datafiles and associate them with a tablespace using any of the statements listed in the following.

SQL Statement:

CREATE TABLESPACE  ---  Creates a tablespace and the datafiles that comprise it

CREATE TEMPORARY TABLESPACE --- Creates a locally-managed temporary tablespace and the tempfiles (tempfiles are a special kind of datafile) that comprise it.

ALTER TABLESPACE ... ADD DATAFILE  ---   Creates and adds a datafile to a tablespace.

ALTER TABLESPACE ... ADD TEMPFILE ---    Creates and adds a tempfile to a temporary tablespace.

CREATE DATABASE ----  Creates a database and associated datafiles.

ALTER DATABASE ... CREATE DATAFILE ----- Creates a new empty datafile in place of an old one--useful to re-create a data file that was lost with no backup.

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

Common mistake even experienced programmers make in Plsql.
Hope, you are aware of Procedures in Plsql. Let us discuss one simple thing which we should always remember while writing the datatype of a parameter for a procedure or a function. Eg: Create or replace...

Introduction to Performance tuning
What is Performance in general terms? Throughput per Input. For Eg: we keep saying, this bike has so and so much of mileage and all that. That is one of the parameters in measuring the performance of...

Exception Handling topics
Here, I am only going to list the topics which one should consider to master Exception Handling. 1. Types of errors in Pl/sql- Compile time and Run time 2. How to read and understand the Compile time...

SQL Subqueries - Used in various ways
If you master the concepts of subqueries, you would gain a lot of flexibility in writing complex SQL queries. Let's not get into Correlated subqueries, let us see the different versions of nested subquery...

Interesting thing about Sequences in Oracle
Let's not get into the very basic things like what is sequence?, What is Cache/Nocache, Cycle/NoCycle etc. My topic is something very interesting which many of the beginners might not have noticed. My...
X

Looking for Oracle Database Classes?

The best tutors for Oracle Database Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Oracle Database with the Best Tutors

The best Tutors for Oracle Database Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more