MOS又一次不靠谱—ORA-27163: out of memory

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:MOS又一次不靠谱—ORA-27163: out of memory

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

数据库版本

oracle -> 11g @xifenfei:/home/oracle$sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 30 10:28:30 2014
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for HPUX: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

数据库补丁信息

oracle -> 11g @xifenfei:/home/oracle$opatch lspatches
18973907;
18795105;
18701707;
18284357;
18020394;
17564992;
17308789;
17306264;
17259786;
17079301;
16477664;
16188701;
14368995;
14245531;
11744544;
18522515;OCW Patch Set Update : 11.2.0.4.3 (18522515)
18522509;Database Patch Set Update : 11.2.0.4.3 (18522509)

收集spa报告报ORA-27163: out of memory错误

SQL> SELECT dbms_sqlpa.report_analysis_task('SPA_TEST', 'HTML', 'errors','ALL') FROM dual;
ERROR:
ORA-27163: out of memory
ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 8211
ORA-06512: at "SYS.DBMS_SQLPA", line 515
ORA-06512: at line 1
no rows selected

设置event后收集

Connected.
SQL> alter session set events '31156 trace name context forever, level 0x400';
Session altered.
SQL> SELECT dbms_sqlpa.report_analysis_task('SPA_TEST', 'HTML', 'errors','ALL') FROM dual;
DBMS_SQLPA.REPORT_ANALYSIS_TASK('SPA_TEST','HTML','ERRORS','ALL')
--------------------------------------------------------------------------------
<html>
    <head>
        <title>
   SQL Performance Impact Analyzer Report

查询MOS发现XML Parser Fails With ORA-27163 (Out Of Memory) (Doc ID 1599434.1),相关描述:
bug-xml
按照文档描述,该问题在11.2.0.4中已经修复,可是在hp unix中依然存在该问题,经验告诉我们,现在的MOS不能完全相信

因用户错误创建index报ORA-01129错误

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:因用户错误创建index报ORA-01129错误

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

数据库版本

SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for HPUX: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

报ORA-01129错误

SQL> create index SERIVCE.ind_xifenfei on SERVICE.t_user(create_date);
create index SERIVCE.ind_xifenfei on SERVICE.t_user(create_date)
                                         *
ERROR at line 1:
ORA-01129: user's default or temporary tablespace does not exist

查询表空间信息

SQL> select TABLESPACE_NAME,CONTENTS,STATUS from dba_tablespaces where TABLESPACE_NAME in ('SERVICE','TEMP');
TABLESPACE_NAME                CONTENTS  STATUS
------------------------------ --------- ---------
SERVICE                        PERMANENT ONLINE
TEMP                           TEMPORARY ONLINE

通过分析,证明相关的表空间都存在,进一步检查sql语句,发现SERVICE被错误的书写为了SERIVCE,检查SERIVCE用户.

SQL> select count(*) from dba_users where username='SERIVCE';
  COUNT(*)
----------
         0

通过分析,可以知道是因为index对应的用户不存在,从而出现了ORA-01129的错误,按道理应该报ORA-01918,而不是ORA-01129.查询MOS发现Bug 17058847 Creating index in non existing schema results in ORA-1129 and not ORA-1918
bug 17058847


bbed简单替换block测试

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:bbed简单替换block测试

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

有朋友在我论坛中提问copy一个块,如何在前台显示其中数据,前段时间比较忙,没有及时答复该问题,今天通过试验方式进行了测试说明,本试验简单,仅是同一个数据文件中的同一个对象中的两个block进行了替换
创建测试表

SQL> conn chf/xifenfei
Connected.
SQL> create table t_xifenfei as select * from dba_objects;
Table created.
SQL> select EXTENT_ID,FILE_ID,BLOCK_ID,BLOCKS from dba_extents where segment_name='T_XIFENFEI' AND OWNER='CHF';
 EXTENT_ID    FILE_ID   BLOCK_ID     BLOCKS
---------- ---------- ---------- ----------
         0          4        176          8
         1          4        184          8
         2          4        192          8
         3          4        200          8
         4          4        208          8
         5          4        216          8
         6          4        224          8
         7          4        232          8
         8          4        240          8
         9          4        248          8
        10          4        256          8
 EXTENT_ID    FILE_ID   BLOCK_ID     BLOCKS
---------- ---------- ---------- ----------
        11          4        264          8
        12          4        272          8
        13          4        280          8
        14          4        288          8
        15          4        296          8
        16          4        384        128
        17          4        512        128
        18          4        640        128
        19          4        768        128
        20          4        896        128
        21          4       1024        128
 EXTENT_ID    FILE_ID   BLOCK_ID     BLOCKS
---------- ---------- ---------- ----------
        22          4       1152        128
        23          4       1280        128
        24          4       1408        128
25 rows selected.
SQL>  select * from (select distinct dbms_rowid.rowid_relative_fno(rowid),
  2  dbms_rowid.rowid_block_number(rowid) from t_xifenfei ORDER BY 2 )where rownum<5 ;
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID) DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
------------------------------------ ------------------------------------
                                   4                                  179
                                   4                                  180
                                   4                                  181
                                   4                                  182

查询file 4 block 180 数据情况

SQL> select object_id from t_xifenfei where  dbms_rowid.rowid_relative_fno(rowid)=4
    2 and dbms_rowid.rowid_block_number(rowid)=180;
 OBJECT_ID
----------
        81
        82
        83
        84
        85
        86
        87
        88
        89
        90
        91
 OBJECT_ID
----------
        92
        93
        94
        95
        96
        97
        98
        99
       100
       101
       102
 OBJECT_ID
----------
       103
       104
       105
       106
       107
       108
       109
       110
       111
       112
       113
 OBJECT_ID
----------
       114
       115
       116
       117
       118
       119
       120
       121
       122
       123
       124
 OBJECT_ID
----------
       125
       126
       127
       129
       128
       130
       131
       132
       133
       134
       135
 OBJECT_ID
----------
       137
       136
       138
       139
       140
       141
       142
       143
       144
       145
       146
 OBJECT_ID
----------
       147
       148
       149
       150
       151
       153
       152
       154
       155
       156
76 rows selected.

查询file 4 block 181 数据情况

SQL> select object_id from t_xifenfei where  dbms_rowid.rowid_relative_fno(rowid)=4
   2 and dbms_rowid.rowid_block_number(rowid)=181;
 OBJECT_ID
----------
       157
       158
       159
       160
       161
       162
       163
       164
       165
       166
       167
 OBJECT_ID
----------
       168
       169
       170
       171
       172
       173
       174
       175
       176
       177
       178
 OBJECT_ID
----------
       179
       180
       181
       182
       183
       184
       185
       186
       187
       188
       189
 OBJECT_ID
----------
       190
       191
       192
       193
       194
       195
       196
       197
       198
       199
       200
 OBJECT_ID
----------
       201
       202
       203
       204
       205
       206
       208
       207
       209
       210
       211
 OBJECT_ID
----------
       212
       213
       214
       215
       216
       217
       218
       219
       220
       221
       222
 OBJECT_ID
----------
       223
       224
       225
       226
       227
       228
       229
       230
       231
75 rows selected.

定位file 4 文件名

SQL> select name from v$datafile where file#=4;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL/users01.dbf

bbed 替换file 4 block 180到file 4 block 181

[oracle@oel6 ~]$ bbed filename='/u01/app/oracle/oradata/ORCL/users01.dbf' mode=edit blocksize=8192
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Wed Aug 6 21:17:11 2014
Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> show all
        FILE#           0
        BLOCK#          1
        OFFSET          0
        DBA             0x00000000 (0 0,1)
        FILENAME        /u01/app/oracle/oradata/ORCL/users01.dbf
        BIFILE          bifile.bbd
        LISTFILE
        BLOCKSIZE       8192
        MODE            Edit
        EDIT            Unrecoverable
        IBASE           Dec
        OBASE           Dec
        WIDTH           80
        COUNT           512
        LOGFILE         log.bbd
        SPOOL           No
BBED> map
 File: /u01/app/oracle/oradata/ORCL/users01.dbf (0)
 Block: 180                                   Dba:0x00000000
------------------------------------------------------------
 KTB Data Block (Table/Cluster)
 struct kcbh, 20 bytes                      @0
 struct ktbbh, 96 bytes                     @20
 struct kdbh, 14 bytes                      @124
 struct kdbt[1], 4 bytes                    @138
 sb2 kdbr[76]                               @142
 ub1 freespace[856]                         @294
 ub1 rowdata[7038]                          @1150
 ub4 tailchk                                @8188
BBED> p kcbh
struct kcbh, 20 bytes                       @0
   ub1 type_kcbh                            @0        0x06
   ub1 frmt_kcbh                            @1        0xa2
   ub1 spare1_kcbh                          @2        0x00
   ub1 spare2_kcbh                          @3        0x00
   ub4 rdba_kcbh                            @4        0x010000b4
   ub4 bas_kcbh                             @8        0x000b258a
   ub2 wrp_kcbh                             @12       0x0000
   ub1 seq_kcbh                             @14       0x02
   ub1 flg_kcbh                             @15       0x04 (KCBHFCKV)
   ub2 chkval_kcbh                          @16       0x0eb6
   ub2 spare3_kcbh                          @18       0x0000
BBED> p kcbh block 181
struct kcbh, 20 bytes                       @0
   ub1 type_kcbh                            @0        0x06
   ub1 frmt_kcbh                            @1        0xa2
   ub1 spare1_kcbh                          @2        0x00
   ub1 spare2_kcbh                          @3        0x00
   ub4 rdba_kcbh                            @4        0x010000b5
   ub4 bas_kcbh                             @8        0x000b258a
   ub2 wrp_kcbh                             @12       0x0000
   ub1 seq_kcbh                             @14       0x02
   ub1 flg_kcbh                             @15       0x04 (KCBHFCKV)
   ub2 chkval_kcbh                          @16       0xa1c5
   ub2 spare3_kcbh                          @18       0x0000
BBED> copy block 180 to block 181
 File: /u01/app/oracle/oradata/ORCL/users01.dbf (0)
 Block: 181              Offsets:    0 to  511           Dba:0x00000000
------------------------------------------------------------------------
 06a20000 b4000001 8a250b00 00000204 b60e0000 01000000 252d0100 84250b00
 00000000 03003200 b0000001 ffff0000 00000000 00000000 00000000 00800000
 84250b00 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00014c00
 ffffaa00 02045803 58030000 4c00221f c21e661e 0e1eb01d 521df81c 9e1c421c
 ea1b901b 361be11a 8c1a361a da198019 2419c818 73181918 b9176017 0717ae16
 5416f815 a2154915 f0149614 3914dc13 7f131f13 c8126e12 1412ba11 61110511
 a9104f10 f20f900f 370fdc0e 710e070e a60d430d df0c850c 2a0ccf0b 640bfa0a
 9d0a400a e6098509 2e09d408 79081e08 c3076607 0907a206 3806e005 75050b05
 b0045a04 02040000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 <32 bytes per line>
BBED> p kcbh block 181
struct kcbh, 20 bytes                       @0
   ub1 type_kcbh                            @0        0x06
   ub1 frmt_kcbh                            @1        0xa2
   ub1 spare1_kcbh                          @2        0x00
   ub1 spare2_kcbh                          @3        0x00
   ub4 rdba_kcbh                            @4        0x010000b4
   ub4 bas_kcbh                             @8        0x000b258a
   ub2 wrp_kcbh                             @12       0x0000
   ub1 seq_kcbh                             @14       0x02
   ub1 flg_kcbh                             @15       0x04 (KCBHFCKV)
   ub2 chkval_kcbh                          @16       0x0eb6
   ub2 spare3_kcbh                          @18       0x0000
BBED> p rdba_kcbh
ub4 rdba_kcbh                               @4        0x010000b4
BBED> d
 File: /u01/app/oracle/oradata/ORCL/users01.dbf (0)
 Block: 181              Offsets:    4 to  515           Dba:0x00000000
------------------------------------------------------------------------
 b4000001 8a250b00 00000204 b60e0000 01000000 252d0100 84250b00 00000000
 03003200 b0000001 ffff0000 00000000 00000000 00000000 00800000 84250b00
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00014c00 ffffaa00
 02045803 58030000 4c00221f c21e661e 0e1eb01d 521df81c 9e1c421c ea1b901b
 361be11a 8c1a361a da198019 2419c818 73181918 b9176017 0717ae16 5416f815
 a2154915 f0149614 3914dc13 7f131f13 c8126e12 1412ba11 61110511 a9104f10
 f20f900f 370fdc0e 710e070e a60d430d df0c850c 2a0ccf0b 640bfa0a 9d0a400a
 e6098509 2e09d408 79081e08 c3076607 0907a206 3806e005 75050b05 b0045a04
 02040000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 <32 bytes per line>
BBED> set count 32
        COUNT           32
BBED> d
 File: /u01/app/oracle/oradata/ORCL/users01.dbf (0)
 Block: 181              Offsets:    4 to   35           Dba:0x00000000
------------------------------------------------------------------------
 b4000001 8a250b00 00000204 b60e0000 01000000 252d0100 84250b00 00000000
 <32 bytes per line>
BBED> m /x b5
 File: /u01/app/oracle/oradata/ORCL/users01.dbf (0)
 Block: 181              Offsets:    4 to   35           Dba:0x00000000
------------------------------------------------------------------------
 b5000001 8a250b00 00000204 b60e0000 01000000 252d0100 84250b00 00000000
 <32 bytes per line>
BBED> sum apply
Check value for File 0, Block 181:
current = 0x0eb7, required = 0x0eb7
BBED> p kcbh block 181
struct kcbh, 20 bytes                       @0
   ub1 type_kcbh                            @0        0x06
   ub1 frmt_kcbh                            @1        0xa2
   ub1 spare1_kcbh                          @2        0x00
   ub1 spare2_kcbh                          @3        0x00
   ub4 rdba_kcbh                            @4        0x010000b5
   ub4 bas_kcbh                             @8        0x000b258a
   ub2 wrp_kcbh                             @12       0x0000
   ub1 seq_kcbh                             @14       0x02
   ub1 flg_kcbh                             @15       0x04 (KCBHFCKV)
   ub2 chkval_kcbh                          @16       0x0eb7
   ub2 spare3_kcbh                          @18       0x0000

验证替换后的file 4 block 181

SQL>  select object_id from t_xifenfei where  dbms_rowid.rowid_relative_fno(rowid)=4
   2  and dbms_rowid.rowid_block_number(rowid)=181;
 OBJECT_ID
----------
        81
        82
        83
        84
        85
        86
        87
        88
        89
        90
        91
 OBJECT_ID
----------
        92
        93
        94
        95
        96
        97
        98
        99
       100
       101
       102
 OBJECT_ID
----------
       103
       104
       105
       106
       107
       108
       109
       110
       111
       112
       113
 OBJECT_ID
----------
       114
       115
       116
       117
       118
       119
       120
       121
       122
       123
       124
 OBJECT_ID
----------
       125
       126
       127
       129
       128
       130
       131
       132
       133
       134
       135
 OBJECT_ID
----------
       137
       136
       138
       139
       140
       141
       142
       143
       144
       145
       146
 OBJECT_ID
----------
       147
       148
       149
       150
       151
       153
       152
       154
       155
       156
76 rows selected.

通过替换block 180的block到181,查询block 181和180数据相同,证明替换block成功

Quick Reference to Patch Numbers for Database PSU, SPU(CPU), Bundle Patches and Patchsets—201407

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:Quick Reference to Patch Numbers for Database PSU, SPU(CPU), Bundle Patches and Patchsets—201407

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

Patchsets

 l12.1.0.2 (12.1.0.2.0 PATCH SET FOR ORACLE DATABASE SERVER)  17694377
 11.2.0.4 (11.2.0.4.0 PATCH SET FOR ORACLE DATABASE SERVER)  13390677
 11.2.0.3 (11.2.0.3.0 PATCH SET FOR ORACLE DATABASE SERVER)  10404530
 11.2.0.2 (11.2.0.2.0 PATCH SET FOR ORACLE DATABASE SERVER)  10098816
 11.1.0.7 (11.1.0.7.0 PATCH SET FOR ORACLE DATABASE SERVER)  6890831
 10.2.0.5 (10.2.0.5 PATCH SET FOR ORACLE DATABASE SERVER)  8202632
 d10.2.0.4 (10.2.0.4.0 PATCH SET FOR ORACLE DATABASE SERVER)  6810189
 e10.2.0.3 (10.2.0.3 PATCH SET FOR ORACLE DATABASE SERVER)  5337014
 10.2.0.2 (10.2.0.2 PATCH SET FOR ORACLE DATABASE SERVER)  4547817
 10.1.0.5 (10.1.0.5 PATCH SET FOR ORACLE DATABASE SERVER)
 4505133
 10.1.0.4 (10.1.0.4 PATCH SET FOR ORACLE DATABASE SERVER)
 4163362
 10.1.0.3 (10.1.0.3 PATCH SET FOR ORACLE DATABASE SERVER)
 3761843
 9.2.0.8 (9.2.0.8 PATCH SET FOR ORACLE DATABASE SERVER)
 4547809
 9.2.0.7 (9.2.0.7 PATCH SET FOR ORACLE DATABASE SERVER)
 4163445
 9.2.0.6 (9.2.0.6 PATCH SET FOR ORACLE DATABASE SERVER)
 3948480
 9.2.0.5 (ORACLE 9I DATABASE SERVER RELEASE 2 – PATCH SET 4 VERSION 9.2.0.5.0)
 3501955
 9.2.0.4 (9.2.0.4 PATCH SET FOR ORACLE DATABASE SERVER)
 3095277
 9.2.0.3 (9.2.0.3 PATCH SET FOR ORACLE DATABASE SERVER)
 2761332
 9.2.0.2 (9.2.0.2 PATCH SET FOR ORACLE DATABASE SERVER)
 2632931
 9.0.1.5 (9.0.1.5 PATCHSET)
 3301544
 9.0.1.4 (9.0.1.4 PATCH SET FOR ORACLE DATABASE SERVER)
 2517300
 9.0.1.3 (9.0.1.3. PATCH SET FOR ORACLE DATA SERVER)
 2271678
 8.1.7.4 (8.1.7.4 PATCH SET FOR ORACLE DATA SERVER)
 2376472
 8.1.7.3 (8.1.7.3 PATCH SET FOR ORACLE DATA SERVER)
 2189751
 8.1.7.2 (8.1.7.2.1 PATCH SET FOR ORACLE DATA SERVER)
 1909158

PSU, SPU(CPU), Bundle Patches

12.1.0.1
 Description  PSU  GI PSU   Bundle Patch (Windows64bit)  Bundle Patch (Windows32bit)
 JUL2014  18522516 (12.1.0.1.4)  j18705901 / k18705972(12.1.0.1.4) 19062327 (12.1.0.1.11)
 APR2014  18031528 (12.1.0.1.3)  j18139660 / k18413105  (12.1.0.1.3) 18448604 (12.1.0.1.7)
 JAN2014  17552800 (12.1.0.1.2)  17735306 (12.1.0.1.2) 17977915 (12.1.0.1.3)
 OCT2013  17027533 (12.1.0.1.1)  17272829 (12.1.0.1.1)  17363796 (12.1.0.1.1)  17363795 (12.1.0.1.1)

11.2.0.4
 Description  PSU  SPU(CPU)  GI PSU  Bundle Patch (Windows 32bit & 64bit)
 JUL2014  18522509 (11.2.0.4.3)  18681862  18706472 (11.2.0.4.3)  18842982
 APR2014  18031668 (11.2.0.4.2)  18139690  18139609 (11.2.0.4.2)  18296644
 JAN2014  17478514 (11.2.0.4.1)  17551709  N/A  17987366

11.2.0.3
 Description  PSU  SPU(CPU)  GI PSU  Bundle Patch(Windows64bit)  Bundle Patch(Windows32bit)
 JUL2014  18522512 (11.2.0.3.11)  18681866  18706488 (11.2.0.3.11)  18940194  18940193
 APR2014  18031683 (11.2.0.3.10)  18139695  18139678 (11.2.0.3.10)  18372244  18372243
 JAN2014  17540582 (11.2.0.3.9)  17478415  17735354 (11.2.0.3.9)  18075406  17906981
 OCT2013  16902043 (11.2.0.3.8)  17082364  17272731 (11.2.0.3.8)  17363850  17363844
 JUL2013  16619892 (11.2.0.3.7)  16742095  16742216 (11.2.0.3.7)  16803775  16803774
 APR2013  16056266 (11.2.0.3.6)  16294378  16083653 (11.2.0.3.6)  16345834  16345833
 JAN2013  14727310 (11.2.0.3.5)  14841409  14727347 (11.2.0.3.5)  16042648  16042647
 OCT2012  14275605 (11.2.0.3.4)  14390252  14275572 (11.2.0.3.4)  14613223  14613222
 JUL2012  13923374 (11.2.0.3.3)  14038787  13919095 (11.2.0.3.3)  14223718  14223717
 APR2012  13696216 (11.2.0.3.2)  13632717  13696251 (11.2.0.3.2)  13885389  13885388
 JAN2012  13343438 (11.2.0.3.1)  13466801  13348650 (11.2.0.3.1)  13413168  13413167

11.2.0.2
 Description  PSU   SPU(CPU)  GI PSU  Bundle Patch(Windows64bit)  Bundle Patch(Windows32bit)
 aOCT2013  17082367 (11.2.0.2.12)  17082375  17272753 (11.2.0.2.12)  17363838  17363837
 JUL2013  16619893 (11.2.0.2.11)  16742100  16742320 (11.2.0.2.11)  16345852  16345851
 APR2013  16056267 (11.2.0.2.10)  16294412  16166868 (11.2.0.2.10)  16345846  16345845
 JAN2013  14727315 (11.2.0.2.9)  14841437  14841385 (11.2.0.2.9)  16100399  16100398
 OCT2012  14275621 (11.2.0.2.8)  14390377  14390437 (11.2.0.2.8)  14672268  14672267
 JUL2012  13923804 (11.2.0.2.7)  14038791  14192201 (11.2.0.2.7)  14134043  14134042
 APR2012  13696224 (11.2.0.2.6)  13632725  13696242 (11.2.0.2.6)  13697074  13697073
 JAN2012  13343424 (11.2.0.2.5)  13343244  13653086 (11.2.0.2.5)  13413155  13413154
 OCT2011  12827726 (11.2.0.2.4)  12828071  12827731 (11.2.0.2.4)  13038788  13038787
 JUL2011  12419331 (11.2.0.2.3)  12419321  12419353 (11.2.0.2.3)  12714463  12714462
 APR2011  11724916 (11.2.0.2.2)  11724984  12311357 (11.2.0.2.2)  11896292  11896290
 JAN2011  10248523 (11.2.0.2.1)  N/A  N/A  10432053  10432052
 

11.2.0.1
 Description  PSU  CPU  Bundle Patch (Windows64bit)  Bundle Patch (Windows32bit)
 aJUL2011  12419378 (11.2.0.1.6)  12419278  12429529  12429528
 APR2011  11724930 (11.2.0.1.5)  11724991  11731176  11883240
 JAN2011  10248516 (11.2.0.1.4)  10249532  10432045  10432044
 OCT2010  9952216 (11.2.0.1.3)  9952260  10100101  10100100
 JUL2010  9654983 (11.2.0.1.2)  9655013  9736865  9736864
 APR2010  9352237 (11.2.0.1.1)  9369797  N/A  N/A
 

11.1.0.7
 Description  PSU  SPU(CPU)  Bundle Patch (Windows64bit)  Bundle Patch (Windows32bit)
bJUL2014  18522513 (11.1.0.7.20)  18681875  18944208  18944207
bAPR2014  18031726 (11.1.0.7.19)  18139703  18372258  18372257
bJAN2014  17465583 (11.1.0.7.18)  17551415  17906936  17906935
bOCT2013  17082366 (11.1.0.7.17)  17082374  17363760  17363759
bJUL2013  16619896 (11.1.0.7.16)  16742110  16803788  16803787
bAPR2013  16056268 (11.1.0.7.15)  16308394  16345862  16345861
bJAN2013  14739378 (11.1.0.7.14)  14841452  15848067  15848066
 bOCT2012  14275623 (11.1.0.7.13)  14390384  14672313  14672312
 JUL2012  13923474 (11.1.0.7.12)  14038803  14109868  14109867
 APR2012  13621679 (11.1.0.7.11)  13632731  13715810  13715809
 JAN2012  13343461 (11.1.0.7.10)  13343453  13460956  13460955
 OCT2011  12827740 (11.1.0.7.9)  12828097  12914916  12914915
 JUL2011  12419384 (11.1.0.7.8)  12419265  12695278  12695277
 APR2011  11724936 (11.1.0.7.7)  11724999  11741170  11741169
 JAN2011  10248531 (11.1.0.7.6)  10249534  10350788  10350787
 OCT2010  9952228  (11.1.0.7.5)  9952269  9773825  9773817
 JUL2010  9654987 (11.1.0.7.4)  9655014  9869912  9869911
 APR2010  9352179 (11.1.0.7.3)  9369783  9392335  9392331
 JAN2010  9209238 (11.1.0.7.2)  9114072  9166861  9166858
 OCT2009  8833297 (11.1.0.7.1)  8836375  8928977  8928976
 JUL2009  N/A  8534338  8553515  8553512
 APR2009  N/A  8290478  8343070  8343061
 

11.1.0.6
 Description  CPU  Bundle Patch (Windows64bit)  Bundle Patch (Windows32bit)
 aJUL2009  8534378  8563155  8563154
 APR2009  8290402  8333657  8333655
 JAN2009  7592335  7631981  7631980
 OCT2008  7375639  7378393  7378392
 JUL2008  7150417  7210197  7210195
 APR2008  6864063  6867180  6867178
 

10.2.0.5
 Description  PSU  SPU(CPU)  Bundle Patch(Windows64bit)  Bundle Patch(Windows32bit)  Bundle Patch(WindowsItanium)
abJUL2013  16619894 (10.2.0.5.12)  16742123  16803782  16803780  16803781
 bAPR2013  16056270 (10.2.0.5.11)  16270946  16345857  16345855  16345856
 bJAN2013  14727319 (10.2.0.5.10)  14841459  15848062  15848060  15848061
 bOCT2012  14275629 (10.2.0.5.9)  14390396  14553358  14553356  14553357
 bJUL2012  13923855 (10.2.0.5.8)  14038805  14134053  14134051  14134052
 bAPR2012  13632743 (10.2.0.5.7)  13632738  13654815  13654814  13870404
 JAN2012  13343471 (10.2.0.5.6)  13343467  b13460968 b13460967  N/A
 bOCT2011  12827745 (10.2.0.5.5)  12828105  c12914913  12914911  N/A
 JUL2011  12419392 (10.2.0.5.4)  12419258  12429524  12429523  N/A
 APR2011  11724962 (10.2.0.5.3)  11725006  12328269  12328268  N/A
 JAN2011  10248542 (10.2.0.5.2)  10249537  10352673  10352672  N/A
 OCT2010  9952230 (10.2.0.5.1)  9952270  10099855  10058290  N/A
 

10.2.0.4
 Description  PSU  SPU(CPU)  Bundle Patch(Windows32bit)  Bundle Patch(Windows64bit)  Bundle Patch(WindowsItanium)
 bgJUL2013  16619897 (10.2.0.4.17)  16742253  N/A  N/A  N/A
 bgAPR2013  16056269 (10.2.0.4.16)  16270931  N/A  N/A  N/A
 bgJAN2013  14736542 (10.2.0.4.15)  14841471  N/A  N/A  N/A
bgOCT2012  14275630 (10.2.0.4.14)  14390410  N/A  N/A  N/A
bgJUL2012  13923851 (10.2.0.4.13)  14038814  N/A  N/A  N/A
 abAPR2012  12879933 (10.2.0.4.12)  12879926  13928775  13928776  N/A
 JAN2012  12879929 (10.2.0.4.11)  12879912  b13654060  N/A  N/A
 bOCT2011  12827778 (10.2.0.4.10)  12828112  12914908  12914910  12914909
 JUL2011  12419397 (10.2.0.4.9)  12419249  12429519  12429521  12429520
 APR2011  11724977 (10.2.0.4.8)  11725015  12328501  12328503  12328502
 JAN2011  10248636 (10.2.0.4.7)  10249540  10349197  10349200  10349198
 OCT2010  9952234 (10.2.0.4.6)  9952272  10084980  10084982  10084981
 JUL2010  9654991 (10.2.0.4.5)  9655017  9777076  9777078  9777077
 APR2010  9352164 (10.2.0.4.4)  9352191  9393548  9393550  9393549
 JAN2010  9119284 (10.2.0.4.3)  9119226  9169457  9169460  9169458
 OCT2009  8833280 (10.2.0.4.2)  8836308  8880857  8880861  8880858
 JUL2009  8576156 (10.2.0.4.1)  8534387  8559466  8559467  8541782
 APR2009  N/A  8290506  8307237  8307238  8333678
 JAN2009  N/A  7592346  7584866  7584867  N/A
 OCT2008  N/A  7375644  7386320  7386321  N/A
 JUL2008  N/A  7150470  7218676  7218677  N/A
 

10.2.0.3
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)  Bundle Patch (Windows64bit)
 aJAN2009  7592354  7631956  7631958  7631957
 OCT2008  7369190  7353782  7353784  7353785
 JUL2008  7150622  7252496  7252497  7252498
 APR2008  6864068  6867054  6867055  6867056
 JAN2008  6646853  6637237  6637238  6637239
 OCT2007  6394981  6430171  6430173  6430174
 JUL2007  6079591  6116131  6038242  6116139
 APR2007  5901891  5948242  5916262  5948243
 JAN2007  5881721  5846376  5846377  5846378
 

10.2.0.2
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)   Bundle Patch (Windows64bit)  Bundle Patch (WindowsItanium)
 iJAN2009  7592355  N/A  N/A  N/A
 hOCT2008  7375660  N/A  N/A  N/A
 hJUL2008  7154083  N/A  N/A  N/A
 hAPR2008  6864071  N/A  N/A  N/A
 aJAN2008  6646850  N/A  N/A  N/A
 fOCT2007  6394997  6397028  6397030  6397029
 JUL2007  6079588  6013105  6013121  6013118
 APR2007  5901881  5912173  5912179  5912176
 JAN2007  5689957  5716143  5699839  5699824
 OCT2006  5490848  5502226  5500921  5500894
 JUL2006  5225799  5251025  5251028  5251026
 APR2006  5079037  5140461  5140567  5140508
 

10.2.0.1
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (Windows64bit)  Bundle Patch (WindowsItanium)
 APR2007  5901880  N/A  N/A  N/A
 JAN2007  5689937  5695784  5695786  5695785
 OCT2006  5490846  5500927  5500954  5500951
 JUL2006  5225798  5239698  5239701  5239699
 APR2006  5049080  5059238  5059261  5059251
 JAN2006  4751931  4751539  4770480  4751549
 

10.1.0.5
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)   Bundle Patch (WindowsItanium)
 JAN2012  13343482  13413002  13413003
 OCT2011  12828135  12914905  12914906
 JUL2011  12419228  12429517  12429518
 APR2011  11725035  11731119  11731120
 JAN2011  N/A  N/A  N/A
 OCT2010  9952279  10089559  10089560
 JUL2010  9655023  9683651  9683652
 APR2010  9352208  9390288  9390289
 JAN2010  9119261  9187104  9187105
 OCT2009  8836540  8785211  8785212
 JUL2009  8534394  8656224  8656226
 APR2009  8290534  8300356  8300360
 JAN2009  7592360  7486619  7586049
 OCT2008  7375686  7367493  7367494
 JUL2008  7154097  7047034  7047037
 APR2008  6864078  6867107  6867108
 JAN2008  6647005  6637274  6637275
 OCT2007  6395024  6408393  6408394
 JUL2007  6079585  6115804  6115818
 APR2007  5901877  5907304  5907305
 JAN2007  5689908  5716295  5634747
 OCT2006  5490845  5500883  5500885
 JUL2006  5225797  5251148  5251140
 APR2006  5049074  5057606  5057609
 JAN2006  4751932  4882231  4882236
 

10.1.0.4
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 APR2007  5901876  5909871  5909879
 JAN2007  5689894  5695771  5695772
 OCT2006  5490844  5500878  5500880
 JUL2006  5225796  5239736  5239737
 APR2006  5049067  5059200  5059227
 JAN2006  4751928  4751259  4745040
 OCT2005  4567866  4579182  4579188
 JUL2005  4392423  4440706  4404600
 APR2005  4210374  4287619  4287611
 

10.1.0.3
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 JAN2007  5923277  N/A  N/A
 OCT2006  5566825  N/A  N/A
 JUL2006  5435164  N/A  N/A
 APR2006  5158022  N/A  N/A
 JAN2006  4751926  4741077  4741084
 OCT2005  4567863  4567518  4567523
 JUL2005  4392409  4389012  4389014
 APR2005  4193286  4269715  4158888
 JAN2005  4003062  4074232  3990812
 

10.1.0.2
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 APR2005  4193293  4181849  4213305
 JUL2005  4400766  4388944  4388948
 JAN2005  4003051  4104364  4083038
 

9.2.0.8
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 JUL2010  9655027  9683644  9683645
 APR2010  9352224  9390286  N/A
 JAN2010  9119275  9187106  N/A
 OCT2009  8836758  8785185  8785186
 JUL2009  8534403  8427417  8427418
 APR2009  8290549  8300340  8300346
 JAN2009  7592365  7703210  7703212
 OCT2008  7375695  7394394  7394402
 JUL2008  7154111  7047026  7047029
 APR2008  6864082  6867138  6867139
 JAN2008  6646842  6637265  6637266
 OCT2007  6395038  6417013  6417014
 JUL2007  6079582  6130293  6130295
 APR2007  5901875  5916268  5916275
 JAN2007  N/A  N/A  N/A
 OCT2006  5490859  5652380  5639519
 

9.2.0.7
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 JUL2007  6079579  6146759  6146748
 APR2007  5901872  5907274  5907275
 JAN2007  5689875  5654905  5654909
 OCT2006  5490841  5500873  5500874
 JUL2006  5225794  5250980  5250981
 APR2006  5049060  5064365  5064364
 JAN2006  4751923  4751528  4741074
 OCT2005  4567854  4579590  4579599
 JUL2005  4547566  N/A  N/A
 

9.2.0.6
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 OCT2006  5490840  5500865  5500871
 JUL2006  5225793  5239794  5239793
 APR2006  5049051  5059614  5059615
 JAN2006  4751921  4751261  4751262
 OCT2005  4567846  4579093  4579097
 JUL2005  4392392  4445852  4401917
 APR2005  4193295  4269928  4213298
 

9.2.0.5
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 OCT2006  5689708  N/A  N/A
 JUL2006  5435138  N/A  N/A
 APR2006  5219762  N/A  N/A
 OCT2005  4560421  N/A  N/A
 JUL2005  4392256  4387563  4391819
 APR2005  4193299  4195791  4214192
 JAN2005  4003006  4104374  3990809
 

9.2.0.4
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 JAN2005  4002994  4104369  4083202
 

8.1.7.4
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)
 JAN2007  5689799  5686514
 OCT2006  5490835  5496067
 JUL2006  5225788  5236412
 APR2006  5045247  5057601
 JAN2006  4751906  4751570
 OCT2005  4560405  4554818
 JUL2005  4392446  4437058
 APR2005  4193312  4180163
 JAN2005  4002909  3921893

参考文档:Quick Reference to Patch Numbers for Database PSU, SPU(CPU), Bundle Patches and Patchsets (文档 ID 1454618.1)

在Chrome高版本中配置使用AWR-Format for Chrome插件

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:在Chrome高版本中配置使用AWR-Format for Chrome插件

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

问题背景
从Chrome 21版本开始,不再直接支持非Chrome官网下载,导致AWR-Format无法正常使用,按照网络上描述:
1. 使用 -enable-easy-off-store-extension-install 不行
2. 直接使用开发者模式安装也不行
不能解决问题,通过查资料和分析语句,解决该问题,和大家分享

使用方法
下载地址:新Chrome AWR-Format
处理步骤:解压该文件,启动chrome 开发者模式,增加该目录,关闭开发者模式

具体参考
支持新Chrome AWR-Format

数据文件的三个创建SCN一点点探讨

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:数据文件的三个创建SCN一点点探讨

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

在给一个朋友数据库恢复的过程中语句该库大量删除表空间,然后创建表空,由于在创建控制文件的时候,列出来不正确文件,导致出现v$datafile_header.error出现WRONG FILE CREATE错误.通过试验重现了该错误,并且进一步测试如果真的需要历史数据文件,该如何狸猫换太子(本实验为了进一步理解数据文件创建scn相关信息)
创建xifenfei表空间,然后删除表空间,但不删除数据文件,然后创建重名表空间

SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') today,'www.xifenfei.com' xifenfei from dual;
TODAY               XIFENFEI
------------------- ----------------
2014-07-16 15:54:26 www.xifenfei.com
SQL> create tablespace xifenfei datafile '/u01/app/oracle/oradata/ORCL/xifenfei_old.dbf' size 10m;
Tablespace created.
SQL> select file#,name from v$datafile;
     FILE# NAME
---------- --------------------------------------------------
         1 /u01/app/oracle/oradata/ORCL/system01.dbf
         2 /u01/app/oracle/oradata/ORCL/sysaux01.dbf
         3 /u01/app/oracle/oradata/ORCL/undotbs01.dbf
         4 /u01/app/oracle/oradata/ORCL/users01.dbf
         5 /u01/app/oracle/oradata/ORCL/xifenfei_old.dbf
SQL> select file#,CREATION_CHANGE#,to_char(CREATION_TIME,'yyyy-mm-dd hh24:mi:ss') CREATION_TIME from v$datafile;
     FILE# CREATION_CHANGE# CREATION_TIME
---------- ---------------- -------------------
         1               18 2014-07-14 21:53:05
         2             2338 2014-07-14 21:53:42
         3             3130 2014-07-14 21:53:51
         4            15268 2014-07-14 21:54:25
         5           593520 2014-07-16 16:00:54
SQL> select file#,CREATION_CHANGE#,to_char(CREATION_TIME,'yyyy-mm-dd hh24:mi:ss') CREATION_TIME from v$datafile_header;
     FILE# CREATION_CHANGE# CREATION_TIME
---------- ---------------- -------------------
         1               18 2014-07-14 21:53:05
         2             2338 2014-07-14 21:53:42
         3             3130 2014-07-14 21:53:51
         4            15268 2014-07-14 21:54:25
         5           593520 2014-07-16 16:00:54
SQL> drop tablespace xifenfei;
Tablespace dropped.
SQL>  create tablespace xifenfei datafile '/u01/app/oracle/oradata/ORCL/xifenfei_new.dbf' size 10m;
Tablespace created.
SQL> select file#,CREATION_CHANGE#,to_char(CREATION_TIME,'yyyy-mm-dd hh24:mi:ss') CREATION_TIME from v$datafile;
     FILE# CREATION_CHANGE# CREATION_TIME
---------- ---------------- -------------------
         1               18 2014-07-14 21:53:05
         2             2338 2014-07-14 21:53:42
         3             3130 2014-07-14 21:53:51
         4            15268 2014-07-14 21:54:25
         5           593613 2014-07-16 16:02:45
SQL> select file#,CREATION_CHANGE#,to_char(CREATION_TIME,'yyyy-mm-dd hh24:mi:ss') CREATION_TIME from v$datafile_header;
     FILE# CREATION_CHANGE# CREATION_TIME
---------- ---------------- -------------------
         1               18 2014-07-14 21:53:05
         2             2338 2014-07-14 21:53:42
         3             3130 2014-07-14 21:53:51
         4            15268 2014-07-14 21:54:25
         5           593613 2014-07-16 16:02:45

rename xifenfei表空间数据文件到老数据文件

SQL> alter database datafile 5 offline drop;
Database altered.
SQL> alter database rename file '/u01/app/oracle/oradata/ORCL/xifenfei_new.dbf'
 2   to '/u01/app/oracle/oradata/ORCL/xifenfei_old.dbf';
Database altered.
SQL> alter database datafile 5 online;
alter database datafile 5 online
*
ERROR at line 1:
ORA-01122: database file 5 failed verification check
ORA-01110: data file 5: '/u01/app/oracle/oradata/ORCL/xifenfei_old.dbf'
ORA-01203: wrong incarnation of this file - wrong creation SCN
SQL> select file#,CREATION_CHANGE#,to_char(CREATION_TIME,'yyyy-mm-dd hh24:mi:ss') CREATION_TIME from v$datafile;
     FILE# CREATION_CHANGE# CREATION_TIME
---------- ---------------- -------------------
         1               18 2014-07-14 21:53:05
         2             2338 2014-07-14 21:53:42
         3             3130 2014-07-14 21:53:51
         4            15268 2014-07-14 21:54:25
         5           593613 2014-07-16 16:02:45
SQL> select file#,CREATION_CHANGE#,to_char(CREATION_TIME,'yyyy-mm-dd hh24:mi:ss') CREATION_TIME from v$datafile_header;
     FILE# CREATION_CHANGE# CREATION_TIME
---------- ---------------- -------------------
         1               18 2014-07-14 21:53:05
         2             2338 2014-07-14 21:53:42
         3             3130 2014-07-14 21:53:51
         4            15268 2014-07-14 21:54:25
         5           593520 2014-07-16 16:00:54
SQL> select file#,error from v$datafile_header;
     FILE# ERROR
---------- -----------------------------------------------------------------
         1
         2
         3
         4
         5 WRONG FILE CREATE

至此今天数据库恢复的故障已经模拟出来,就是因为数据文件头的scn和控制文件中scn不一致,从而出现了v$datafile_header.error报WRONG FILE CREATE的现象.

因为控制文件中数据文件scn和数据文件头scn不一致,因此通过重建控制文件来实现两者scn一致

SQL> alter database backup controlfile to trace as '/tmp/ctl';
Database altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP NOMOUNT
ORACLE instance started.
Total System Global Area  718225408 bytes
Fixed Size                  2292432 bytes
Variable Size             373294384 bytes
Database Buffers          339738624 bytes
Redo Buffers                2899968 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS  NOARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '/u01/app/oracle/oradata/ORCL/redo01.log'  SIZE 50M BLOCKSIZE 512,
  9    GROUP 2 '/u01/app/oracle/oradata/ORCL/redo02.log'  SIZE 50M BLOCKSIZE 512,
 10    GROUP 3 '/u01/app/oracle/oradata/ORCL/redo03.log'  SIZE 50M BLOCKSIZE 512
 11  DATAFILE
 12    '/u01/app/oracle/oradata/ORCL/system01.dbf',
 13    '/u01/app/oracle/oradata/ORCL/sysaux01.dbf',
 14    '/u01/app/oracle/oradata/ORCL/undotbs01.dbf',
 15    '/u01/app/oracle/oradata/ORCL/users01.dbf',
 16    '/u01/app/oracle/oradata/ORCL/xifenfei_old.dbf'
 17  CHARACTER SET ZHS16GBK
 18  ;
Control file created.
SQL> select file#,CREATION_CHANGE#,to_char(CREATION_TIME,'yyyy-mm-dd hh24:mi:ss') CREATION_TIME from v$datafile_header;
     FILE# CREATION_CHANGE# CREATION_TIME
---------- ---------------- -------------------
         1               18 2014-07-14 21:53:05
         2             2338 2014-07-14 21:53:42
         3             3130 2014-07-14 21:53:51
         4            15268 2014-07-14 21:54:25
         5           593520 2014-07-16 16:00:54
SQL> select file#,CREATION_CHANGE#,to_char(CREATION_TIME,'yyyy-mm-dd hh24:mi:ss') CREATION_TIME from v$datafile;
     FILE# CREATION_CHANGE# CREATION_TIME
---------- ---------------- -------------------
         1               18 2014-07-14 21:53:05
         2             2338 2014-07-14 21:53:42
         3             3130 2014-07-14 21:53:51
         4            15268 2014-07-14 21:54:25
         5           593520 2014-07-16 16:00:54
SQL> select file#,error from v$datafile_header;
     FILE# ERROR
---------- -----------------------------------------------------------------
         1
         2
         3
         4
         5

通过重建控制文件消除了v$datafile_header.error报WRONG FILE CREATE错误,继续尝试online文件

SQL> recover datafile 5;
Media recovery complete.
SQL> alter database datafile 5 online;
Database altered.
SQL> select file#,name from v$datafile;
     FILE# NAME
---------- --------------------------------------------------
         1 /u01/app/oracle/oradata/ORCL/system01.dbf
         2 /u01/app/oracle/oradata/ORCL/sysaux01.dbf
         3 /u01/app/oracle/oradata/ORCL/undotbs01.dbf
         4 /u01/app/oracle/oradata/ORCL/users01.dbf
         5 /u01/app/oracle/oradata/ORCL/xifenfei_old.dbf
SQL> alter database open;
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-01177: data file does not match dictionary - probably old incarnation
ORA-01110: data file 5: '/u01/app/oracle/oradata/ORCL/xifenfei_old.dbf'
Process ID: 7437
Session ID: 7 Serial number: 5

出现这个错误,是由于数据库中,还有file$中也记录了数据文件创建scn,而这个scn现在和数据文件头和控制文件中的scn不相等,因此无法启动数据库成功.现在需要做的就是在数据库未启动状态下修改file$中的数据文件创建scn相关值,让其和数据文件头(控制文件中记录)一致

使用第三方工具定位file$记录

1|2|89600|0|1|4194302|1280|0|18||4194306|0x004000e9|0
2|2|70400|1|2|4194302|1280|0|2338||8388610|0x004000e9|1
3|2|25600|2|3|4194302|640|0|3130||12582914|0x004000e9|2
4|2|640|4|4|4194302|160|0|15268||16777218|0x004000e9|3
5|2|1280|7|5|0|0|0|593613||20971522|0x004000e9|4
6|1|3840|||0|0|0|586295||25165826|0x004000e9|5
7|1|3840|||3932160|1280|0|587030||29360130|0x004000e9|6
对应file$结构确定每列含义,以及确定需要修改的列
每行倒数第二列为rdba地址,可以通过转换为file and block,这里对应的就是file 1 block 233
每行最后一列为该条记录在该rdba中的记录顺序

使用工具修改593613为593520,使得file$中的scn与现在控制文件和数据文件头一致,具体参考bbed修改数据内容

修改好file$中数据文件创建scn后,尝试继续操作

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: '/u01/app/oracle/oradata/ORCL/xifenfei_old.dbf'
SQL> recover datafile 5;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> select file#,name from v$datafile;
     FILE# NAME
---------- --------------------------------------------------
         1 /u01/app/oracle/oradata/ORCL/system01.dbf
         2 /u01/app/oracle/oradata/ORCL/sysaux01.dbf
         3 /u01/app/oracle/oradata/ORCL/undotbs01.dbf
         4 /u01/app/oracle/oradata/ORCL/users01.dbf
         5 /u01/app/oracle/oradata/ORCL/xifenfei_old.dbf

通过这里的简单测试,发现几个问题
1.v$datafile_header.error报WRONG FILE CREATE错误 不一定就是数据文件异常,而其本质是数据文件头scn和控制文件中scn不一致
2.数据文件online需要file$,v$datafile_header,v$datafile中关于数据文件创建scn都一致
3.通过该分析,证明在一些极端情况下,考虑考虑该替换思路实现删除数据文件重新加入数据库

Oracle安全警示录:加错裸设备导致redo异常

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:Oracle安全警示录:加错裸设备导致redo异常

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

最近一个朋友数据库异常了,咨询我,通过分析日志发现对方人员根本不懂aix中的裸设备和Oracle数据库然后就直接使用OEM创建新表空间,导致了数据库crash而且不能正常启动

Thread 1 advanced to log sequence 4395
  Current log# 1 seq# 4395 mem# 0: /dev/rorcl_redo01
Thu Jun 12 19:28:38 2014
/* OracleOEM */ CREATE SMALLFILE TABLESPACE "XIFENFEI" LOGGING DATAFILE '/dev/orcl_redo04' SIZE 2000M EXTENT MANAGEMENT
LOCAL SEGMENT SPACE MANAGEMENT  AUTO
ORA-1119 signalled during: /* OracleOEM */ CREATE SMALLFILE TABLESPACE "XIFENFEI" LOGGING DATAFILE '/dev/orcl_redo04'
SIZE 2000M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO ...
Thu Jun 12 19:36:23 2014
/* OracleOEM */ CREATE SMALLFILE TABLESPACE "XIFENFEI" LOGGING DATAFILE '/dev/orcl_redo03' SIZE 2000M EXTENT MANAGEMENT
LOCAL SEGMENT SPACE MANAGEMENT  AUTO
Thu Jun 12 19:43:56 2014
ORA-604 signalled during: /* OracleOEM */ CREATE SMALLFILE TABLESPACE "XIFENFEI" LOGGING DATAFILE '/dev/orcl_redo03'
SIZE 2000M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO ...
Thu Jun 12 19:48:11 2014
/* OracleOEM */ CREATE SMALLFILE TABLESPACE "XIFENFEI" LOGGING DATAFILE '/dev/rorcl_redo03' SIZE 2000M EXTENT
MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO
Thu Jun 12 19:48:11 2014
ORA-1537 signalled during: /* OracleOEM */ CREATE SMALLFILE TABLESPACE "XIFENFEI" LOGGING DATAFILE '/dev/rorcl_redo03'
 SIZE 2000M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO ...
Thu Jun 12 19:48:20 2014
/* OracleOEM */ CREATE SMALLFILE TABLESPACE "XIFENFEI" LOGGING DATAFILE '/dev/rorcl_redo04' SIZE 2000M EXTENT
MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO
ORA-1537 signalled during: /* OracleOEM */ CREATE SMALLFILE TABLESPACE "XIFENFEI" LOGGING DATAFILE '/dev/rorcl_redo04'
SIZE 2000M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO ...
Fri Jun 13 00:50:37 2014
Trace dumping is performing id=[cdmp_20140613005032]
Fri Jun 13 00:50:40 2014
Reconfiguration started (old inc 4, new inc 6)
List of nodes:
 0
 Global Resource Directory frozen
 * dead instance detected - domain 0 invalid = TRUE
…………
Fri Jun 13 00:50:40 2014
Beginning instance recovery of 1 threads
Reconfiguration complete
Fri Jun 13 00:50:41 2014
 parallel recovery started with 7 processes
Fri Jun 13 00:50:43 2014
Started redo scan
Fri Jun 13 00:50:43 2014
Errors in file /oracle/admin/orcl/bdump/orcl1_smon_213438.trc:
ORA-00316: log 3 of thread 2, type 0 in header is not log file
ORA-00312: online log 3 thread 2: '/dev/rorcl_redo03'
Fri Jun 13 00:50:43 2014
Errors in file /oracle/admin/orcl/bdump/orcl1_smon_213438.trc:
ORA-00316: log 3 of thread 2, type 0 in header is not log file
ORA-00312: online log 3 thread 2: '/dev/rorcl_redo03'
SMON: terminating instance due to error 316
Fri Jun 13 00:50:43 2014
Errors in file /oracle/admin/orcl/bdump/orcl1_lgwr_335980.trc:
ORA-00316: log  of thread , type  in header is not log file
Instance terminated by SMON, pid = 213438

从这里可以看出来,在使用OEM创建表空间的过程中犯了两个错误
1. 未分清楚aix的块设备和字符设备的命名方式
2. 对于2节点正在使用的current redo作为不适用设备当作未使用设备来创建新表空间
由于创建表空间的使用了错误的文件和错误的设备,导致2节点的当前redo(/dev/rorcl_redo03)被损坏(因为先读redo header,所以数据库中优先反馈出来的是ORA-00316: log of thread , type in header is not log file).从而导致数据库2节点先crash,然后节点1进行实例恢复,但是由于2节点的current redo已经损坏,导致实例恢复无法完成,从而两个节点都crash.因为是rac的一个节点的当前redo损坏,数据库无法正常.
如果有备份该数据库可以使用备份还原进行恢复,如果没有备份只能使用强制拉库的方法抢救数据.希望不要发生一个大的数据丢失悲剧
介绍这个案例希望给大家以警示:对数据库的裸设备操作请谨慎,不清楚切不可乱操作,否则后果严重

ORACLE_HOME不一致导致实例无法通过本地认证登录

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:ORACLE_HOME不一致导致实例无法通过本地认证登录

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

