8.3.2Dropping Tablespaces and Deleting Datafiles8.3.2 Delete Tablespaces and data files
When you delete one or moredatafiles or drop one or more tablespaces in the primary database, you also need to delete the corresponding datafiles to the standby database. the following sections provide examples of dropping tablespaces and deleting datafiles whenSTANDBY_FILE_MANAGEMENT
Initialization parameter is setAUTO
OrMANUAL
.
When you delete one or more data files in the master database or delete one or more tablespaces, you also need to delete the relevant data files in the slave database. The example provided in the following section is as follows, when the STANDBY_FILE_MANAGEMENT parameter is set to AUTO or MANUAL, you can delete tablespaces and data files.
8.3.2.1When STANDBY_FILE_MANAGEMENT Is Set to AUTO or MANUAL8.3.2.1 when STANDBY_FILE_MANAGEMENT Is Set to AUTO or MANUAL
The following procedure works whetherSTANDBY_FILE_MANAGEMENT
Initialization parameter is set to eitherMANUAL
OrAUTO
, As follows:
The following steps can work regardless of whether the STANDBY_FILE_MANAGEMENT parameter is set to MANUAL or AUTO:
Drop the tablespace from the primary database:
1. delete a tablespace from the master database
SQL> drop tablespace tbs_4; SQL> ALTER SYSTEM SWITCH LOGFILE;
Make sure that Redo Apply is running (so that the change is applied to the standby database). If the following query returns the MRP or MRP0 process, Redo Apply is running.
Make sure that the redo application is running, so that the slave database will apply these changes. If the MRP or MRP0 process returned by the following query, the redo application is running.
SQL> SELECT PROCESS, STATUS FROM V $ MANAGED_STANDBY;To verify that deleted datafiles are no longer part of the database, queryV$DATAFILE
View.
Verify that the deleted data file no longer exists in the Database. You can query the V $ DATAFILE view.
Delete the corresponding datafile on the standby system after the archived redo log file was applied to the standby database. For example:
After the archived redo log is applied to the standby database, delete the corresponding data files in the standby database. For example:
% Rm/disk1/Oracle/oradata/payroll/s2tbs_4.dbf
On the primary database, after ensuring the standby database applied the redo information for the dropped tablespace, you can remove the datafile for the tablespace. For example:
In the primary database, after the standby database application deletes the tablespace redo information, you can remove data files from the tablespace. For example:
% Rm/disk1/oracle/oradata/payroll/tbs_4.dbf
8.3.2.2Using drop tablespace including contents and DATAFILES8.3.2.2 use DROP TABLESPACE INCLUDING CONTENTS AND DATAFILES
You can issue the SQLDROP TABLESPACE INCLUDING CONTENTS AND DATAFILES
Statement on the primary database to delete the datafiles on both the primary and standby databases. To use this statement,STANDBY_FILE_MANAGEMENT
Initialization parameter must be setAUTO
. For example, to drop the tablespace at the primary site:
You can use drop tablespace including contents and datafiles on the master database to delete the data files of the master AND slave databases, provided that STANDBY_FILE_MANAGEMENT must be set to AUTO. For example, you can delete a TABLESPACE on the master database:
SQL> drop tablespace including contents and datafiles tbs_4; SQL> ALTER SYSTEM SWITCH LOGFILE; ######################################## ######################################## ########################## my experiment: the master database uses drop tablespace including contents and datafiles to delete the TABLESPACE. The STANDBY_FILE_MANAGEMENT parameter in the slave database is set to AUTO master database: PROD slave Database: PRODSTD