Oracle Data Guard_ 主库删除表空间


8.3.2Dropping Tablespaces and Deleting Datafiles

8.3.2 删除表空间和删除数据文件  

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 when theSTANDBY_FILE_MANAGEMENTinitialization parameter is set toAUTOorMANUAL.

当你在主库删除一个或多个数据文件或者删除一个或多个表空间时,你也需要在备库删除相关的数据文件,以下部分提供的例子,当STANDBY_FILE_MANAGEMENT参数设置为AUTO或者MANUAL时关于删除表空间和删除数据文件。 

8.3.2.1When STANDBY_FILE_MANAGEMENT Is Set to AUTO or MANUAL

8.3.2.1 当STANDBY_FILE_MANAGEMENT设置为AUTO或者MANUAL时  

The following procedure works whether theSTANDBY_FILE_MANAGEMENTinitialization parameter is set to eitherMANUALorAUTO, as follows:

以下的步骤不管STANDBY_FILE_MANAGEMENT参数设置为MANUAL还是AUTO,都能工作,如下:

 

  1. Drop the tablespace from the primary database:

    1.从主库删除一个表空间

    SQL> DROP TABLESPACE tbs_4; SQL> ALTER SYSTEM SWITCH LOGFILE;  
  2. 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.

    确保重做应用在运行,这样备库就会应用这些变化。如果以下的查询返回的MRP或者MRP0进程,则说明重做应用在运行

     

    SQL> SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;  

    To verify that deleted datafiles are no longer part of the database, query theV$DATAFILEview.

    验证已经删除的数据文件不再存在数据库中,可查询V$DATAFILE视图。

     

  3. Delete the corresponding datafile on the standby system after the archived redo log file was applied to the standby database. For example:

    在归档重做日志被应用再备库之后,在备库删除相应的数据文件,例如:

     

    % rm /disk1/Oracle/oradata/payroll/s2tbs_4.dbf  
  4. 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:

    在主库中,确保备库应用删除表空间的重做信息之后,你可以从表空间移除数据文件,例如:

     

    % rm /disk1/oracle/oradata/payroll/tbs_4.dbf  

8.3.2.2Using DROP TABLESPACE INCLUDING CONTENTS AND DATAFILES

8.3.2.2 使用DROP TABLESPACE INCLUDING CONTENTS AND DATAFILES  

You can issue the SQLDROP TABLESPACE INCLUDING CONTENTS AND DATAFILESstatement on the primary database to delete the datafiles on both the primary and standby databases. To use this statement, theSTANDBY_FILE_MANAGEMENTinitialization parameter must be set toAUTO. For example, to drop the tablespace at the primary site:

你可以在主库上使用DROP TABLESPACE INCLUDING CONTENTS AND DATAFILES来删除主库和备库的数据文件,前提是STANDBY_FILE_MANAGEMENT必须设置为AUTO,例如,在主库上删除一个表空间:

 

SQL> DROP TABLESPACE INCLUDING CONTENTS AND DATAFILES tbs_4; SQL> ALTER SYSTEM SWITCH LOGFILE;   ########################################################################################################### 我的实验:主库使用DROP TABLESPACE INCLUDING CONTENTS AND DATAFILES删除表空间,备库中的STANDBY_FILE_MANAGEMENT参数设置为AUTO 主库:PROD 备库:PRODSTD  

相关内容