Home Database Mysql Tutorial Oracle Data Guard_ 主库删除表空间

Oracle Data Guard_ 主库删除表空间

Jun 07, 2016 pm 04:47 PM
oracle

当你在主库删除一个或多个数据文件或者删除一个或多个表空间时,你也需要在备库删除相关的数据文件,以下部分提供的例子,当STAN

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.

当你在主库删除一个或多个数据文件或者删除一个或多个表空间时,你也需要在备库删除相关的数据文件,以下部分提供的例子,当

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,都能工作,如下:

 

  • Drop the tablespace from the primary database:

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

    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.

    确保重做应用在运行,这样备库就会应用这些变化。如果以下的查询返回的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视图。

     

  • 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

     

  • 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

     

    1.首先查看STANDBY_FILE_MANAGEMENT参数是否设置为AUTO

    SYS@PRODSTD>show parameter STANDBY_FILE_MANAGEMENT

     

    NAME TYPE VALUE

    ------------------------------------ ----------- ------------------------------

    standby_file_management string AUTO

     

    2.查看两边的表空间以及数据文件

    主库:

    SYS@PROD>select file_name,tablespace_name from dba_data_files;

     

    FILE_NAME TABLESPACE_NAME

    -------------------------------------------------- ------------------------------

    /u01/app/oracle/oradata/PROD/Disk1/system01.dbf SYSTEM

    /u01/app/oracle/oradata/PROD/Disk1/undotbs01.dbf UNDOTBS1

    /u01/app/oracle/oradata/PROD/Disk1/sysaux01.dbf SYSAUX

    /u01/app/oracle/oradata/PROD/Disk1/example01.dbf EXAMPLE

    /u01/app/oracle/oradata/PROD/Disk1/users01.dbf USERS

    /u01/app/oracle/oradata/PROD/Disk1/swtich_tbs01.db SWTICH_TBS

    f

     

     

    6 rows selected.

     

    备库:

    SYS@PRODSTD>select name from v$datafile;

     

    NAME

    --------------------------------------------------------------------------------

    /u01/app/oracle/oradata/PRODSTD/Disk1/system01.dbf

    /u01/app/oracle/oradata/PRODSTD/Disk1/undotbs01.dbf

    /u01/app/oracle/oradata/PRODSTD/Disk1/sysaux01.dbf

    /u01/app/oracle/oradata/PRODSTD/Disk1/example01.dbf

    /u01/app/oracle/oradata/PRODSTD/Disk1/PRODSTD/datafile/o1_mf_swtich_t_9m21f1f0_.

    dbf

     

    /u01/app/oracle/oradata/PRODSTD/Disk1/users01.dbf

     

    6 rows selected.

     

    3.在主库执行删除表空间及数据文件

    SYS@PROD>drop tablespace SWTICH_TBS including contents and datafiles;

     

    Tablespace dropped.

     

    ------------------------------------------------------------------------------------------

    主库告警日志:

    Sun Mar 30 10:47:37 2014

    drop tablespace SWTICH_TBS including contents and datafiles

    Sun Mar 30 10:47:42 2014

    Deleted file /u01/app/oracle/oradata/PROD/Disk1/swtich_tbs01.dbf

    Completed: drop tablespace SWTICH_TBS including contents and datafiles

    ------------------------------------------------------------------------------------------

    4.再次查看两边的表空间以及数据文件

    主库:

    SYS@PROD>select file_name,tablespace_name from dba_data_files;

     

    FILE_NAME TABLESPACE_NAME

    -------------------------------------------------- ------------------------------

    /u01/app/oracle/oradata/PROD/Disk1/system01.dbf SYSTEM

    /u01/app/oracle/oradata/PROD/Disk1/undotbs01.dbf UNDOTBS1

    /u01/app/oracle/oradata/PROD/Disk1/sysaux01.dbf SYSAUX

    /u01/app/oracle/oradata/PROD/Disk1/example01.dbf EXAMPLE

    /u01/app/oracle/oradata/PROD/Disk1/users01.dbf USERS

     

    备库:

    SYS@PRODSTD>select name from v$datafile;

     

    NAME

    --------------------------------------------------------------------------------

    /u01/app/oracle/oradata/PRODSTD/Disk1/system01.dbf

    /u01/app/oracle/oradata/PRODSTD/Disk1/undotbs01.dbf

    /u01/app/oracle/oradata/PRODSTD/Disk1/sysaux01.dbf

    /u01/app/oracle/oradata/PRODSTD/Disk1/example01.dbf

    /u01/app/oracle/oradata/PRODSTD/Disk1/PRODSTD/datafile/o1_mf_swtich_t_9m21f1f0_.dbf

    /u01/app/oracle/oradata/PRODSTD/Disk1/users01.dbf

     

    6 rows selected.

    此时主库的归档重做日志还没有传到备库。

    5.手动切换日志,同步主备库,让备库应用重做日志。

    SYS@PROD>alter system switch logfile;

     

    System altered.

    -------------------------------------------------------------------------------------------

    主库告警日志:

    LNS1 started with pid=57, OS id=3000

    Sun Mar 30 10:58:08 2014

    Thread 1 advanced to log sequence 34

    Current log# 2 seq# 34 mem# 0: /u01/app/oracle/oradata/PROD/Disk1/redo02.log

    Current log# 2 seq# 34 mem# 1: /u01/app/oracle/oradata/PROD/Disk2/redo02_1.log

    Sun Mar 30 10:58:10 2014

    LNS: Standby redo logfile selected for thread 1 sequence 34 for destination LOG_ARCHIVE_DEST_2

    Sun Mar 30 10:58:11 2014

    ARC5: Standby redo logfile selected for thread 1 sequence 33 for destination LOG_ARCHIVE_DEST_2

     

    备库告警日志:

     

    Sun Mar 30 10:58:11 2014

    Redo Shipping Client Connected as PUBLIC

    -- Connected User is Valid

    RFS[3]: Assigned to RFS process 2939

    RFS[3]: Identified database type as 'physical standby'

    Sun Mar 30 10:58:11 2014

    Redo Shipping Client Connected as PUBLIC

    -- Connected User is Valid

    RFS[4]: Assigned to RFS process 2941

    RFS[4]: Identified database type as 'physical standby'

    Primary database is in MAXIMUM PERFORMANCE mode

    Primary database is in MAXIMUM PERFORMANCE mode

    RFS[4]: Successfully opened standby log 6: '/u01/app/oracle/oradata/PRODSTD/Disk1/standby06.log'

    Sun Mar 30 10:58:12 2014

    RFS[3]: Successfully opened standby log 7: '/u01/app/oracle/oradata/PRODSTD/Disk1/standby07.log'

    Sun Mar 30 10:58:17 2014

    Media Recovery Log /u01/app/oracle/oradata/PRODSTD/Disk2/arch/1_33_842523531.arc

    Recovery deleting file #5:'/u01/app/oracle/oradata/PRODSTD/Disk1/PRODSTD/datafile/o1_mf_swtich_t_9mh1rzf6_.dbf' from controlfile.

    Deleted Oracle managed file /u01/app/oracle/oradata/PRODSTD/Disk1/PRODSTD/datafile/o1_mf_swtich_t_9mh1rzf6_.dbf

    Recovery dropped tablespace 'SWTICH_TBS'

    Media Recovery Waiting for thread 1 sequence 34 (in transit)

    -----------------------------------------------------------------------------------------------------------

    6.查看备库数据文件

    SYS@PRODSTD>select file#,name from v$datafile;

     

    FILE# NAME

    ---------- -------------------------------------------------------

    1 /u01/app/oracle/oradata/PRODSTD/Disk1/system01.dbf

    2 /u01/app/oracle/oradata/PRODSTD/Disk1/undotbs01.dbf

    3 /u01/app/oracle/oradata/PRODSTD/Disk1/sysaux01.dbf

    4 /u01/app/oracle/oradata/PRODSTD/Disk1/example01.dbf

    7 /u01/app/oracle/oradata/PRODSTD/Disk1/users01.dbf

     

    此时备库的SWITCH_TBS表空间已经被删除。

     

    相关参考:

    Oracle Data Guard 重要配置参数

    基于同一主机配置 Oracle 11g Data Guard

    探索Oracle之11g DataGuard

    Oracle Data Guard (RAC+DG) 归档删除策略及脚本

    Oracle Data Guard 的角色转换

    Oracle Data Guard的日志FAL gap问题

    Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 处理方法

    linux

    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. How to Fix Audio if You Can't Hear Anyone
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    WWE 2K25: How To Unlock Everything In MyRise
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    How to import oracle database How to import oracle database Apr 11, 2025 pm 08:06 PM

    Data import method: 1. Use the SQLLoader utility: prepare data files, create control files, and run SQLLoader; 2. Use the IMP/EXP tool: export data, import data. Tip: 1. Recommended SQL*Loader for big data sets; 2. The target table should exist and the column definition matches; 3. After importing, data integrity needs to be verified.

    How to create a table in oracle How to create a table in oracle Apr 11, 2025 pm 08:00 PM

    Creating an Oracle table involves the following steps: Use the CREATE TABLE syntax to specify table names, column names, data types, constraints, and default values. The table name should be concise and descriptive, and should not exceed 30 characters. The column name should be descriptive, and the data type specifies the data type stored in the column. The NOT NULL constraint ensures that null values ​​are not allowed in the column, and the DEFAULT clause specifies the default values ​​for the column. PRIMARY KEY Constraints to identify the unique record of the table. FOREIGN KEY constraint specifies that the column in the table refers to the primary key in another table. See the creation of the sample table students, which contains primary keys, unique constraints, and default values.

    How to check tablespace size of oracle How to check tablespace size of oracle Apr 11, 2025 pm 08:15 PM

    To query the Oracle tablespace size, follow the following steps: Determine the tablespace name by running the query: SELECT tablespace_name FROM dba_tablespaces; Query the tablespace size by running the query: SELECT sum(bytes) AS total_size, sum(bytes_free) AS available_space, sum(bytes) - sum(bytes_free) AS used_space FROM dba_data_files WHERE tablespace_

    How to add table fields to oracle How to add table fields to oracle Apr 11, 2025 pm 07:30 PM

    Use the ALTER TABLE statement, the specific syntax is as follows: ALTER TABLE table_name ADD column_name data_type [constraint-clause]. Where: table_name is the table name, column_name is the field name, data_type is the data type, and constraint-clause is an optional constraint. Example: ALTER TABLE employees ADD email VARCHAR2(100) Add an email field to the employees table.

    What to do if the oracle can't be opened What to do if the oracle can't be opened Apr 11, 2025 pm 10:06 PM

    Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

    How to solve garbled code in oracle How to solve garbled code in oracle Apr 11, 2025 pm 10:09 PM

    Oracle garbled problems can be solved by checking the database character set to ensure they match the data. Set the client character set to match the database. Convert data or modify column character sets to match database character sets. Use Unicode character sets and avoid multibyte character sets. Check that the language settings of the database and client are correct.

    How to re-query oracle How to re-query oracle Apr 11, 2025 pm 07:33 PM

    Oracle provides multiple deduplication query methods: The DISTINCT keyword returns a unique value for each column. The GROUP BY clause groups the results and returns a non-repetitive value for each group. The UNIQUE keyword is used to create an index containing only unique rows, and querying the index will automatically deduplicate. The ROW_NUMBER() function assigns unique numbers and filters out results that contain only line 1. The MIN() or MAX() function returns non-repetitive values ​​of a numeric column. The INTERSECT operator returns the common values ​​of the two result sets (no duplicates).

    How to encrypt oracle view How to encrypt oracle view Apr 11, 2025 pm 08:30 PM

    Oracle View Encryption allows you to encrypt data in the view, thereby enhancing the security of sensitive information. The steps include: 1) creating the master encryption key (MEk); 2) creating an encrypted view, specifying the view and MEk to be encrypted; 3) authorizing users to access the encrypted view. How encrypted views work: When a user querys for an encrypted view, Oracle uses MEk to decrypt data, ensuring that only authorized users can access readable data.

    See all articles