程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> SyBase數據庫 >> SyBase教程 >> 使用bbed將屬於前一個incarnation的offline的datafile弄成online狀態

使用bbed將屬於前一個incarnation的offline的datafile弄成online狀態

編輯:SyBase教程

使用bbed將屬於前一個incarnation的offline的datafile弄成online狀態


使用bbed將屬於前一個incarnation 的 offline的 datafile弄成online狀態:

背景:
'/u01/app/oracle/oradata/test/ten01.dbf' 是屬於前一個incarnation 的 offline的 datafile。操作系統為RHEL6.3 x86-64bit

首先:

找到system01.dbf,確認其resetlogs 相關信息:
kcvfhrlc表示 reset logs count
kcvfhrls表示 resetlogs scn

===============================下面是system01.dbf的信息=======================================

BBED>  set filename '/u01/app/oracle/oradata/test/system01.dbf'
        FILENAME        /u01/app/oracle/oradata/test/system01.dbf

BBED> p kcvfhrlc
ub4 kcvfhrlc                                @112      0x344ba60f ---->

BBED> p kcvfhrls
struct kcvfhrls, 8 bytes                    @116     
   ub4 kscnbas                              @116      0x0036a289 ---->
   ub2 kscnwrp                              @120      0x0000

BBED> p kcvcpscn
BBED-00207: invalid offset specifier (kcvcpscn)


BBED> p kscnbas 
BBED-00207: invalid offset specifier (kscnbas)


BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484     
   struct kcvcpscn, 8 bytes                 @484     
      ub4 kscnbas                           @484      0x0036bbd9
      ub2 kscnwrp                           @488      0x0000
   ub4 kcvcptim                             @492      0x344c30df
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500     
      struct kcvcprba, 12 bytes             @500     
         ub4 kcrbaseq                       @500      0x00000001
         ub4 kcrbabno                       @504      0x00002dbe
         ub2 kcrbabof                       @508      0x0010
   ub1 kcvcpetb[0]                          @512      0x02
   ub1 kcvcpetb[1]                          @513      0x00
   ub1 kcvcpetb[2]                          @514      0x00
   ub1 kcvcpetb[3]                          @515      0x00
   ub1 kcvcpetb[4]                          @516      0x00
   ub1 kcvcpetb[5]                          @517      0x00
   ub1 kcvcpetb[6]                          @518      0x00
   ub1 kcvcpetb[7]                          @519      0x00

BBED> p kcvfhcpc
ub4 kcvfhcpc                                @140      0x0000016a ---->

BBED> p kcvfhccc
ub4 kcvfhccc                                @148      0x00000169 ---->

 

=================================下面是ten01.dbf的信息========================================

 

BBED> set filename '/u01/app/oracle/oradata/test/ten01.dbf'
        FILENAME        /u01/app/oracle/oradata/test/ten01.dbf

------------------------如下是改kcvfhrlc------------------------------
BBED> p kcvfhrlc
ub4 kcvfhrlc                                @112      0x30274f37

BBED> m /x 0fa64b34
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) Y
 File: /u01/app/oracle/oradata/test/ten01.dbf (5)
 Block: 1                Offsets:  112 to  623           Dba:0x01400001
------------------------------------------------------------------------
 0fa64b34 dc300f00 00000000 00000000 00000000 00000000 00000400 68010000 
 91a24b34 c8b53600 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 06000000 
 06005445 4e544253 00000000 00000000 00000000 00000000 00000000 00000000 
 05000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 5c776c2d 01000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 c8b53600 00000000 5dc94b34 
 01000000 98000000 2cb60000 10000000 02000000 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>


 

 

--------------------------------------------------------如下是改kcvfhrls--------------------------------------------------

BBED> p kcvfhrls
struct kcvfhrls, 8 bytes                    @116     
   ub4 kscnbas                              @116      0x000f30dc
   ub2 kscnwrp                              @120      0x0000

BBED> m /x 89a23600
BBED-00209: invalid number (89a23600)


BBED> m /x 89a2
 File: /u01/app/oracle/oradata/test/ten01.dbf (5)
 Block: 1                Offsets:  116 to  627           Dba:0x01400001
