Re: Deleting a datafile from a tablespace.

Re: Deleting a datafile from a tablespace.

 

  

Once you use a datafile, you canīt drop it if you still have data in the tablespace.
Export the data and import in another tablespace, using another datafiles.


1. Will the system allow me to drop the datafile if there is data in it and it is offline?
- No.

2. How do I transfer data from one Dbf of tbs to other? that is,
If the tablespace A has 2 dbf's - A1.dbf and A2.dbf , how do I transfer the data from A2.dbf to A1.dbf ?
- You donīt. Think data are logical, and resides in the Tablespace, a logical unit, not in Datafiles, wich are physical.

3. Is export of tablespace --> drop tablespace --> recreate tablespace --> import data to the new tablespace, the only option??
- Itīs you best option, I guess.

4. Will resizing the datafile to 0K as in "" Alter database datafile 'Path_of_datafile' resize 0 K; "" force the data to move from one dbf to other of the same tbs? Or will it throw an error ,. since it has data more than 0K size???
- It will shrink down the datafile to the High Water Mark, not to 0. And even this wonīt work the way you want if you are using raw devices as datafiles.


Ricardo Portilho Proni
Oracle Database 10g Certified Associate
Oracle Database 10g Certified Professional
Microsoft Certified Professional

Nerv Informática Ltda.
http://www.nervinformatica.com
http://www.pergunteaodba.net



Sheryl wrote:
> Hi All,
>
> My prod DB is a 2-node Oracle 10g R1 RAC on HP-UX. The datafiles reside on RAW Device.
>
> We are presently doing a resizing of the Db. As a part of this activity we were re-allocating the space from those Tablespaces that don't have much usage , to the others with greater space usage.
>
> I have a tablespace of 16 GB - two datafiles each of 8GB. But the space utilization is approx 1 GB. And the data is not expected to grow much for this tablespace. So I want to drop one of the datafiles associated with this tablespace. The data is spread over both the datafiles.
>
> To do the dropping of the datafile I have the following statements,
>
> Either
>
> Alter database datafile 'Path_of_datafile' offline;
> Alter database datafile 'Path_of_datafile' drop;
>
> Or
>
> Alter database datafile 'Path_of_datafile' offline drop;
>
> Now my queries are:-
>
> 1. Will the system allow me to drop the datafile if there is data in it and it is offline?
> 2. How do I transfer data from one Dbf of tbs to other? that is,
> If the tablespace A has 2 dbf's - A1.dbf and A2.dbf , how do I transfer the data from A2.dbf to A1.dbf ?
> 3. Is export of tablespace --> drop tablespace --> recreate tablespace --> import data to the new tablespace, the only option??
> 4. Will resizing the datafile to 0K as in "" Alter database datafile 'Path_of_datafile' resize 0 K; "" force the data to move from one dbf to other of the same tbs? Or will it throw an error ,. since it has data more than 0K size???
>
>
> Thanks in advance,
>
> Warm Regards,
>
> Sheryl Philip
>
>
>
> DISCLAIMER:
> This message contains privileged and confidential information and is intended only for an individual named. If you are not the intended recipient, you should not disseminate, distribute, store, print, copy or deliver this message. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. The sender, therefore, does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required, please request a hard-copy version.
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> To post a dba job: http://jobs.lazydba.com
> To Subscribe : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
>
>
>
>

Oracle LazyDBA home page