Add or resize datafile
My db is Oracle 8.1.7. Recently I found one of my tablespace is used about to 80%.
The tablespace has 3 4g-size-datafile. What should I do ? Add a new datafile or resize the datafiles?
Which one better?
Well it depends
If there are going to be in the single array adding/resize doest not have any difference
IF you are going to add a file in different disk it can help to reduce I/O but maintenance overhead will arise with number of datafiles
Virtually you can select anything
Similar Messages
-
Syntax to resize datafile in 10g
syntax to resize datafile in 10g
the reason is
in 10g if u want to create tablespace the syntax is
create tablespace table_name datafile 10M;No, actually. The syntax on how to create a tablespace is exactly the same today as it was in 1999. Create tablespace X datafile '/path/filename' size 10M.
It is, however, possible to omit both the path and size clause if you want to use Oracle Managed Files (OMF):
alter system set db_create_file_dest=/path/filename;
create tablespace X;
And then it's possible to add back the size clause if you don't like the default 100M autoextend on which OMF gives you:
create tablespace X datafile size 10M;
or
create tablespace X datafile size 10m autoextend off;
or
create tablespace X datafile size 10m autoextend on next 10m maxsize 400m;
Point is, the syntax for creating a tablespace has many different variations and options, but the basic syntax hasn't changed a bit. The other point is: what has creating a tablespace got to do with what you originally asked about, which was resizing an existing datafile?
to add datafile
alter tablespace table_name add datafile;
it will add datafile with default size and with name
according to its naming convention.Yes, but you are not obliged to let that happen.
alter system set db_create_file_dest=/path/filename;
alter tablespace X add datafile '/different/path/myownfilename' size 37M;
...you switch on OMF and then decide you don't want to use it for one particular file. The presence/existence of OMF is an addition of features if you want to use them. It doesn't take anything away from you and if you want to specify all the parts of the create or alter tablespace clause yourself, you can do so, no sweat -at which point, your syntax will look incredibly like what you would have issued in 8i or 9i days.
Analogy time: yes, today, you can build homes out of steel, concrete, carbon-reinforced composites, whereas in the 16th century you might have used timber, wattle and daub. But a house still has rooms, chimney flues, windows, doors. The house I live in would be recognisable to Shakespeare as a house. And what he lived in would be something I could live in too.
Yeah, well: maybe analogies aren't all they're cracked up to be! But the underlying truth is that Oracle gives you new features in new versions and using them can be highly convenient and useful. Nevertheless, if you understand the underlying principles,the old stuff is still there, still recognisable, still usable.
thats why i am asking for syntax to resize datafile
in 10g ,i had fired above sqls with no errors.Again, I am a little at a loss understanding why the fact that the syntax for creating a tablespace has new options should cause you to think anything weird has happened to the syntax for resizing a datafile.
As others I think have already mentioned: there always were and still remain only three ways of making a tablespace bigger:
add a datafile
resize an existing datafile
switch on autoextension of an existing datafile
alter tablespace X add datafile ['/path/filename'][size 10m];
alter database datafile '/path/filename' resize 54m;
alter database datafile '/path/filename' autoextend on [next Xm] [maxsize Ym];
None of that syntax is different from what you'd use in version 7. Yes, some commands have optional clauses -and some of the clauses which are optional in 10g were compulsory in 7 or 8. But the general syntax is identical, still. -
Add a new datafile to the standby database
Hi,
i have a standby database in recovery managed mode.
Now i must add a new datafile on the production database and i would like
to know how i realized adding the new datafile on the stanby database.
is it right when i do the follow steps?
Before i add a datafile to the primary database,
cancel the recovery on the standby database.
-> add the new datafile on the primary database
after all archived redo logs have been applied, cancel managed recovery:
alter database recover managed standby database cancel;
startup nomount
alter database mount standby database;than
ALTER DATABASE CREATE DATAFILE '/oracle/DB1/db1_9/data9' as '/oracle/DB1/db1_9/data9';
alter database recover managed standby database disconnect;Thanks8.4.1.1 Adding a Tablespace and a Datafile When STANDBY_FILE_MANAGEMENT Is Set to AUTO
The following example shows the steps required to add a new datafile to the primary and standby databases when the STANDBY_FILE_MANAGEMENT initialization parameter is set to AUTO.
Add a new tablespace to the primary database:
SQL> CREATE TABLESPACE new_ts DATAFILE 't_db2.dbf'
2> SIZE 1m AUTOEXTEND ON MAXSIZE UNLIMITED;
Archive the current redo log so it will get copied to the standby database:
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
Verify that the new datafile was added to the primary database:
SQL> SELECT NAME FROM V$DATAFILE;
NAME
/disk1/oracle/dbs/t_db1.dbf
/disk1/oracle/dbs/t_db2.dbf
Verify that the new datafile was added to the standby database:
SQL> SELECT NAME FROM V$DATAFILE;
NAME
/disk1/oracle/dbs/s2t_db1.dbf
/disk1/oracle/dbs/s2t_db2.dbf
8.4.1.2 Adding a Tablespace and a Datafile When STANDBY_FILE_MANAGEMENT Is Set to MANUAL
The following example shows the steps required to add a new datafile to the primary and standby database when the STANDBY_FILE_MANAGEMENT initialization parameter is set to MANUAL. You must set the STANDBY_FILE_MANAGEMENT initialization parameter to MANUAL when the standby datafiles reside on raw devices.
Add a new tablespace to the primary database:
SQL> CREATE TABLESPACE new_ts DATAFILE 't_db2.dbf'
2> SIZE 1m AUTOEXTEND ON MAXSIZE UNLIMITED;
Verify that the new datafile was added to the primary database:
SQL> SELECT NAME FROM V$DATAFILE;
NAME
/disk1/oracle/dbs/t_db1.dbf
/disk1/oracle/dbs/t_db2.dbf
Perform the following steps to copy the tablespace to a remote standby location:
Place the new tablespace offline:
SQL> ALTER TABLESPACE new_ts OFFLINE;
Copy the new tablespace to a local temporary location using an operating system utility copy command. Copying the files to a temporary location will reduce the amount of time that the tablespace must remain offline. The following example copies the tablespace using the UNIX cp command:
% cp t_db2.dbf s2t_db2.dbf
Place the new tablespace back online:
SQL> ALTER TABLESPACE new_ts ONLINE;
Copy the local copy of the tablespace to a remote standby location using an operating system utility command. The following example uses the UNIX rcp command:
%rcp s2t_db2.dbf standby_location
Archive the current redo log on the primary database so it will get copied to the standby database:
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
Use the following query to make sure that managed recovery is running. If the MRP or MRP0 process is returned, managed recovery is being performed.
SQL> SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;
Verify that the datafile was added to the standby database after the redo log was applied to the standby database.
SQL> SELECT NAME FROM V$DATAFILE;
NAME
/disk1/oracle/dbs/s2t_db1.dbf
/disk1/oracle/dbs/s2t_db2.dbf
From Oracle Docs... -
Facing Problem in resizing datafile
Hi i m facing problem in resizing a datafile of size 2.5 gb, i infact import data of 2gb in this file then reorganize data in different tablespace now the used size of this datafile is 96mb , when i issue command to reduce it to 200mb it gives me error that data exist u cannot resize datafile,
tell me what should be done to resize it.
thanksHi,
You can create a working tablespace with a good size
CREATE TABLESPACE tbs_tmp
DATAFILE 'D:\Oracle\oradata\SID\file_tmp.dbf' SIZE 100M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K;
And move all segments from your tablespace TBS1 into this new tbs
(select segment_name,segment_type from dba_segments where tablespace_name = 'TBS1')
If indexes :
alter index owner.index_name rebuild tablespace tbs_tmp;
If table :
alter table owner.table_name move tablespace tbs_tmp;
Ensure that the tablespace TBS1 is empty
select segment_name,segment_type from dba_segments where tablespace_name = 'TBS1'
After what, if no row return, you can drop your first tablespace,
DROP TABLESPACE tbs1 INCLUDING CONTENTS CASCADE CONSTRAINTS;
recreate it with a goos size,
CREATE TABLESPACE tbs1
DATAFILE 'D:\Oracle\oradata\SID\file_tbs1.dbf' SIZE 100M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K;
and move all segment from tbs_tmp into this new tbs1
(select segment_name,segment_type from dba_segments where tablespace_name = 'TBS_TMP')
If indexes :
alter index owner.index_name rebuild tablespace tbs1;
If table :
alter table owner.table_name move tablespace tbs1;
Ensure that the tablespace TBS1 is empty
select segment_name,segment_type from dba_segments where tablespace_name = 'TBS_TMP'
If no row return, drop the working tablespace
DROP TABLESPACE tbs_tmp INCLUDING CONTENTS CASCADE CONSTRAINTS;
Nicolas. -
Will resizing datafile after shrink segment minimize the rman bkp duration
Hi ,
We have 1 TB database where in the RMAN backup runs for nearly 35 Hrs .
At database level if i shrink the segments to reclaim space and then resize datafile , will it have my RMAN backup duration time to decrease .
Kindly let me know if this can be done .whats the database version.
As in 10g Rel 2 See "UNUSED BLOCK COMPRESSION"
Unused Block Compression Of Datafile Backups to Backup Sets
When backing up datafiles into backup sets, RMAN does not back up the contents of data blocks that have never been allocated. (In previous releases, this behavior was referred to as NULL compression.)
RMAN also skips other datafile blocks that do not currently contain data, if all of the following conditions apply:
The COMPATIBLE initialization parameter is set to 10.2
There are currently no guaranteed restore points defined for the database
The datafile is locally managed
The datafile is being backed up to a backup set as part of a full backup or a level 0 incremental backup
The backup set is being created on disk.
Skipping unused data blocks where possible enables RMAN to back up datafiles using less space, and can make I/O more efficient.
http://docs.oracle.com/cd/B19306_01/backup.102/b14194/rcmsynta009.htm -
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.
-
On Oracle 7.3 can I resize datafile from 1900 Mb to 1500Mb during the db is open?
regards
pedroIt works with 7.3, IF your data file isn't fragmented so that there are blocks in use beyond the value you wish to resize to. In other words you have a lot of used blocks then a lot of free blocks, followed by more used blocks. In that case your only option is exp/drop tables/imp.
-
Resize datafile when database is mount
Hello,
I need resize datafile when database is mount not open(I recover database).
Is it posible?Try making the tablespace offline, opening the database and resizing the datafile. After you resize the datafile, recover the tablespace or just the datafile.
In Oracle documentation: Backup & Recovery Guide, you can find more details of these options:
=>RECOVER TABLESPACE Statement
RECOVER TABLESPACE performs media recovery on all datafiles in the tablespaces listed. For example, enter the following at the SQL prompt to recover tablespace TBS_1:
RECOVER TABLESPACE tbs_1
The tablespaces must be offline to perform the recovery. Oracle indicates an error if none of the files require recovery.
=> RECOVER DATAFILE Statement
RECOVER DATAFILE lists the datafiles to be recovered. For example, enter the following at the SQL prompt to recover datafile /oracle/dbs/tbs_22.f:
RECOVER DATAFILE '/oracle/dbs/tbs_22.f'
The database can be open or closed, provided that you can acquire the media recovery locks. If the database is open in any instance, then datafile recovery can only recover offline files.
Hope it helps.
Eliane -
Which is better? Resize datafile or add datafile in same diskgroup.
Hi All,
Can you explain which is better option between adding a datafile or resizing one in a diskgroup with 20 disks?
Regards,
Avihello buddy,
Since you know that a small file datafile has a limitation of 32gb then if your tablespace is out of this space then the solution is add more dfiles, also, in my point of view less datafiles in a hughe database is better for evite ckpt contention. The answer is dependo always for your situation!!!
I hope it helps
best regards,
Rodrigo Mufalani
www.mufalani.com.br -
Resize datafile or add new datafile which is good?
Hi all
we have 80 GB database size and only two tablespace have space around 60 Gb
these two tablespace have one database each around 30 gb so
My question is it good to resize current datafile or
It it good to add new datafile ?Your question is which is "best"; add datafile or resize right? If yes, then I think below links will answer you :
http://www.freelists.org/post/oracle-l/Datafile-size-Is-bigger-better,9
datafile and size
Bigfile or smallfile tablespace?
Just go through these link. I am sure answer in it.
Regards
Girish Sharma -
Error While addding a new datafile
Dear All,
We have the tablespace PSAPUSER1D in one of our production systems,which is 100% full .I am trying to extend the tablespace using brtools,but i am unable to do it and it is giving the following error.
BR0280I BRSPACE time stamp: 2007-11-05 06.55.50
BR0657I Input menu 303 - please check/enter input values
Options for extension of tablespace PSAPUSER1D (1. file)
1 * Last added file name (lastfile) ....... [/oracle/P01/sapdata1/psapuser1d_1.dbf]
2 * Last added file size in MB (lastsize) . [273]
3 - New file to be added (file) ........... [/oracle/P01/sapdata2/psapuser1d_1.dbf]
4 ~ Raw disk / link target (rawlink) ...... []
5 - Size of the new file in MB (size) ..... [273]
6 - File autoextend mode (autoextend) ..... [yes]
7 - Maximum file size in MB (maxsize) ..... [0]
8 - File increment size in MB (incrsize) .. [20]
9 - SQL command (command) ................. [alter tablespace PSAPUSER1D add datafile '/oracle/P01/sapdata2/psapuser1d_1.dbf' size 273M autoextend on next 20M maxsize unlimited]
Standard keys: c - cont, b - back, s - stop, r - refr, h - help
BR0662I Enter your choice:
c
BR0280I BRSPACE time stamp: 2007-11-05 06.55.56
BR0663I Your choice: 'c'
BR0259I Program execution will be continued...
BR1052W File psapuser1d_1.dbf is already used by the database
<u><b>BR1055E Database file /oracle/P01/sapdata2/psapuser1d_1.dbf must be located in a subdirectory of 'sapdata' directory</b>BR0669I Cannot continue due to</u> previous warnings or errors - you can go back to repeat the last action
BR0280I BRSPACE time stamp: 2007-11-05 06.55.56
BR0671I Enter 'b[ack]' to go back, 's[top]' to abort:
so please kindly give any suggestions.Dear Llanes,
A strange thing that i notice in one of our systems is that we dont have the standard directory structure like this
"/oracle/P01/sapdata1/usr_1/psapuser1d_1.dbf",
but we have the following structure
$ ls -l /oracle/P01/sapdata1
total 168573168
drwxr-xr-x 2 orap01 dba 96 Apr 21 2006 cntrl
drwxr-xr-x 2 orap01 dba 96 Jul 7 21:52 erp_1
-rw-r----- 1 orap01 dba 286408704 Nov 5 08:43 psapuser1d_1.dbf
-rw-r----- 1 orap01 dba 268451840 Nov 5 08:43 psapuser1i_1.dbf
-rw-r----- 1 orap01 dba 838868992 Nov 5 08:55 system_1.dbf
Wherein the datafiles have been directly added to the sapdata1 directory,without the corresponding subdirectory.so how can we proceed in this scenario.
Regards
Balaji.P -
Resizing datafiles in oracle 10g
Hi,
My total datafile size was showing around 100g (physical file size).
But when actually query dba_segments to see how much tables and indexes are occupying it is coming around max of 30g.
So how can i reclaim the remaining datafile size.
As i know the files were extended and i have used some queries but i was unable to reclaim the space.
Can any one hep me.Thanks for all ur suggestions.
I am using a query to resize
SELECT
'/* '||to_char(CEIL((f.blocks-e.hwm)*(f.bytes/f.blocks)/1024/1024),99999999)||' M */ ' ||
'alter database datafile '''||file_name||''' resize '||CEIL(e.hwm*(f.bytes/f.blocks)/1024/1024)||'M;' SQL
FROM
DBA_DATA_FILES f,
SYS.TS$ t,
(SELECT ktfbuefno relative_fno,ktfbuesegtsn ts#,
MAX(ktfbuebno+ktfbueblks) hwm FROM sys.x$ktfbue GROUP BY ktfbuefno,ktfbuesegtsn) e
WHERE
f.relative_fno=e.relative_fno and t.name=f.tablespace_name and t.ts#=e.ts#
and f.blocks-e.hwm > 1000
ORDER BY f.blocks-e.hwm DESCBut even i resize it more than the given space it will throw an error saying
ORA-03297: file contains used data beyond requested RESIZE value
I think the file was extended with lot of free blocks in the middle ,how can make my file size to my actual table size+index size.
Can anyone help me. -
Problem while resizing datafiles..
Hi Experts,
Im facing problems while resizing my datafiles. I am using Oracle 10g on Windows 2003 server.
I had a datafile of size 20GB.
I have 3 schemas sch1, sch2,sch3 and all have objects.
I dropped sch1 and truncated some tables in sch2.
I found the freespace available in my datafile 16GB.
When I try to resize the datafile to 5GB, I am getting ora-03297 error.
I checked for object that are beyond 5GB using the follwing query.
I found sch3 objects are present beyond 5GB mark on that datafile.
How can I resize the datafile to 5GB??
Is there any other way to resize the datafile?? Please help me.
SELECT owner, segment_name, segment_type, tablespace_name, file_id,
((block_id+1)*(SELECT value FROM v$parameter
WHERE UPPER(name)='DB_BLOCK_SIZE')+BYTES) end_of_extent_is_at_this_byte
FROM dba_extents
WHERE ((block_id+1)*(SELECT value FROM v$parameter
WHERE UPPER(name)='DB_BLOCK_SIZE')+BYTES) > (<needed size in MB>*1024*
1024)
AND tablespace_name='<tablespace_name>'
ORDER BY file_id, end_of_extent_is_at_this_byte;
Thanks in advance.take a look at the metalink docs...probably coz of high water marks u r not able to do that..
Note 130866.1 - How to Resolve ORA-03297 When Resizing a Datafile by Finding the Table Highwatermark
Note 237654.1 - Resizing a Datafile Returns Error ORA-03297 -
hi,
i am facing this problem:
the size of datafile '+DG1/orcl/datafile/erp01.dbf' is 8798m.
but only 4822m(54.81%) was in use.
so i want to resize this datafile to smaller size:
SQL> alter database datafile '+DG1/orcl/datafile/erp01.dbf' resize 7000m;
ERROR at line 1:
ORA-03297: file contains used data beyond requested RESIZE value
i have tried by coalesce the tablespace:
SQL> alter tablespace erp coalesce;
but still resize the datafile to smaller size.Error: ORA 3297
Text: file contains <num> blocks of data beyond requested RESIZE value
Cause: Some portion of the file in the region to be trimmed is currently in
use by a database segment.
Action: Drop or move segments containing extents in this region prior to
resizing the file, or choose a resize value such that only free space
is in the trimmed region.
Oracle Metalink Doc ID: Note:38691.1
Adith -
Resize datafile in standby when its in mount stage
Hi All,
Oracle 10.2.0.1
Linux EL5
I have configured standby database for testing. Now i have a problem that my users tablespace in standby got filled and its giving error message like
ORA-01237: cannot extend datafile 4
ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl/users01.dbf'
Now i have to autoextend the datafile 4 in standby.how to do it in mount stage?
When i try to open the database for resizing the datafile, i am getting the below error..
SQL> alter database open;
alter database open
ERROR at line 1:
ORA-16004: backup database requires recovery
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
Any other options ? please advice..
TIA,Hi,
Thanks for your reply...
But i cant do that,because the current sequence in the primary is 51. And rite now the sequence in the standby is stuck in 45, now i have to pass this 6 sequences so that the changes made(like resizing the datafile) in the primary will reflect in the standby..
Now this is the error message i am getting when i start the redo apply in standby..
MRP0: Background Media Recovery terminated with error 1237
Thu Aug 27 20:01:33 2009
Errors in file /u01/app/oracle/admin/orcl/bdump/orclstdby_mrp0_5742.trc:
ORA-01237: cannot extend datafile 4
ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl/users01.dbf'
ORA-19502: write error on file "/u01/app/oracle/oradata/orcl/users01.dbf", blockno 56960 (blocksize=8192)
ORA-27072: File I/O error
Linux Error: 11: Resource temporarily unavailable
Additional information: 4
Additional information: 56960
Additional information: 327680
Managed Standby Recovery not using Real Time Apply
Some recovered datafiles maybe left media fuzzy
Media recovery may continue but open resetlogs may fail
Any other options ?
Please advice...
TIA,
Maybe you are looking for
-
Hi Guru's, I've created a selection wirh differents parameters : 1)Controlling area - KOKRS 2)Partner Object -PAROB 3)Posting date - BUDAT 4)Debit TYPE-BELTP 5)Business Transaction - VRGNG I try to pass those parameters in background to the report rk
-
IPhone 4s with ios 6 shows full wifi signal but can't access to the internet while other idevice can
Hi everyone, I updated my iphone 4s to ios 6 a few months ago and there was no problem until I change my sim card to other carriers last two days. This second sim card is the same sim card that I used it earlier this year with no problem. But the p
-
Backing up Element 7 files and catalog
Hi - Currently I am running Photoshop Elements 7 (PE7) on a computer with Windows XP. All of my photos are on an external hard drive. I want to back up all of my photos, tags, etc. (all the work I have done) and be able to access everything from my
-
My macbook pro crashed and the hard drive was replaced. How do I restore my backup pre- 9.6 iphoto library to the 9.6.1 iphoto library? They look completely different. When I look at my backed-up iphoto library folder I see lots of files and folders:
-
Is it possible to deploy VM with RDS RDVH in one forest and VMs in another forest?
Hello, We have a situation with a Remote Desktop Services (RDS) with virtual desktops (RDVH) where we are limited in our possibilities. We have a multi forest domain structure with trusts between the forests, some trusts are 2 way trusts, some trusts