zoukankan      html  css  js  c++  java
  • undo表空间丢失、损坏

    1、模拟误删undo表空间

    rm -rf undotbs01.dbf

    2、解决步骤

    SQL> shutdown immediate
    ORA-01116: error in opening database file 3
    ORA-01110: data file 3: '/u01/app/oracle/oradata/PROD1/undotbs01.dbf'
    ORA-27041: unable to open file
    Linux Error: 2: No such file or directory
    Additional information: 3
    SQL> select status from v$instance;

    STATUS
    ------------
    OPEN

    SQL> shutdown abort;
    ORACLE instance shut down.
    SQL> startup
    ORACLE instance started.

    Total System Global Area 849530880 bytes
    Fixed Size 1348244 bytes
    Variable Size 499125612 bytes
    Database Buffers 343932928 bytes
    Redo Buffers 5124096 bytes
    Database mounted.
    ORA-01157: cannot identify/lock data file 3 - see DBWR trace file
    ORA-01110: data file 3: '/u01/app/oracle/oradata/PROD1/undotbs01.dbf'


    SQL> alter database datafile 3 offline drop;

    Database altered.

    SQL> alter system set undo_management='MANUAL' scope=spfile;

    System altered.

    SQL> shutdown immediate
    ORA-01109: database not open


    Database dismounted.
    ORACLE instance shut down.

    SQL> startup
    ORACLE instance started.

    Total System Global Area 849530880 bytes
    Fixed Size 1348244 bytes
    Variable Size 499125612 bytes
    Database Buffers 343932928 bytes
    Redo Buffers 5124096 bytes
    Database mounted.
    Database opened.

    SQL> create pfile='/tmp/initPROD1.ora' from spfile;

    File created.

    SQL> shutdown immediate
    ORA-00376: file 3 cannot be read at this time
    ORA-01110: data file 3: '/u01/app/oracle/oradata/PROD1/undotbs01.dbf'


    SQL> shutdown abort
    ORACLE instance shut down.
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    [oracle@edgzrip1-PROD1 PROD1]$ vi /tmp/initPROD1.ora   --添加如下一行

     *._CORRUPTED_ROLLBACK_SEGMENTS=(_SYSSMU10_2490256178$,_SYSSMU9_3593450615$,  _SYSSMU8_1909280886$,_SYSSMU7_1924883037$,_SYSSMU6_2460248069$,_SYSSMU5_3787622316$,  _SYSSMU4_1455318006$,_SYSSMU3_2210742642$,_SYSSMU2_4228238222$,_SYSSMU1_3138885392$)

    [oracle@edgzrip1-PROD1 PROD1]$ sqlplus / as sysdba

    SQL*Plus: Release 11.2.0.3.0 Production on Wed Aug 21 23:06:00 2019

    Copyright (c) 1982, 2011, Oracle. All rights reserved.

    Connected to an idle instance.

    SQL> startup pfile='/tmp/initPROD1.ora';
    ORACLE instance started.

    Total System Global Area 849530880 bytes
    Fixed Size 1348244 bytes
    Variable Size 499125612 bytes
    Database Buffers 343932928 bytes
    Redo Buffers 5124096 bytes
    Database mounted.
    Database opened.
    SQL> drop tablespace undotbs1 including contents and datafiles;

    Tablespace dropped.

    SQL> select file_name from dba_data_files;

    FILE_NAME
    --------------------------------------------------------------------------------
    /u01/app/oracle/oradata/PROD1/users01.dbf
    /u01/app/oracle/oradata/PROD1/sysaux01.dbf
    /u01/app/oracle/oradata/PROD1/system01.dbf
    /u01/app/oracle/oradata/PROD1/example01.dbf


    SQL> create undo tablespace undotbs1 datafile '/u01/app/oracle/oradata/PROD1/undotbs01.dbf' size 100m;

    Tablespace created.

    SQL> show parameter undo

    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    undo_management string MANUAL
    undo_retention integer 900
    undo_tablespace string UNDOTBS1
    SQL> alter system set undo_tablespace='UNDOTBS1' scope=spfile;
    alter system set undo_tablespace='UNDOTBS1' scope=spfile
    *
    ERROR at line 1:
    ORA-32001: write to SPFILE requested but no SPFILE is in use

    SQL> shutdown immedaite
    SP2-0717: illegal SHUTDOWN option
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.

    [oracle@edgzrip1-PROD1 dbs]$ cp /tmp/initPROD1.ora .

    SQL> create spfile from pfile;

    File created.

    SQL> startup force
    ORACLE instance started.

    Total System Global Area 849530880 bytes
    Fixed Size 1348244 bytes
    Variable Size 499125612 bytes
    Database Buffers 343932928 bytes
    Redo Buffers 5124096 bytes
    Database mounted.
    Database opened.

    SQL> alter system set undo_tablespace='UNDOTBS1' scope=spfile;

    System altered.

    SQL> startup force
    ORACLE instance started.

    Total System Global Area 849530880 bytes
    Fixed Size 1348244 bytes
    Variable Size 499125612 bytes
    Database Buffers 343932928 bytes
    Redo Buffers 5124096 bytes
    Database mounted.
    Database opened.
    SQL>

  • 相关阅读:
    网页图片垂直剧中 等比例缩放 黑白显示
    vs.net打包(自动检测环境并安装.net framwork)
    22个所见即所得在线Web编辑器
    js验证表单大全3
    js验证表单大全2
    开源界的5大开源许可协议
    ffmpeg参数使用说明2
    ffmpeg参数使用说明1
    js验证表单大全1
    【从零开始学Spring笔记】注解和XML整合开发
  • 原文地址:https://www.cnblogs.com/orcl-2018/p/11391999.html
Copyright © 2011-2022 走看看