dbTalk Databases Forums  

Re: Delete a datafile from a tablespace

comp.databases.oracle.server comp.databases.oracle.server


Discuss Re: Delete a datafile from a tablespace in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Billy Verreynne
 
Posts: n/a

Default Re: Delete a datafile from a tablespace - 06-24-2003 , 04:52 AM






Hanne Iren Midttun wrote:

Quote:
I have by accident added a datafile to the wrong tablespace. Can
somebody tip me on how can I delete it again?
Look at the ALTER DATABASE command. You can offline/drop the file, or shrink
it.

Quote:
(Never - ever start working before 1 cup of coffee :-)
In my case it is never post here until I have at least 2 or 3 cups.. or else
I go thread hunting with a lead pipe... ;-)

--
Billy


Reply With Quote
  #2  
Old   
Noons
 
Posts: n/a

Default Re: Delete a datafile from a tablespace - 06-24-2003 , 05:39 AM






"Billy Verreynne" <vslabs (AT) onwe (DOT) co.za> wrote


Quote:
Hey, at least this problem is better than the junior DBA some years ago who
was suppose to add more space for me and forgot to add the M at the back of
size.. giving me 2K of a raw device instead of 2GB.. Not that was a horror
to fix.


Why was the default ever K instead of M
still baffles me....

--
Cheers
Nuno Souto
wizofoz2k (AT) yahoo (DOT) com.au.nospam




Reply With Quote
  #3  
Old   
michael ngong
 
Posts: n/a

Default Re: Delete a datafile from a tablespace - 06-24-2003 , 06:30 AM



Hanne Iren Midttun <hannem (AT) tihlde (DOT) org> wrote

Quote:
Hi,
I have by accident added a datafile to the wrong tablespace. Can
somebody tip me on how can I delete it again?

(Never - ever start working before 1 cup of coffee :-)

Hanne
An offline drop of the datafile should do it.
alter datafile '/u01/oradata/myfile' offline drop
It will be nice to take the necessary precautions though.
Export all tables in the tablespace,backup, full export ....
HTH
Michael Tubuo Ngong


Reply With Quote
  #4  
Old   
Billy Verreynne
 
Posts: n/a

Default Re: Delete a datafile from a tablespace - 06-24-2003 , 07:13 AM



Anthony Hogan wrote:

Quote:
I'm not sure if this will work if the database is in archivelog mode. I
tried this (8.1.7 archivelog):
Yep. That is what I said "offline/drop" as in maybe drop will not be
possible. Life is a bitch isn't it. And in case you wondering why I
reveling at your problem is 'cause it just friggen great to see others also
having problem besides me... <evil & twisted grin> ;-)

Quote:
I may be missing something but then again I'M still on my first cup of
coffee
Shrink it. So you will have a useless 1KB datafile in the database. Cover
your ass by renaming it to something like
'../oracle_system_buffer_zone_19.dbf' or something equally impressively
meaningless to obfuscate the clueless. :-)

Hey, at least this problem is better than the junior DBA some years ago who
was suppose to add more space for me and forgot to add the M at the back of
size.. giving me 2K of a raw device instead of 2GB.. Not that was a horror
to fix.


--
Billy


Reply With Quote
  #5  
Old   
Vincento Harris
 
Posts: n/a

Default Re: Delete a datafile from a tablespace - 06-24-2003 , 09:05 AM



traineensp (AT) softcell (DOT) co.in (Divya) wrote in message news:<c343a42.0306222019.6cd519c9 (AT) posting (DOT) google.com>...
Quote:
Hi,

I am using Oracle 8.1.4.x and have few records already stored in few
tables that share the referential integrity property....

Now there is some major error in the frontend display for which i
want to redo the entire display for which i need to first delete those
records....But i am unable to delete hem freom either of those
tables...I get the error message: -

Error at Line 1:
ORA 02292: integrity constraint (NSPAPP.sys_C006184)violated -
child record found.

Pls help me out...
If i have emailed at the wrong zone pls guide me to the oracle newbie
groups also then....
Thanks in advance,

Divya
Hi Divya
This helped me a while ago
This should give you the names of the tables and the dependent tables

select a.owner OWNER, a.table_name TABLE, c.column_name COL, b.owner
POWNER, b.table_name PTABLE, d.column_name PCOL from dba_constraints
a, dba_constraints b, dba_cons_columns c, dba_cons_columns d where
a.r_constraint_name = b.constraint_name and a.constraint_type =
'R' and b.constraint_type = 'P' and a.r_owner=b.owner and
a.constraint_name = c.constraint_name and
b.constraint_name=d.constraint_name and a.owner = c.owner and
a.table_name=c.table_name and b.owner = d.owner and
b.table_name=d.table_name