------------------------------------------------------------------------
 89a20f00 00000000 00000000 00000000 00000000 00000400 68010000 91a24b34 
 c8b53600 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 06000000 06005445 
 4e544253 00000000 00000000 00000000 00000000 00000000 00000000 05000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 5c776c2d 01000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 c8b53600 00000000 5dc94b34 01000000 
 98000000 2cb60000 10000000 02000000 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 offset +2
        OFFSET          118

BBED> m /x 3600
 File: /u01/app/oracle/oradata/test/ten01.dbf (5)
 Block: 1                Offsets:  118 to  629           Dba:0x01400001
------------------------------------------------------------------------
 36000000 00000000 00000000 00000000 00000000 04006801 000091a2 4b34c8b5 
 36000000 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 00000600 00000600 54454e54 
 42530000 00000000 00000000 00000000 00000000 00000000 00000500 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00005c77 6c2d0100 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 0000c8b5 36000000 00005dc9 4b340100 00009800 
 00002cb6 00001000 00000200 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 kcvfhrls
struct kcvfhrls, 8 bytes                    @116     
   ub4 kscnbas                              @116      0x0036a289
   ub2 kscnwrp                              @120      0x0000

BBED> p kcvfhrlc
ub4 kcvfhrlc                                @112      0x344ba60f

BBED> sum 
Check value for File 5, Block 1:
current = 0x09c3, required = 0x76fb

BBED> sum apply
Check value for File 5, Block 1:
current = 0x76fb, required = 0x76fb

BBED> 

 


-----------------------------------------------------如下是改kcvfhcpc----------------------------------------------------------

BBED> p kcvfhcpc
ub4 kcvfhcpc                                @140      0x00000168

BBED> m /x 6a010000
 File: /u01/app/oracle/oradata/test/ten01.dbf (5)
 Block: 1                Offsets:  140 to  651           Dba:0x01400001
------------------------------------------------------------------------
 6a010000 91a24b34 c8b53600 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 
 06000000 06005445 4e544253 00000000 00000000 00000000 00000000 00000000 
 00000000 05000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 5c776c2d 01000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 c8b53600 00000000 
 5dc94b34 01000000 98000000 2cb60000 10000000 02000000 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 0d000d00 0d000100 

 <32 bytes per line>

 

-----------------------------------------------------如下是改kcvfhccc-----------------------------------------------------

BBED>  p kcvfhccc
ub4 kcvfhccc                                @148      0x0036b5c8

BBED> m /x 69010000
 File: /u01/app/oracle/oradata/test/ten01.dbf (5)
 Block: 1                Offsets:  148 to  659           Dba:0x01400001
------------------------------------------------------------------------
 69010000 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 06000000 06005445 
 4e544253 00000000 00000000 00000000 00000000 00000000 00000000 05000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 5c776c2d 01000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 c8b53600 00000000 5dc94b34 01000000 
 98000000 2cb60000 10000000 02000000 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 0d000d00 0d000100 00000000 00000000 

 <32 bytes per line>

BBED> sum
Check value for File 5, Block 1:
current = 0x76fb, required = 0xc26e

BBED> sum apply
Check value for File 5, Block 1:
current = 0xc26e, required = 0xc26e

BBED> 

 

-----------------------------------------------------------如下是改kscnbas----------------------------------------------

set offset 484

BBED> set offset 484
        OFFSET          484

BBED> m /x d9bb3600
BBED-00209: invalid number (d9bb3600)


BBED> m /x d9bb
 File: /u01/app/oracle/oradata/test/ten01.dbf (5)
 Block: 1                Offsets:  484 to  995           Dba:0x01400001
------------------------------------------------------------------------
 d9bb3600 00000000 5dc94b34 01000000 98000000 2cb60000 10000000 02000000 
 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 
 0d000d00 0d000100 00000000 00000000 00000000 02004001 00000000 00000000 
 b473877d 21e318f1 05000000 06000000 4cef0f00 00000000 dc300f00 00000000 
 374f2730 d63a0800 00000000 85ec1e30 e7ad0800 00000000 3d7e2730 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 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> set offset +2
        OFFSET          486

