Get the App
SLTechnology News&Howtos  ›  Database  › 

Delete the data file of offline status in oracle

Shulou Source: shulou.com Published: 2022-06-01 07:32:50 10月23日 Update

Oracle is in archive mode:

I started to want to delete a data file in a tablespace separately.

First, query the information about the data file you want to delete:

Select * from v$datafile

Alter database datafile'/ data/gps03.dbf' offline

After changing the offline state, you can see the file that needs to be restored in v$recover_file.

Select * from v$recover_file

You can query the file# number of the file. Then check the select * from vault datafile; determine the location of the file.

3. After leaving the data file in offline, delete the data file:

Alter tablespace MCC01 drop'/ data/gps03.dbf'

Prompt to delete offline data files in local table space.

So I'm having this data file online.

Alter database datafile'/ data/gps03.dbf' online

The results also suggest that:

0RA-01113: file 8 requires media recovery.

ORA-01110: data file 8:'/ data/gps03.dbf'

So I executed:

Recover datafile 8; (note that this statement cannot be executed in plsql, otherwise it prompts an invalid sql statement)

After execution: prompt

Complete the media recovery.

4. Query v$recover_file again and find that there are no files to recover. In querying v$datafile, it is found that the status of this file is no longer in RECOVER state, but has become offline. Put it online again.

Alter database datafile 8 online

After executing the above statement, check the status of the data file in v$datafile and change it to online state.

5. Delete the data file again.

Alter tablespace MCC01 drop datafile 8

Delete the data file and finish here.

Tags: Files data status prompts queries again statements media space location information patterns results offline Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MariaDB OPPO Reno Docker Shulou Technology