In the dependent tables alter table disable constraints;
You should no longer have the errors.You may need to enable the
constraints after you replace your table else Oracle may not have any
record of the constraints you deleted

Vince


Reply With Quote
  #6  
Old   
Arcangelo
 
Posts: n/a

Default Re: Delete a datafile from a tablespace - 06-24-2003 , 09:14 AM



You can *never* drop a datafile from a tablespace once it's been added.
Ever. And offline drop doesn't do it either.

The only options are to shrink the file to a stupidly small size that is of
no consequence, or to drop the tablespace and re-create it.

;-(


"michael ngong" <mngong (AT) yahoo (DOT) com> wrote

Quote:
Hanne Iren Midttun <hannem (AT) tihlde (DOT) org> wrote

Hi,
I have by accident added a datafile to the wrong tablespace. Can
somebody tip me on how can I delete it again?

(Never - ever start working before 1 cup of coffee :-)

Hanne

An offline drop of the datafile should do it.
alter datafile '/u01/oradata/myfile' offline drop
It will be nice to take the necessary precautions though.
Export all tables in the tablespace,backup, full export ....
HTH
Michael Tubuo Ngong



Reply With Quote
  #7  
Old   
Brian Peasland
 
Posts: n/a

Default Re: Delete a datafile from a tablespace - 06-24-2003 , 09:35 AM



Must be living in the past.......But looking toward the future, I'd want
the default to be G instead of M.

Cheers,
Brian

Noons wrote:
Quote:
"Billy Verreynne" <vslabs (AT) onwe (DOT) co.za> wrote in message
news:bd98dk$edf$1 (AT) ctb-nnrp2 (DOT) saix.net...


Hey, at least this problem is better than the junior DBA some years ago who
was suppose to add more space for me and forgot to add the M at the back of
size.. giving me 2K of a raw device instead of 2GB.. Not that was a horror
to fix.



Why was the default ever K instead of M
still baffles me....

--
Cheers
Nuno Souto
wizofoz2k (AT) yahoo (DOT) com.au.nospam
--
================================================== =================

Brian Peasland
oracle_dba (AT) remove_spam (DOT) peasland.com

Remove the "remove_spam." from the email address to email me.


"I can give it to you cheap, quick, and good. Now pick two out of
the three"


Reply With Quote
  #8  
Old   
Kevin A Lewis
 
Posts: n/a

Default Re: Delete a datafile from a tablespace - 06-25-2003 , 03:41 AM



Is that quite true?

I thought you could do the offline drop thing and then look at rebuilding
the controlfile from a script based on the 'alter database backup
controlfile to trace' output. Making sure of course that you leave out the
offending file.

Not possible unless you can handle the implications of doing this though.

Personally I would think about renaming the file (and possibiliy moving it)
to make it fit in with the conventions of the Tablespace is has accedentally
been added to. Then it can be sized up for use as appropriate to the
requirements in that Tablespace. Then add a new (and correctly named) file
for the originally intended Tabelspace. Or am I just being dense!

Regards Kevin


"Arcangelo" <arcangelo-c (AT) yahoo (DOT) com> wrote

Quote:
You can *never* drop a datafile from a tablespace once it's been added.
Ever. And offline drop doesn't do it either.

The only options are to shrink the file to a stupidly small size that is
of
no consequence, or to drop the tablespace and re-create it.

;-(


"michael ngong" <mngong (AT) yahoo (DOT) com> wrote in message
news:ecf365d5.0306240330.26f7a49a (AT) posting (DOT) google.com...
Hanne Iren Midttun <hannem (AT) tihlde (DOT) org> wrote in message
news:<Pine.LNX.4.21.0306240857470.31693-100000 (AT) colargol (DOT) tihlde.org>...
Hi,
I have by accident added a datafile to the wrong tablespace. Can
somebody tip me on how can I delete it again?

(Never - ever start working before 1 cup of coffee :-)

Hanne

An offline drop of the datafile should do it.
alter datafile '/u01/oradata/myfile' offline drop
It will be nice to take the necessary precautions though.
Export all tables in the tablespace,backup, full export ....
HTH
Michael Tubuo Ngong





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.