遇到网友咨询,类似故障重现:Liunx平台ORACLE数据库运行正常,ORACLE_SID正确,但是本地登录提示idle instance,tns方式可以正常登录现象

[oracle@xifenfei ~]$ ps -ef|grep pmon
oracle   26295     1  0 04:11 ?        00:00:01 ora_pmon_XFF
oracle   27997 27966  0 05:48 pts/0    00:00:00 grep pmon
[oracle@xifenfei ~]$ env|grep ORA
ORACLE_SID=XFF
ORACLE_BASE=/u01/oracle
ORACLE_HOME=/u01/oracle/oracle/product/10.2.0/db_1
[oracle@xifenfei ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Apr 20 05:48:30 2013
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
Connected to an idle instance.
SQL>
[oracle@xifenfei ~]$ sqlplus sys/xifenfei@XFF as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Apr 20 05:54:49 2013
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

对于这样的现象,通过试验重现,并且通过oradebug ipc进行说明。
补充知识点:oracle本地认证是通过ipc进行的,而ipc是直接访问共享内存段的

系统当前状态
系统未启动然后数据库情况

[oracle@xifenfei ~]$ ipcs -m
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
[oracle@xifenfei ~]$ ps -ef|grep pmon|grep -v grep
[oracle@xifenfei ~]$

启动数据库
确定环境变量ORACLE_SID,ORACLE_HOME

[oracle@xifenfei ~]$ env|grep ORA
ORACLE_SID=XFF
ORACLE_BASE=/u01/oracle
ORACLE_HOME=/u01/oracle/oracle/product/10.2.0/db_1
[oracle@xifenfei ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Apr 20 04:10:22 2013
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area  260046848 bytes
Fixed Size                  1266896 bytes
Variable Size              83888944 bytes
Database Buffers          167772160 bytes
Redo Buffers                7118848 bytes
Database mounted.
Database opened.
--做debug ipc
SQL> oradebug setmypid
Statement processed.
SQL> oradebug ipc
Information written to trace file.
SQL> oradebug tracefile_name
/u01/oracle/admin/XFF/udump/xff_ora_26852.trc
*** SESSION ID:(152.25) 2013-04-20 04:43:00.983
Dump of unix-generic skgm context
areaflags            000000e7
realmflags           0000000f
mapsize              00000800
protectsize          00001000
lcmsize              00001000
seglen               00200000
largestsize  00000000ffffffff
smallestsize 0000000000400000
stacklimit         0xbdb87e6c
stackdir                   -1
mode                      640
magic                acc01ade
Handle:             0xe781de0 `/u01/oracle/oracle/product/10.2.0/db_1XFF' --->注意($ORACLE_HOME$ORACLE_SID)
Dump of unix-generic realm handle `/u01/oracle/oracle/product/10.2.0/db_1XFF', flags = 00000000
 Area #0 `Fixed Size' containing Subareas 0-0
  Total size 00000000001354d0 Minimum Subarea size 00000000
   Area  Subarea    Shmid      Stable Addr      Actual Addr   --->主要Shmid
      0        0  3080192 0x00000020000000 0x00000020000000
                              Subarea size     Segment size
                          0000000000136000 000000000fa00000
 Area #1 `Variable Size' containing Subareas 2-2
  Total size 000000000f000000 Minimum Subarea size 00400000
   Area  Subarea    Shmid      Stable Addr      Actual Addr
      1        2  3080192 0x00000020800000 0x00000020800000
                              Subarea size     Segment size
                          000000000f000000 000000000fa00000
 Area #2 `Redo Buffers' containing Subareas 1-1
  Total size 00000000006ca000 Minimum Subarea size 00000000
   Area  Subarea    Shmid      Stable Addr      Actual Addr
   Area  Subarea    Shmid      Stable Addr      Actual Addr
[oracle@xifenfei ~]$ ipcs -m
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x6fd58208 3080192    oracle    640        262144000  17

这里证明ipc的处理是通过$ORACLE_HOME$ORACLE_SID进行的,修改ORACLE_HOME,进一步验证

修改ORACLE_HOME

[oracle@xifenfei ~]$ export ORACLE_HOME=/u01/oracle/oracle/product/10.2.0/db_1/
[oracle@xifenfei ~]$ env|grep ORA
ORACLE_SID=XFF
ORACLE_BASE=/u01/oracle
ORACLE_HOME=/u01/oracle/oracle/product/10.2.0/db_1/
[oracle@xifenfei ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Apr 20 04:11:46 2013
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area  260046848 bytes
Fixed Size                  1266896 bytes
Variable Size              83888944 bytes
Database Buffers          167772160 bytes
Redo Buffers                7118848 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode
[oracle@xifenfei ~]$ ipcs -m
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x6fd58208 3080192    oracle    640        262144000  18
0x079d1b38 3112964    oracle    640        262144000  13
--启动两个同样的sid实例
[oracle@xifenfei ~]$ ps -ef|grep pmon|grep -v grep
oracle   26211     1  0 04:10 ?        00:00:00 ora_pmon_XFF
oracle   26295     1  0 04:11 ?        00:00:00 ora_pmon_XFF
SQL> oradebug setmypid
Statement processed.
SQL> oradebug ipc
Information written to trace file.
SQL> oradebug tracefile_name
/u01/oracle/admin/XFF/udump/xff_ora_27708.trc
*** SESSION ID:(159.5) 2013-04-20 05:32:00.969
Dump of unix-generic skgm context
areaflags            000000e7
realmflags           0000000f
mapsize              00000800
protectsize          00001000
lcmsize              00001000
seglen               00200000
largestsize  00000000ffffffff
smallestsize 0000000000400000
stacklimit         0xbdb5979c
stackdir                   -1
mode                      640
magic                acc01ade
Handle:             0xd99ede0 `/u01/oracle/oracle/product/10.2.0/db_1/XFF'--->注意
Dump of unix-generic realm handle `/u01/oracle/oracle/product/10.2.0/db_1/XFF', flags = 00000000

进一步证明在linux/unix系统,oracle数据库的内存段是通过ORACLE_HOME和ORACLE_SID结合起来识别的,只要ORACLE_HOME或者ORACLE_SID不一样就不能通过IPC访问实例的内存段,也就不能登录数据库

通过bbed替换bootstarp$表

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:通过bbed替换bootstarp$表

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

在11G和12C中,我们可以通过DBMS_DDL_INTERNAL.SWAP_BOOTSTRAP过程来替换bootstarp$表(见:替换bootstarp$表),但是对于10G或者其他版本,oracle没有提供相关程序来完成使用其他表替换bootstarp$,通过分析,使用bbed修改root rdba也可以完成DBMS_DDL_INTERNAL.SWAP_BOOTSTRAP的任务

SQL> SELECT * FROM V$VERSION;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
SQL> DESC DBMS_DDL_INTERNAL
PROCEDURE CHECK_TRIGGER_FIRING_PROPERTY
参数名称                       类型                    输入/输出默认值?
------------------------------ ----------------------- ------ --------
 TRIG_OWNER                     VARCHAR2                IN
 TRIG_NAME                      VARCHAR2                IN
 CANON_OWNER                    VARCHAR2                OUT
 CANON_ONAME                    VARCHAR2                OUT
 P_PROPERTY                     NUMBER                  IN/OUT
 UNSUPPORTED_TRIG               BOOLEAN                 OUT
FUNCTION HAS_ALTER_ANY_TRIGGER_PRIV RETURNS BOOLEAN
参数名称                       类型                    输入/输出默认值?
------------------------------ ----------------------- ------ --------
 P_USER                         VARCHAR2                IN
 P_TRIG_PROPERTY                NUMBER                  IN
FUNCTION HAS_EXP_IMP_PRIV RETURNS BOOLEAN
参数名称                       类型                    输入/输出默认值?
------------------------------ ----------------------- ------ --------
 P_UID                          NUMBER                  IN
 P_PRIVS_TO_CHECK               VARCHAR2                IN
FUNCTION IS_DDL_TRIGGER RETURNS BOOLEAN
参数名称                       类型                    输入/输出默认值?
------------------------------ ----------------------- ------ --------
 SYS_EVTS                       NUMBER                  IN

跟踪数据库启动过程

SQL> startup mount
ORACLE 例程已经启动。
Total System Global Area  209715200 bytes
Fixed Size                  1289724 bytes
Variable Size             100663812 bytes
Database Buffers          100663296 bytes
Redo Buffers                7098368 bytes
数据库装载完毕。
SQL> oradebug setmypid
已处理的语句
SQL> oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12
已处理的语句
SQL> alter session set db_file_multiblocK_read_count=1;
会话已更改。
SQL> oradebug TRACEFILE_NAME
e:\oracle\product\10.2.0\admin\ora10g\udump\ora10g_ora_8360.trc
SQL> alter database Open;
数据库已更改。
SQL> oradebug EVENT 10046 trace name context off
已处理的语句

阅读10046 trace文件

WAIT #1: nam='instance state change' ela= 28 layer=2 value=1 waited=1 obj#=-1 tim=377999209439
WAIT #1: nam='db file sequential read' ela= 94860 file#=1 block#=377 blocks=1 obj#=-1 tim=377999304467
=====================
PARSING IN CURSOR #2 len=188 dep=1 uid=0 oct=1 lid=0 tim=377999305344 hv=1365064427 ad='8baee680'
create table bootstrap$ ( line#         number not null,   obj#           number not null,   sql_text   varchar2(4000) not null)   storage (initial 50K objno 56 extents (file 1 block 377))
END OF STMT
PARSE #2:c=0,e=662,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=377999305341
BINDS #2:
EXEC #2:c=0,e=102,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=377999305545
=====================
PARSING IN CURSOR #2 len=55 dep=1 uid=0 oct=3 lid=0 tim=377999305925 hv=2111436465 ad='8baedf0c'
select line#, sql_text from bootstrap$ where obj# != :1
END OF STMT
PARSE #2:c=0,e=308,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=377999305922
BINDS #2:
kkscoacd
 Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=00288360  bln=22  avl=02  flg=05
  value=56
EXEC #2:c=0,e=580,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=377999306621
WAIT #2: nam='db file sequential read' ela= 328 file#=1 block#=377 blocks=1 obj#=-1 tim=377999307005
WAIT #2: nam='db file sequential read' ela= 345 file#=1 block#=378 blocks=1 obj#=-1 tim=377999307423

这里可以发现,数据库是在启动的时候读file 1 block 377,然后create table bootstrap$(注意:这里的语句小写),对于bootstarp$的查询除掉了obj#<>56

分析bootstarp$对象

SQL> select header_file,header_block from dba_segments where segment_name='BOOTSTRAP$';
HEADER_FILE HEADER_BLOCK
----------- ------------
          1          377
SQL> SELECT OBJECT_ID FROM DBA_OBJECTS WHERE OBJECT_NAME='BOOTSTRAP$';
 OBJECT_ID
----------
        56
SQL> select line#, sql_text from bootstrap$ where obj# =56;
     LINE#
----------
SQL_TEXT
--------------------------------------------------------------------------------
        56
CREATE TABLE BOOTSTRAP$("LINE#" NUMBER NOT NULL,"OBJ#" NUMBER NOT NULL,"SQL_TEXT
" VARCHAR2(4000) NOT NULL) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE
 (  INITIAL 56K NEXT 1024K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 OBJN
O 56 EXTENTS (FILE 1 BLOCK 377))

这里可以发现bootstrap$中obj#=56的那条记录为CREATE TABLE BOOTSTRAP$(注意:该表里面保存为大写)

bbed查看root rdba

C:\Windows\system32>e:\oracle\product\10.2.0\dbhome_1\bin\bbed password=blockedit blocksize=8192
BBED: Release 2.0.0.0.0 - Limited Production on Tue Dec 17 18:36:01 2013
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set block 1
BBED-00310: no datafile specified
BBED> set filename 'E:\APP\XIFENFEI\ORADATA\ORA10G\SYSTEM01.DBF'
        FILENAME        E:\APP\XIFENFEI\ORADATA\ORA10G\SYSTEM01.DBF
BBED> set block 2
        BLOCK#          2
BBED> map
 File: E:\APP\XIFENFEI\ORADATA\ORA10G\SYSTEM01.DBF (0)
 Block: 2                                     Dba:0x00000000
------------------------------------------------------------
 Data File Header
 struct kcvfh, 360 bytes                    @0
 ub4 tailchk                                @8188
BBED> p kcvfhrdb
ub4 kcvfhrdb                                @96       0x00400179
SQL> Select to_number('00400179','xxxxxxxxxxxxxxxxxx') from dual;
TO_NUMBER('00400179','XXXXXXXXXXXXXXXXXX')
------------------------------------------
                                   4194681
SQL> select dbms_utility.data_block_address_block(4194681) "block",
  2  dbms_utility.data_block_address_file(4194681) "file" from dual;
     block       file
---------- ----------
       377          1

通过bbed查看kcvfhrdb(root rdba)指向的地址和数据库启动扫描block一致(file 1b block 377)

创建bootstarp$替换表(xifenfei)

SQL> create table xifenfei as select * from bootstrap$;
表已创建。
SQL> select count(*) from bootstrap$;
  COUNT(*)
----------
        57
SQL> select count(*) from xifenfei;
  COUNT(*)
----------
        57
SQL> SELECT OBJECT_ID FROM DBA_OBJECTS WHERE OBJECT_NAME='XIFENFEI';
 OBJECT_ID
----------
     51736
SQL> select header_file,header_block from dba_segments where segment_name='XIFENFEI';
HEADER_FILE HEADER_BLOCK
----------- ------------
          1        60241
SQL> SELECT TO_CHAR(60241,'XXXX') FROM DUAL;
TO_CH
-----
 EB51
--对应rdba为0040EB51

这里可以确定创建的xifenfei的segment header rdba为0x0040EB51,obj#为51736

清理bootstarp$中对象

SQL> DELETE FROM BOOTSTRAP$;
已删除57行。
SQL> COMMIT;
提交完成。
SQL> SHUTDOWN IMMEDIATE;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> STARTUP MOUNT
ORACLE 例程已经启动。
Total System Global Area  209715200 bytes
Fixed Size                  1289724 bytes
Variable Size             104858116 bytes
Database Buffers           96468992 bytes
Redo Buffers                7098368 bytes
数据库装载完毕。
SQL> oradebug setmypid
已处理的语句
SQL> oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12
已处理的语句
SQL> alter session set db_file_multiblocK_read_count=1;
会话已更改。
SQL> oradebug TRACEFILE_NAME
e:\oracle\product\10.2.0\admin\ora10g\udump\ora10g_ora_7704.trc
SQL>
SQL> alter database Open;
alter database Open
*
第 1 行出现错误:
ORA-01092: ORACLE 实例终止。强制断开连接
--trace文件
PARSING IN CURSOR #2 len=55 dep=1 uid=0 oct=3 lid=0 tim=379061819061 hv=2111436465 ad='8baedf18'
select line#, sql_text from bootstrap$ where obj# != :1
END OF STMT
PARSE #2:c=0,e=346,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=379061819058
BINDS #2:
kkscoacd
 Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=00288360  bln=22  avl=02  flg=05
  value=56
EXEC #2:c=0,e=681,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=379061819868
WAIT #2: nam='db file sequential read' ela= 343 file#=1 block#=377 blocks=1 obj#=-1 tim=379061820273
WAIT #2: nam='db file sequential read' ela= 291 file#=1 block#=378 blocks=1 obj#=-1 tim=379061820651
WAIT #2: nam='db file sequential read' ela= 309 file#=1 block#=379 blocks=1 obj#=-1 tim=379061821012
WAIT #2: nam='db file sequential read' ela= 293 file#=1 block#=380 blocks=1 obj#=-1 tim=379061821416
FETCH #2:c=0,e=1542,p=4,cr=5,cu=0,mis=0,r=0,dep=1,og=4,tim=379061821450
ORA-00704: 引导程序进程失败
ORA-00702: 引导程序版本 '' 与版本 '8.0.0.0.0' 不一致
*** 2013-12-17 18:50:07.325
EXEC #1:c=62400,e=4990345,p=10,cr=6,cu=0,mis=0,r=0,dep=0,og=1,tim=379065822300
ERROR #1:err=1092 tim=37915057

删除掉bootstarp中记录后,数据库无法正常启动,报错误为ORA-00704/ORA-00702,因为数据库读取bootstarp$中记录出错导致.

bbed修改root rdba

BBED> set mode edit
        MODE            Edit
BBED> set count 32
        COUNT           32
BBED> d
 File: E:\APP\XIFENFEI\ORADATA\ORA10G\SYSTEM01.DBF (0)
 Block: 2                Offsets:   96 to  127           Dba:0x00000000
------------------------------------------------------------------------
 79014000 0b000000 00000000 d10ff624 485dbc31 4bf60700 00000000 00000000
 <32 bytes per line>
BBED> m /x 51eb
 File: E:\APP\XIFENFEI\ORADATA\ORA10G\SYSTEM01.DBF (0)
 Block: 2                Offsets:   96 to  127           Dba:0x00000000
------------------------------------------------------------------------
 51eb4000 0b000000 00000000 d10ff624 485dbc31 4bf60700 00000000 00000000
 <32 bytes per line>
BBED> sum apply
Check value for File 0, Block 2:
current = 0xa3bd, required = 0xa3bd
BBED> p kcvfhrdb
ub4 kcvfhrdb                                @96       0x0040eb51

修改root rdba地址为xifenfei segment header的地址

尝试启动数据库

SQL> startup mount;
ORACLE 例程已经启动。
Total System Global Area  209715200 bytes
Fixed Size                  1289724 bytes
Variable Size             113246724 bytes
Database Buffers           88080384 bytes
Redo Buffers                7098368 bytes
数据库装载完毕。
SQL> oradebug setmypid
已处理的语句
SQL> oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12
已处理的语句
SQL> alter session set db_file_multiblocK_read_count=1;
会话已更改。
SQL> oradebug TRACEFILE_NAME
e:\oracle\product\10.2.0\admin\ora10g\udump\ora10g_ora_7356.trc
SQL> alter database Open;
alter database Open
*
第 1 行出现错误:
ORA-01092: ORACLE 实例终止。强制断开连接
--trace文件
WAIT #1: nam='db file sequential read' ela= 26895 file#=1 block#=60241 blocks=1 obj#=-1 tim=380397162424
=====================
PARSING IN CURSOR #2 len=193 dep=1 uid=0 oct=1 lid=0 tim=380397162916 hv=1250491271 ad='8baee6a0'
create table bootstrap$ ( line#         number not null,   obj#           number not null,   sql_text   varchar2(4000) not null)   storage (initial 50K objno 51736 extents (file 1 block 60241))
END OF STMT
PARSE #2:c=0,e=372,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=380397162912
BINDS #2:
EXEC #2:c=0,e=80,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=380397163083
=====================
PARSING IN CURSOR #2 len=55 dep=1 uid=0 oct=3 lid=0 tim=380397163449 hv=2111436465 ad='8baedf2c'
select line#, sql_text from bootstrap$ where obj# != :1
END OF STMT
PARSE #2:c=0,e=311,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=380397163447
BINDS #2:
kkscoacd
 Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=00288360  bln=22  avl=04  flg=05
  value=51736
EXEC #2:c=0,e=515,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=380397164052
WAIT #2: nam='db file sequential read' ela= 314 file#=1 block#=60241 blocks=1 obj#=-1 tim=380397164415
WAIT #2: nam='db file sequential read' ela= 396 file#=1 block#=60242 blocks=1 obj#=-1 tim=380397164902
…………
PARSING IN CURSOR #2 len=272 dep=1 uid=0 oct=1 lid=0 tim=380397203298 hv=2124945659 ad='8bacb620'
CREATE TABLE BOOTSTRAP$("LINE#" NUMBER NOT NULL,"OBJ#" NUMBER NOT NULL,"SQL_TEXT" VARCHAR2(4000) NOT NULL) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE (  INITIAL 56K NEXT 1024K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 OBJNO 56 EXTENTS (FILE 1 BLOCK 377))
END OF STMT
PARSE #2:c=0,e=239,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=380397203295
BINDS #2:
EXEC #2:c=0,e=324,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=380397203701
ERROR #2:err=955 tim=38048197
ORA-00704: 引导程序进程失败
ORA-00604: 递归 SQL 级别 1 出现错误
ORA-00955: 名称已由现有对象使用
*** 2013-12-17 19:12:21.783
EXEC #1:c=93601,e=4199938,p=10,cr=60,cu=0,mis=0,r=0,dep=0,og=1,tim=380400250570
ERROR #1:err=1092 tim=38048501

数据库启动到创建bootstarp$的时候报错,报错的原因是因为xifenfei对象中的obj#=56的为CREATE TABLE BOOTSTRAP$,而前面的查询bootstarp$是过滤掉了obj#=56(为过滤掉xifenfei对象本身的obj#[51736])

upgrade模式启动数据库

SQL> conn / as sysdba
已连接到空闲例程。
SQL> startup mount
ORACLE 例程已经启动。
Total System Global Area  209715200 bytes
Fixed Size                  1289724 bytes
Variable Size             117441028 bytes
Database Buffers           83886080 bytes
Redo Buffers                7098368 bytes
数据库装载完毕。
SQL> alter database Open upgrade;
数据库已更改。

虽然启动的时候在报CREATE TABLE BOOTSTRAP$(注意大写,而不是启动第一条的create table bootstrap$),但是upgrade模式可以正常启动数据库

修改xifenfei中关于CREATE TABLE BOOTSTRAP$语句对应的obj#为xifenfei object_id

SQL> UPDATE XIFENFEI SET OBJ#=51736 WHERE OBJ#=56;
已更新 1 行。
SQL> commit;
提交完成。
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup mount
ORACLE 例程已经启动。
Total System Global Area  209715200 bytes
Fixed Size                  1289724 bytes
Variable Size             121635332 bytes
Database Buffers           79691776 bytes
Redo Buffers                7098368 bytes
数据库装载完毕。
SQL> alter database open;
数据库已更改。

至此通过bbed结合修改CREATE TABLE BOOTSTRAP$语句对应的obj#完成数据库启动读取非bootstarp$表的过程

继续分析xifenfei和bootstarp$关系

SQL> select count(*) from bootstrap$;
  COUNT(*)
----------
        57
SQL> select count(*) from xifenfei;
  COUNT(*)
----------
        57
SQL> select obj# from bootstrap$ where line#=56;
      OBJ#
----------
     51736
SQL> select obj# from xifenfei where line#=56;
      OBJ#
----------
     51736
SQL> select header_file,header_block from dba_segments where segment_name='BOOTSTRAP$';
HEADER_FILE HEADER_BLOCK
----------- ------------
          1          377
SQL> SELECT OBJECT_ID FROM DBA_OBJECTS WHERE OBJECT_NAME='BOOTSTRAP$';
 OBJECT_ID
----------
        56
SQL> truncate table xifenfei;
truncate table xifenfei
               *
第 1 行出现错误:
ORA-00701: 无法改变热启动数据库所需的对象

数据库启动过程中,会读xifenfei(root rdba指向表),然后加载bootstarp$表,而且bootstarp$表中记录和xifenfei表中记录完全相同.

替换bootstarp$表

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:替换bootstarp$表

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

对数据库有一定了解的人都知道,数据库启动是通过bootstarp$表来实现启动引导的。那这里有两个疑问:
1.引导表bootstarp$名字是否是唯一?
2.引导表的位置是不是在数据文件固定?比如11g/12c在file 1 block 520,10g在file 1 block 377?

跟踪数据库启动

[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sun Dec 15 14:16:58 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Advanced Analytics
and Real Application Testing options
SQL> startup mount;
ORACLE instance started.
Total System Global Area  400846848 bytes
Fixed Size                  2288872 bytes
Variable Size             310379288 bytes
Database Buffers           79691776 bytes
Redo Buffers                8486912 bytes
Database mounted.
SQL> oradebug setmypid
Statement processed.
SQL> alter session set db_file_multiblocK_read_count=1;
Statement processed.
SQL> oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12
Session altered.
SQL> oradebug TRACEFILE_NAME
/u01/app/oracle/diag/rdbms/test/TEST/trace/TEST_ora_31364.trc
SQL> alter database Open;
Database altered.
SQL> oradebug EVENT 10046 trace name context off
Statement processed.
SQL> select HEADER_FILE,HEADER_BLOCK from dba_segments where segment_name='BOOTSTRAP$';
HEADER_FILE HEADER_BLOCK
----------- ------------
          1          520
SQL> select object_id from dba_objects where object_name='BOOTSTRAP$';
 OBJECT_ID
----------
        59

分析trace文件

WAIT #140077386411120: nam='db file sequential read' ela= 56 file#=1 block#=520 blocks=1 obj#=-1 tim=1719385755334
=====================
PARSING IN CURSOR #140077386402760 len=188 dep=1 uid=0 oct=1 lid=0 tim=1719385757322 hv=4006182593 ad='6645d370' sqlid='32r4f1brckzq1'
create table bootstrap$ (
END OF STMT
PARSE #140077386402760:c=2000,e=1711,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=0,tim=1719385757319
EXEC #140077386402760:c=0,e=430,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=0,tim=1719385757909
CLOSE #140077386402760:c=0,e=9,dep=1,type=0,tim=1719385758105
=====================
PARSING IN CURSOR #140077386402760 len=55 dep=1 uid=0 oct=3 lid=0 tim=1719385759507 hv=2111436465 ad='6645bc80' sqlid='6apq2rjyxmxpj'
select line#, sql_text from bootstrap$ where obj# != :1
END OF STMT
PARSE #140077386402760:c=1000,e=1365,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=0,tim=1719385759505
BINDS #140077386402760:
 Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=1000001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=7f664edb8780  bln=22  avl=02  flg=05
  value=59
EXEC #140077386402760:c=3000,e=8859,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=867914364,tim=1719385768574
WAIT #140077386402760: nam='db file sequential read' ela= 27 file#=1 block#=520 blocks=1 obj#=59 tim=1719385768753
WAIT #140077386402760: nam='db file sequential read' ela= 23 file#=1 block#=521 blocks=1 obj#=59 tim=1719385769575

这里我们可以发现,数据库启动的时候是读file 1 block 520,object_id为59,为bootstarp$对象

bbed查看root rdba地址

ub4 kcvfhrdb                             @96       0x00400208
SQL> select to_number('208','xxx') from dual;
TO_NUMBER('208','XXX')
----------------------
                   520

这里可以看出来,数据库启动的file header rdba地址和trace文件中的一致,也是指定到bootstarp$;

替换bootstrap$表为xifenfei

SQL> create table xifenfei as select * from bootstrap$;
Table created.
SQL> desc xifenfei
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 LINE#                                     NOT NULL NUMBER
 OBJ#                                      NOT NULL NUMBER
 SQL_TEXT                                  NOT NULL VARCHAR2(4000)
SQL> select sql_text from xifenfei where line#=59;
SQL_TEXT
--------------------------------------------------------------------------------
CREATE TABLE BOOTSTRAP$("LINE#" NUMBER NOT NULL,"OBJ#" NUMBER NOT NULL,"SQL_TEXT
" VARCHAR2(4000) NOT NULL) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE
 (  INITIAL 56K NEXT 1024K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 OBJN
O 59 EXTENTS (FILE 1 BLOCK 520))
--清除bootstarp$记录
SQL> delete from xifenfei where line#=59;
1 row deleted.
SQL> commit;
Commit complete.
SQL> select objECT_ID from dba_objects where object_name='XIFENFEI';
 OBJECT_ID
----------
     20314
SQL> select HEADER_FILE,HEADER_BLOCK from dba_segments where segment_name='XIFENFEI';
HEADER_FILE HEADER_BLOCK
----------- ------------
          1        45712
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup upgrade;
ORACLE instance started.
Total System Global Area  400846848 bytes
Fixed Size                  2288872 bytes
Variable Size             310379288 bytes
Database Buffers           79691776 bytes
Redo Buffers                8486912 bytes
Database mounted.
Database opened.
--删除bootstarp$表
SQL>  drop table bootstrap$;
Table dropped.
SQL>  exec DBMS_DDL_INTERNAL.SWAP_BOOTSTRAP('XIFENFEI');
PL/SQL procedure successfully completed.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> EXIT
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Advanced Analytics
and Real Application Testing options
[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sun Dec 15 14:29:54 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> STARTUP MOUNT
ORACLE instance started.
Total System Global Area  400846848 bytes
Fixed Size                  2288872 bytes
Variable Size             310379288 bytes
Database Buffers           79691776 bytes
Redo Buffers                8486912 bytes
Database mounted.
SQL> oradebug setmypid
Statement processed.
SQL> oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12
Statement processed.
SQL> alter session set db_file_multiblocK_read_count=1;
Session altered.
SQL> oradebug TRACEFILE_NAME
/u01/app/oracle/diag/rdbms/test/TEST/trace/TEST_ora_32727.trc
SQL> alter database Open;
Database altered.
SQL> SELECT OBJECT_ID FROM DBA_OBJECTS WHERE OBJECT_NAME='BOOTSTRAP$';
no rows selected
SQL> SELECT OBJECT_ID FROM DBA_OBJECTS WHERE OBJECT_NAME='XIFENFEI';
 OBJECT_ID
----------
     20314

分析trace文件

WAIT #139841534602352: nam='db file sequential read' ela= 23 file#=1 block#=45712 blocks=1 obj#=-1 tim=1720082484775
=====================
PARSING IN CURSOR #139841534593992 len=193 dep=1 uid=0 oct=1 lid=0 tim=1720082488552 hv=2096904950 ad='6645d650' sqlid='bs6v55xygsfrq'
create table bootstrap$ (
END OF STMT
PARSE #139841534593992:c=2000,e=2925,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=0,tim=1720082488550
EXEC #139841534593992:c=0,e=466,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=0,tim=1720082489124
CLOSE #139841534593992:c=0,e=8,dep=1,type=0,tim=1720082489266
=====================
PARSING IN CURSOR #139841534593992 len=55 dep=1 uid=0 oct=3 lid=0 tim=1720082490510 hv=2111436465 ad='6645c050' sqlid='6apq2rjyxmxpj'
select line#, sql_text from bootstrap$ where obj# != :1
END OF STMT
PARSE #139841534593992:c=1999,e=1211,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=0,tim=1720082490509
BINDS #139841534593992:
 Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=1000001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=7f2f64fe8780  bln=22  avl=04  flg=05
  value=20314
EXEC #139841534593992:c=1000,e=1789,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=867914364,tim=1720082492533
WAIT #139841534593992: nam='db file sequential read' ela= 20 file#=1 block#=45712 blocks=1 obj#=20314 tim=1720082492685
WAIT #139841534593992: nam='db file sequential read' ela= 25 file#=1 block#=45713 blocks=1 obj#=20314 tim=1720082492986

这里可以看出来,数据库在启动的时候是读取file 1 block 45712,object_id为20314

bbed查看root rdba地址

ub4 kcvfhrdb                             @96       0x0040b290
SQL> select to_number('b290','xxxxxxx') from dual;
TO_NUMBER('B290','XXXXXXX')
---------------------------
                      45712

证明现在的文件头里面的file header rdba 已经修改为file 1 block 45712和trace里面看到的一致,都是XIFENFEI这个表

测试结论
1. 通过使用SWAP_BOOTSTRAP可以置换掉数据库启动开始表bootstrap$变为另外一个表,而且该过程直接修改文件头的kcvfhrdb值
2. 通过试验证明,oracle启动的时候不是程序里面写死的去读file 1的某个block,而是通过读取kcvfhrdb然后启动数据库