BBED> m /x 3600
 File: /u01/app/oracle/oradata/test/ten01.dbf (5)
 Block: 1                Offsets:  486 to  997           Dba:0x01400001
------------------------------------------------------------------------
 36000000 00005dc9 4b340100 00009800 00002cb6 00001000 00000200 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 00000d00 
 0d000d00 01000000 00000000 00000000 00000200 40010000 00000000 0000b473 
 877d21e3 18f10500 00000600 00004cef 0f000000 0000dc30 0f000000 0000374f 
 2730d63a 08000000 000085ec 1e30e7ad 08000000 00003d7e 27300000 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 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> sum 
Check value for File 5, Block 1:
current = 0xc26e, required = 0xcc7f

BBED> sum apply
Check value for File 5, Block 1:
current = 0xcc7f, required = 0xcc7f

 


SQL> select file#,to_char(checkpoint_change#,'999999999999'),to_char(RESETLOGS_CHANGE#,'999999999999') from v$datafile_header;

FILE# TO_CHAR(CHECK TO_CHAR(RESET
----- ------------- -------------
1 3587033 3580553
2 3587033 3580553
3 3587033 3580553
4 3587033 3580553
5 3585480 3580553-------->這是kscnbas改之前的。
6 3587033 3580553
7 3587033 3580553
8 3587033 3580553
9 3587033 3580553
10 3587033 3580553
11 3587033 3580553
12 3395372 995548

12 rows selected.

SQL> select file#,to_char(checkpoint_change#,'999999999999'),to_char(RESETLOGS_CHANGE#,'999999999999') from v$datafile_header;

FILE# TO_CHAR(CHECK TO_CHAR(RESET
----- ------------- -------------
    1       3587033       3580553
    2       3587033       3580553
    3       3587033       3580553
    4       3587033       3580553
    5       3587033       3580553
    6       3587033       3580553
    7       3587033       3580553
    8       3587033       3580553
    9       3587033       3580553
   10       3587033       3580553
   11       3587033       3580553
   12       3395372        995548

12 rows selected.

 

SQL> alter database open;

Database altered.

SQL> recover datafile 5;
Media recovery complete.
SQL> alter database datafile 5 online;

Database altered.

SQL> 



如下是:從alter database open; 之後的alert日志:

Sun Apr 19 05:09:46 2015
alter database open
Sun Apr 19 05:09:47 2015
LGWR: STARTING ARCH PROCESSES
Sun Apr 19 05:09:47 2015
ARC0 started with pid=20, OS id=3461
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Sun Apr 19 05:09:48 2015
ARC1 started with pid=21, OS id=3463
Sun Apr 19 05:09:48 2015
ARC2 started with pid=22, OS id=3465
Thread 1 opened at log sequence 1
  Current log# 1 seq# 1 mem# 0: /u01/app/oracle/oradata/test/redo01.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Sun Apr 19 05:09:48 2015
SMON: enabling cache recovery
Sun Apr 19 05:09:48 2015
ARC3 started with pid=23, OS id=3467
ARC1: Archival started
ARC2: Archival started
ARC2: Becoming the 'no FAL' ARCH
ARC2: Becoming the 'no SRL' ARCH
ARC1: Becoming the heartbeat ARCH
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
[3382] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:17282894 end:17283434 diff:540 (5 seconds)
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Database Characterset is ZHS16GBK
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Sun Apr 19 05:09:53 2015
QMNC started with pid=24, OS id=3470
Sun Apr 19 05:10:04 2015
Completed: alter database open
Sun Apr 19 05:10:04 2015
Starting background process CJQ0
Sun Apr 19 05:10:06 2015
CJQ0 started with pid=30, OS id=3494
ALTER DATABASE RECOVER  datafile 5
Media Recovery Start
Serial Media Recovery started
WARNING! Recovering data file 5 from a fuzzy backup. It might be an online
backup taken without entering the begin backup command.
Media Recovery Complete (test)
Completed: ALTER DATABASE RECOVER  datafile 5
Sun Apr 19 05:10:17 2015
alter database datafile 5 online
Completed: alter database datafile 5 online


 

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved