Adding No. of Datafiles to TableSpace
Hi All,
I have doubt regarding adding no. of datafiles to Tablespace. I wanna connect my application to Oracle10g database. As a DBA I am going to allocate on separate Tablespace to this new Application. As time will pass the data acumulated by the application would reach in GBs, So how should I control the datafile???
1) Shall I add only one Big datafile to the TB
OR
2) Periodically I should go on adding the datafile as it crosses the particular limit of
data size???
What policy should I follow....
Regards,
Darshan
Hi,
There is no issue in creating multiple datafiles while creating database or adding them later. If space is no constraitn for you then you should create multiple datafiles during creation of database.
Also create then with AUTOEXTEND clause and you don't have to put this clause OFF if you create it with MAXSIZE parameter. It's always better tot have MAXSIZE parameter defined because this will not allow your datafile to grow bigger then the MAXSIZE parameter size. Here is example of adding a datafile to tablespace with MAXSIZE clause;
ALTER TABLESPACE users
ADD DATAFILE '/u02/oracle/rbdb1/users03.dbf' SIZE 10M
AUTOEXTEND ON
NEXT 512K
MAXSIZE 250M;
After defining the MAXSIZE, keep a close eye on growth of data in datafile and when its near to fill add a new datafile to tablespace and keep this cycle on....
Regarding your second question :
You are write that data is written 2nd to datafile when first one is full. But you try to validate this point running database then sometimes you will find that 2nd datafile is consuming more space then 1st, even have 1st datafile is sufficient empty. This is due to fact od frequent deletions in the tables who resides in datafile.
Hope that you got some hints......
Similar Messages
-
Script for adding datafile to tablespace
Hi
Does anyone have a template alter tablespace add datafile script handy?
Basically, we need to, in the event of a tablespace alert, do two things:
query that tablespace to see how much space is remaining.
ascertain the size of the datafiles added to that tablespace already (to clarify what size we should make the additional datafile)
finally, the command itself for adding the extra datafile.
Thanks.
10.0.2.0SELECT Total.tablespace_name "TSPACE_NAME",
round(nvl(TOTAL_SPACE,0),2) Tot_space,
round(nvl(USED_Space,0),2) Used_space,
round(nvl(TOTAL_SPACE - USED_Space,0),2) Free_space,
round(nvl(round(nvl((TOTAL_SPACE - USED_Space)*100,0),2)/(Total_space),0),2) "USED%"
FROM
(select tablespace_name, sum(bytes/1024/1024) TOTAL_SPACE
from sys.dba_data_files
group by tablespace_name
) Total,
(select tablespace_name, sum(bytes/1024/1024) USED_Space
from sys.dba_segments
group by tablespace_name
) USED
WHERE Total.Tablespace_name(+) = USED.tablespace_name and
round(nvl(round(nvl((TOTAL_SPACE - USED_Space)*100,0),2)/(Total_space),0),2)< 20;
the above query will display tablespaces which are having freespace below 20%
select file_name,autoextensible,sum(bytes)/1024/1024,sum(maxbytes)/1024/1024
from dba_data_files
where tablespace_name='TBS_NAME'
group by file_name,autoextensible;
the above query will give details of datafiles like autoextensible or not etc.
SELECT SUBSTR (df.NAME, 1, 40) file_name,dfs.tablespace_name, df.bytes / 1024 / 1024 allocated_mb,
((df.bytes / 1024 / 1024) - NVL (SUM (dfs.bytes) / 1024 / 1024, 0))
used_mb,
NVL (SUM (dfs.bytes) / 1024 / 1024, 0) free_space_mb
FROM v$datafile df, dba_free_space dfs
WHERE df.file# = dfs.file_id(+)
GROUP BY dfs.file_id, df.NAME, df.file#, df.bytes,dfs.tablespace_name
ORDER BY file_name;
the above query will show how much freespace is left in each datafile. -
Multiple datafiles per tablespace in 9i?
Is it recommended to have multiple datafiles per tablespace?
Is it recommended to have multiple datafiles per
tablespace?It all depends on your particular storage needs. You could have a single datafile at maximum capacity for your tablespace, just ensure you can store it and in case you have to move it, it could be affordable.
There are DBA's who use several datafiles for a single tablespaces, this reduces the single point of failure possibility and allows a more flexible datafile maintenance.
Performance is the same for, except for the checkpoint process, the more datafiles, the more effort to update datafile headers.
~ Madrid -
How many datafile in tablespace
Hi,
I have migrate database 9i to 10g so some question is required?
how many datafile in tablespace ?
i hv following query is use
select file_name,tablespace_name from dba_data_file ?Dear Mohamed
Select name, ts#
from v$datafile;
this statment give you only the datafiles
and
select file_name, tablespace_name
from dba_data_files;
give you the tablespace name and datafiles
thank you
Mohamed Tawfik -
Drop one datafile from Tablespace
Hi,
I have 9i Database on Linux. I want to drop one datafile from tablespace. I have tried to drop datafile through following command but it gave no effect.
alter database datafile <datafile name> offline drop;
What should i have to do for dropping datafile?
Do the needful
Thankx in advance.Hi
since you dont specify the database version or if you have it setup as archivelog or noarchivelog mode, i paste the drop specs for dropping a datafile, from SQL Reference manual of 9i
DROP If the database is in NOARCHIVELOG mode, you must specify the DROP
clause to take a datafile offline. However, the DROP clause does not remove the
datafile from the database. To do that, you must drop the tablespace in which the
datafile resides. Until you do so, the datafile remains in the data dictionary with the
status RECOVER or OFFLINE.
If the database is in ARCHIVELOG mode, Oracle ignores the DROP keyword.
Regards
Message was edited by:
pcambra -
Any Software/Program to keep track of growth of Datafiles and Tablespaces
Hi,
I am looking for a program that can keep an eye on the growth of the datafiles and tablespaces as well as it can raise an alert when the growth is critical regarding the space.
Can anybody suggest me such program/tool/utility/script?
Thanks in advance.
HimanshuThere are plenty of vendors out there that sell very high-end database monitoring tools. Quest has a whole suite of them. Any of these guys should have tablespace monitoring (and a variety of other reports) as part of the package.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Adding and resizing datafiles seems to take long.
We have an Oracle 11g R2 Data Guard configuration using Physical Standby.
Simple One Primary and One Standby.
Parameter configurations
standby_file_creation = 'AUTO' and db_file_name_convert are in use
How can we monitor the adding and resizing datafiles on both the Primary and Standby?The Sys Admin, Storage Team and Network Team found out it was a configuration problem on the software firewall between the Database Host and the NAS.
-
More small datafiles or one big datafile for tablespace
Hello,
I would like to create a new tablespace (about 4 GB). Could someone if it's better to create one big datafile or create 4 datafiles with 1 GB each?
Thank you.It depends. Most of the time, it's going to come down to personal preference.
If you have multiple data files, will you be able to spread them over multiple physical devices? Or do you have a disk subsystem that virtualizes many physical devices and spreads the data files across physical drives (i.e. a SAN)?
How big is the database going to get? You wouldn't want to have a 1 TB database with 1000 1 GB files, that would be a monster to manage. You probably wouldn't want a 250 GB database with a single data file either, because it would take forever to recover the data file from tape if there was a single block corruption.
Is there a data files size that fits comfortably in whatever size mount points you have? If you get 10 GB chunks of SAN at a time, for example, you would probably want data files that were an integer factor of that (i.e. 1, 2, or 5 GB) so that you can add similarly sized data files without wasting space and so that you can move files to a new mountpoint without worrying about whether they'll all fit.
Does your OS support files of an appropriate size? I know Windows had problems a while ago with files > 2 GB (at least when files extended beyond 2 GB).
In the end though, this is one of those things that probably doesn't matter too much within reason.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Can't drop UNDOTBS datafile and tablespace
The datafile is already offline but i still can't drop either that or the entire UNDOTBS tablespace.
Please help!Hi,
the answer gives by mr stevencallan is right.
first create new undo tablespace for ur instance and then assign this undo tablespace by
alter system set undo_tablespace=<undo_tb name> scope=both;
later u drop ur old undo tablespace.
no need of any shutdown inthis scenario.
Thanks and Regards
Kuljeet Pal Singh -
Datafile in Tablespace : 1x 16Go or 4x4Go ?
Hello,
i just want to know witch is more efficient :
A Tablespace with 1 datafile of 4 Go or a Tablespace with 4 datafile of 4Go each ? (access, backup...)
Thanks in advance
PhilHello,
i just want to know witch is more efficient :
A Tablespace with 1 datafile of 4 Go or a Tablespace with 4 datafile of 4Go each ? (access, backup...)
Thanks in advance
Phil -
I'm new to oracle.
After I extended a tablespace I understood that it was too large.
I've been reading about how to drop a tablespace, but I don't want to drop the entire tablespace. I just want to drop the last datafile of this tablespace.
I know how to drop tablespaces in sapdba and brtools, but I don't know how I can drop one specific datafile (number 29) of the tablespace PSAPBTABD?
Please Help med.
Best regards
Harald VHello Harald,
see please this thread:
Re: How to drop data file?
also the section 43. <i>How can I delete a data file that was created by mistake</i>
in the SAP Note<i><b> 592393 - FAQ: Oracle</b></i>
if you have Oracle 9i databases, it is not easy to drop a datafile, but in Oracle 10g
you can drop a datafile like that:
<b><i>ALTER TABLESPACE</i></b> <<u><i>Tablespace Name</i></u>> <b><i>DROP DATAFILE</i></b> '<<u>PATH und NAME of Datafile</u>>';
for example, you have a tablespace called PSAPC11 and you want to drop a datafile called dat.data15 of this tablespace, you can drop it like that:
e.g. <b><i>alter tablespace</i></b> <u>PSAPC11</u> <b><i>drop datafile</i></b> <u>'/oracle/C11/psapc11/dat.data15'</u>
Best regards
Baran -
When to add datafile to tablespace
Hi! I would like to ask at what percent used of the tablespace should you add another datafile to accommodate the data?
Thank you.Ok Imagine that you have 1000$ and everyday you buying something in 1 Dollar , so the 1000$ will not be 1000$ which mean it will be decrease with time , the same for One Data file you create datafile with space and also with max size , but everytime you insert data this consider as size so you will need to add another data file to avoid any errors.
-
Dears,
Some days back we got a requirement from our client that they want to divide the datafiles into small size files.They were having datafiles of 10 GB each and they want to convert them into 2 GB files.As according to them back up of large file size is slower than large number small size files.As till now my concept of Adding datafile was initially to give 1 GB space and then autoextend upto 10 GB.
Now I am thinking that am i folllowing right procedure.Which one is good Adding 2 GB datafiles in tablespace with autoextend off or am i following right procedure.
Beside it is it also possible to divide a 10 GB file to five 2 GB files as i think it is not possible as datafile also may be corrupt in this case.
Please suggest.
DeepakHi Deepak,
the only way to accomplish this "conversion" is a tablespace reorganisation.
Create a target tablespace with datafiles that suit your needs and move all segments from the original tablespace into it, e.g. using BRSPACE (DBMS_REDEFINITION).
The performance benefit, well, it might be there - just by having more I/O handles (aka files) open in parallel when reading/writing data from that tablespace. It might also be that the performance remains unchanged or that it gets worse.
I highly recommend to setup a smaller test case for this to make sure that you don't waste your time.
regards,
Lars -
Adding a datafile to a tablespace?
hi all,
what are the prequisites of adding a datafile to a tablespace
& how is it performed? pls help?
regards,
vivek.Hi,
prequisites of adding a datafile to a tablespace
1. check for Tablespace Threshold level should be more than 90%(in db02 tcode).
2. There shd be no backup running while adding datafile to Tablespace.
3. check for the size of datafile should be added to Tablespace.
Goto Brtools--->login as sidadm
BR*Tools main menu
1 = Instance management
2 - Space management
3 - Segment management
4 - Backup and database copy
5 - Restore and recovery
6 - Check and verification
7 - Database statistics
8 - Additional functions
9 - Exit program
select option 2 - Space management.> Then select 1 = Extend tablespace> 3 ~ Tablespace name (tablespace) ... []-->
5 - Size of the new file in MB (size) ..... [3500] then continuosly select c-continue
With this steps your datafile will be added to Tablespace.
Thanks,
Ramakrishna. -
Adding datafile automatically when tablespace is 90% full
Hi,
I have a tablesspace having a name user01.dbf(Auto extensible to 4 GB) user02.dbf(Auto extensible to 4GB) ..........
I am just thinking about automatically creating datafile(alter tablespace add datafile).
1. (total number of datafiel in tablespace) *4 - space used by dba_segments belonging to user tablespace. if it returns less then 1 GB space, then add a datafile.
And I will put it on CRONTAB. and it will run every 24/7.
Does not this look weired?
Advice:
1. Don't we have any option like the database server will trigger an event when it is 90% and I can trap this event and run a command to add a datafile. I know internally it will do the same but still I feel if you have a feature then why not use it.
Any information will be helpful in this regards. And the same question is for OS level do I have to check it every second, space on the file system?Do one thing ,write a script which will check free space of your tablespaces like..
SELECT NAME FROM V$DATABASE;
select to_char(sysdate,'dd-MON-yyyy hh:mi:ss')Snap_ShotTime from dual;
SELECT Total.name "Tablespace Name",
nvl(free_space, 0) free_space,
nvl(total_space-free_space, 0) Used_space,
total_space
FROM
(select tablespace_name, sum(bytes/1024/1024) free_Space
from sys.dba_free_space
group by tablespace_name
) free,
(select b.name, sum(bytes/1024/1024) TOTAL_SPACE
from sys.v_$datafile a, sys.v_$tablespace B
where a.ts# = b.ts#
group by b.name
) Total
WHERE free.Tablespace_name(+) = Total.name
AND Tablespace_name <> 'PERFSTAT'
ORDER BY Total.name;
and find the %age of used space Vs free space.Enable your mail server which will send you the alerts.
Put in crotab file and set them accordingly..
Pratap
Maybe you are looking for
-
How to trace the source of a ip packet?
On a router,how can I know the interface which a packet come in(I know the source ip address of the packet)?I use access-list and log to do it,but it's a slow method.Can I use debug or something to do it? thank you!
-
NLS_DATE_FORMAT in DB trigger
Hi all, I have a problem with NLS_date_format, there exists in database such a trigger CREATE OR REPLACE TRIGGER TR_MZDR1_BRIU BEFORE INSERT OR UPDATE OF col2 ,col3, col4, col5, col6 on MAN_TAB1 FOR EACH ROW begin IF INSERTING THEN select SEQ_id11.ne
-
0Contract as line item dimension
Hi all, Should 0Contractnumber and 0Accountnumber be identified as a line item dimensions? but there are many relationships with these object? thks, rgds, wills
-
BSP Application : Unable to view trace in SE30
Hi, We are testing the performance of BSP applications. We have activated run time analysis using SICF. Now we are testing the BSP applications. We are not testing the BSP using SE80, rather we are testing it using a URL. This URL uses a SAP "System
-
Namespace to direct Authorizer to Service Form
Namespace to direct Authorizer to Service Form How can I take the Authorizer directly to the service form with the link on the email notification they receive? Step 1: In the email template body that is assigned to the approval task use the following