Data file bad Delete data file

Source: Internet
Author: User
Tags backup
Data
There is no easy way to delete a table space data file, the only way is to delete the entire defined table space, the steps are as follows (if the data on this data file is not needed):

If the database is running in a non-archive mode:

1. Mount Database-Startup mount
2. Delete data file-ALTER DATABASE datafile XXX offline drop
3. Open the database-ALTER DATABASE open
4. View all objects that belong to this table space:
Select owner, Segment_name, Segment_type
From Dba_segments
where Tablespace_name= ' Tbs_name '
5. Export all objects of this tablespace------to do with the EXP command
6. Delete tablespace-drop tablespace tbs_name including contents
7. Delete all physical data files from this tablespace delete the physical datafiles belonging to the tablespace
8. Rebuild the table space and import the DMP file previously exported.


If the database is running in archive mode:

1. Mount Database-Startup mount
2. Delete data file-ALTER DATABASE datafile XXX offline
(Note:offline This data file, this data file is part of this database, but it is marked as offline in the control file.)
3. Delete physical data files at the operating system level
4. Open the database-ALTER DATABASE open
5. The following operations can be done:
An object that exports the table space
Delete a table space
Rebuilding a table space and importing objects

If the database is running in archive mode and the data files are backed up:

1.MOUNT Database
2.OFFLINE data file: ALTER DATABASE datafile XXX offline;
3. Copy the backed-up data file to the location of the original data file.
4. Put the backup data files into the archive directory for all current archive logs.
5. Recover data file: Recover automatic datafile xxx (to enter full path name)
6. Then online data file: Alter DATABASE datafile XXX online;
7. Open database: ALTER DATABASE open;
8. Do a database shutdown full backup.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.