[20180413]熱備模式相關問題2.txt

来源:https://www.cnblogs.com/lfree/archive/2018/04/13/8821133.html
-Advertisement-
Play Games

[20180413]熱備模式相關問題2.txt--//上午測試熱備模式相關問題,就是如果打開熱備模式,如果中間的歸檔丟失,oracle在alter database end backup ;時並沒有應用日誌.--//雖然熱備份模式文件頭scn被"凍結",一定在某個地方記錄的檢查點的scn,這樣在執行 ...


[20180413]熱備模式相關問題2.txt

--//上午測試熱備模式相關問題,就是如果打開熱備模式,如果中間的歸檔丟失,oracle在alter database end   backup ;時並沒有應用日誌.
--//雖然熱備份模式文件頭scn被"凍結",一定在某個地方記錄的檢查點的scn,這樣在執行alter database end   backup ;時,寫入新的scn
--//這樣在恢復時才有可能跳過一些丟失的歸檔.

--//從某種意義講,oracle這樣設計有一定道理,假設某種情況打開熱備模式,由於熱備模式中斷或者沒有完成,忘記結束,如果在某次異常關閉時
--//需要恢復,並需要從"凍結"的scn號開始恢復.
--//測試看看這些相關信息保存在那裡.

1.環境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.測試1:
SYS@book> alter tablespace tea  begin   backup ;
Tablespace altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                               TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------------------------- ------------------------------
    1        13277609065 2018-04-13 09:38:45                7            925702 ONLINE               937 YES /mnt/ramdisk/book/system01.dbf                     SYSTEM
    6        13277634716 2018-04-13 15:02:36      13276257767            925702 ONLINE               309 YES /mnt/ramdisk/book/tea01.dbf                        TEA

SYS@book> alter tablespace tea  end   backup ;
Tablespace altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                               TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------------------------- ------------------------------
    1        13277609065 2018-04-13 09:38:45                7            925702 ONLINE               937 YES /mnt/ramdisk/book/system01.dbf                     SYSTEM
    6        13277634716 2018-04-13 15:02:36      13276257767            925702 ONLINE               310 YES /mnt/ramdisk/book/tea01.dbf                        TEA

--//數據文件6的scn=13277634716,沒有變化,CHECKPOINT_COUNT增加.

3.測試2:
SYS@book> alter tablespace tea  begin   backup ;
Tablespace altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                               TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------------------------- ------------------------------
    1        13277609065 2018-04-13 09:38:45                7            925702 ONLINE               937 YES /mnt/ramdisk/book/system01.dbf                     SYSTEM
    6        13277634864 2018-04-13 15:04:47      13276257767            925702 ONLINE               311 YES /mnt/ramdisk/book/tea01.dbf                        TEA

SYS@book> alter system checkpoint ;
System altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                               TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------------------------- ------------------------------
    1        13277634878 2018-04-13 15:04:56                7            925702 ONLINE               938 YES /mnt/ramdisk/book/system01.dbf                     SYSTEM
    6        13277634864 2018-04-13 15:04:47      13276257767            925702 ONLINE               312 YES /mnt/ramdisk/book/tea01.dbf                        TEA

--//雖然數據文件6呃文件頭scn被凍結13277634864,但是CHECKPOINT_COUNT依舊還是增加,也就是還是會改動文件頭信息.

select 13277634878,trunc(13277634878/power(2,32)) scn_wrap,mod(13277634878,power(2,32))  scn_base from dual
 13277634878     SCN_WRAP     SCN_BASE SCN_WRAP16 SCN_BASE16
------------ ------------ ------------ ---------- ----------
 13277634878            3    392732990          3   1768a13e

SYS@book> @ &r/10to16 392732990
10 to 16 HEX      REVERSE16
----------------- -----------------------------------
000000001768a13e  0x3ea16817-00000000

--//通過bbed觀察,可以發出檢查點信息是記錄在文件頭中的.

BBED> p   dba 6,1 kcvfh.kcvfhbcp.kcvcpscn
struct kcvcpscn, 8 bytes                    @152
   ub4 kscnbas                              @152      0x1768a13e
   ub2 kscnwrp                              @156      0x0003

SYS@book> alter system checkpoint ;
System altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                                 TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- ---------------------------------------------------- ------------------------------
    1        13277635895 2018-04-13 15:13:16                7            925702 ONLINE               939 YES /mnt/ramdisk/book/system01.dbf                       SYSTEM
    6        13277634864 2018-04-13 15:04:47      13276257767            925702 ONLINE               313 YES /mnt/ramdisk/book/tea01.dbf                          TEA

SYS@book> @ &r/10to16 13277635895
10 to 16 HEX      REVERSE16
----------------- -----------------------------------
000000031768a537  0x37a56817-03000000

BBED> p   dba 6,1 kcvfh.kcvfhbcp.kcvcpscn
struct kcvcpscn, 8 bytes                    @152
   ub4 kscnbas                              @152      0x1768a537
   ub2 kscnwrp                              @156      0x0003

--//可以發現數據文件6kcvfh.kcvfhbcp.kcvcpscn位置也會更新.這樣在結束熱備模式時,自動更新文件頭.

SYS@book> alter tablespace tea  end   backup ;
Tablespace altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                                 TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- ---------------------------------------------------- ------------------------------
    1        13277635895 2018-04-13 15:13:16                7            925702 ONLINE               939 YES /mnt/ramdisk/book/system01.dbf                       SYSTEM
    6        13277635895 2018-04-13 15:13:16      13276257767            925702 ONLINE               314 YES /mnt/ramdisk/book/tea01.dbf                          TEA

--//這也就很好解析為什麼結束熱備模式,從那裡更新檢查點.另外kcvfh.kcvfhbcp.kcvcpscn,裡面的hb可以猜測表示hot backup的意思.

4.測試3:
--//做一個文件頭轉儲看看:
SYS@book> alter tablespace tea  begin   backup ;
Tablespace altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                                 TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- ---------------------------------------------------- ------------------------------
    1        13277635895 2018-04-13 15:13:16                7            925702 ONLINE               939 YES /mnt/ramdisk/book/system01.dbf                       SYSTEM
    6        13277637553 2018-04-13 15:39:15      13276257767            925702 ONLINE               317 YES /mnt/ramdisk/book/tea01.dbf                          TEA

SYS@book> alter system checkpoint ;
System altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                                 TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- ---------------------------------------------------- ------------------------------
    1        13277637599 2018-04-13 15:39:56                7            925702 ONLINE               940 YES /mnt/ramdisk/book/system01.dbf                       SYSTEM
    6        13277637553 2018-04-13 15:39:15      13276257767            925702 ONLINE               318 YES /mnt/ramdisk/book/tea01.dbf                          TEA

select 13277637599,trunc(13277637599/power(2,32)) scn_wrap,mod(13277637599,power(2,32))  scn_base from dual
 13277637599     SCN_WRAP     SCN_BASE SCN_WRAP16 SCN_BASE16
------------ ------------ ------------ ---------- ----------
 13277637599            3    392735711          3   1768abdf

select 13277637553,trunc(13277637553/power(2,32)) scn_wrap,mod(13277637553,power(2,32))  scn_base from dual
 13277637553     SCN_WRAP     SCN_BASE SCN_WRAP16 SCN_BASE16
------------ ------------ ------------ ---------- ----------
 13277637553            3    392735665          3   1768abb1

SYS@book> alter session set events 'immediate trace name FILE_HDRS level 12';
Session altered.

--//檢查轉儲:
DATA FILE #6:
  name #10: /mnt/ramdisk/book/tea01.dbf
creation size=5120 block size=8192 status=0xe head=10 tail=10 dup=1
 tablespace 7, index=7 krfil=6 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:318 scn: 0x0003.1768abb1 04/13/2018 15:39:15
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// -->  註這裡的信息來之控制文件:http://blog.itpub.net/267265/viewspace-2136766/

 Stop scn: 0xffff.ffffffff 04/13/2018 09:38:22
 Creation Checkpointed at scn:  0x0003.17539de7 02/13/2017 15:09:58
 thread:1 rba:(0x1d6.48.10)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000
 Offline scn: 0x0000.00000000 prev_range: 0
 Online Checkpointed at scn:  0x0000.00000000
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000
 Hot Backup end marker scn: 0x0000.00000000
 aux_file is NOT DEFINED
 Plugged readony: NO
 Plugin scnscn: 0x0000.00000000
 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Online move state: 0
 V10 STYLE FILE HEADER:
    Compatibility Vsn = 186647552=0xb200400
    Db ID=1337401710=0x4fb7216e, Db Name='BOOK'
    Activation ID=0=0x0
    Control Seq=39840=0x9ba0, File size=5120=0x1400
    File Number=6, Blksiz=8192, File Type=3 DATA
Tablespace #7 - TEA  rel_fn:6
Creation   at   scn: 0x0003.17539de7 02/13/2017 15:09:58
Backup taken at scn: 0x0003.1768abb1 04/13/2018 15:39:15 thread:1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--//發出熱備份模式的scn信息.
 reset logs count:0x35711eb0 scn: 0x0000.000e2006
 prev reset logs count:0x3121c97a scn: 0x0000.00000001
 recovered at 04/13/2018 09:38:35
 status:0x1 root dba:0x00000000 chkpt cnt: 318 ctl cnt:317
begin-hot-backup file size: 5120
Checkpointed at scn:  0x0003.1768abb1 04/13/2018 15:39:15
 thread:1 rba:(0x2f7.a85b.10)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000
Backup Checkpointed at scn:  0x0003.1768abdf 04/13/2018 15:39:56  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--//備份過程中發出的檢查點信息.
 thread:1 rba:(0x2f7.a886.10)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000
External cache id: 0x0 0x0 0x0 0x0
Absolute fuzzy scn: 0x0000.00000000
Recovery fuzzy scn: 0x0000.00000000 01/01/1988 00:00:00
Terminal Recovery Stamp  01/01/1988 00:00:00
Platform Information:    Creation Platform ID: 13
Current Platform ID: 13 Last Platform ID: 13
DUMP OF TEMP FILES: 1 files in database

5.繼續測試,使用bbed修改看看:
--//使用bbed修改看看,減少kcvfh.kcvfhbcp.kcvcpscn-11看看.

SYS@book> shutdown abort ;
ORACLE instance shut down.

--//使用bbed修改:
BBED> p  /d  dba 6,1 kcvfh.kcvfhbcp.kcvcpscn
struct kcvcpscn, 8 bytes                    @152
   ub4 kscnbas                              @152      392735711
   ub2 kscnwrp                              @156      3

BBED> assign  dba 6,1 kcvfh.kcvfhbcp.kcvcpscn.kscnbas=392735700
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub4 kscnbas                                 @152      0x1768abd4

BBED> sum apply dba 6,1
Check value for File 6, Block 1:
current = 0xcf4c, required = 0xcf4c

BBED> p    dba 6,1 kcvfh.kcvfhbcp.kcvcpscn
struct kcvcpscn, 8 bytes                    @152
   ub4 kscnbas                              @152      0x1768abd4
   ub2 kscnwrp                              @156      0x0003

SYS@book> @ &r/16to10 31768abd4
16 to 10 DEC
------------
 13277637588
--//減少到13277637588.

SYS@book> startup
ORACLE instance started.
Total System Global Area    634732544 bytes
Fixed Size                    2255792 bytes
Variable Size               197133392 bytes
Database Buffers            427819008 bytes
Redo Buffers                  7524352 bytes
Database mounted.
ORA-10873: file 6 needs to be either taken out of backup mode or media recovered
ORA-01110: data file 6: '/mnt/ramdisk/book/tea01.dbf'

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                               TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------------------------- ------------------------------
    1        13277637599 2018-04-13 15:39:56                7            925702 ONLINE               941 YES /mnt/ramdisk/book/system01.dbf                     SYSTEM
    6        13277637553 2018-04-13 15:39:15      13276257767            925702 ONLINE               318 YES /mnt/ramdisk/book/tea01.dbf                        TEA

SYS@book> alter tablespace tea  end   backup ;
Tablespace altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                               TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------------------------- ------------------------------
    1        13277637599 2018-04-13 15:39:56                7            925702 ONLINE               941 YES /mnt/ramdisk/book/system01.dbf                     SYSTEM
    6        13277637588 2018-04-13 15:39:56      13276257767            925702 ONLINE               319 YES /mnt/ramdisk/book/tea01.dbf                        TEA

--//與前面修改一致,也驗證了自己的判斷.

6.繼續測試,是否在熱備份模式可以offline表空間:

SYS@book> alter database open ;
Database altered.

SYS@book> alter tablespace tea  begin   backup ;
Tablespace altered.

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file# in (1,6);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS  CHECKPOINT_COUNT FUZ NAME                                               TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------------------------- ------------------------------
    1        13277658196 2018-04-13 15:56:09                7            925702 ONLINE               944 YES /mnt/ramdisk/book/system01.dbf                     SYSTEM
    6        13277658833 2018-04-13 15:59:49      13276257767            925702 ONLINE               329 YES /mnt/ramdisk/book/tea01.dbf                        TEA

SYS@book> alter tablespace tea  offline;
alter tablespace tea  offline
*
ERROR at line 1:
ORA-01150: cannot prevent writes - file 6 has online backup set
ORA-01110: data file 6: '/mnt/ramdisk/book/tea01.dbf'

$ oerr ora 01150
01150, 00000, "cannot prevent writes - file %s has online backup set"
// *Cause: An attempt to make a tablespace read only or offline normal found
//          that an online backup is still in progress. It will be necessary
//          to write the file header to end the backup, but that would not
//          be allowed if this command succeeded.
// *Action: End the backup of the offending tablespace and retry this command.

SYS@book> alter tablespace tea  offline immediate ;
Tablespace altered.

--//強制ok.

SYS@book> alter tablespace tea  online;
alter tablespace tea  online
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/mnt/ramdisk/book/tea01.dbf'

SYS@book> select * from v$backup where file# in (1,6);
FILE# STATUS                  CHANGE# TIME
----- ------------------ ------------ -------------------
    1 NOT ACTIVE          13277525910 2018-04-13 09:03:44
    6 NOT ACTIVE          13277658833 2018-04-13 15:59:49

--//熱備模式已經關閉.

--//總結:
--//雖然熱備份已經不常用,也不推薦使用.還是佩服oracle設計時的考慮周全,在發出檢查點時記錄最新的scn號數據文件中即使在熱備份模式下.
--//這樣在恢復時減少使用歸檔的數量.



您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1.通過指令 whereis java 查看是否已經配置jdk 如果已經安裝,通過指令 rm -rf <jdk路徑> 刪除 2.通過ssh工具將jdk-8u11-linux-x64.tar.gz拖拽到 /home文件目錄下 3. 指令 cd /home 4.解壓 tar jdk-8u11-linux ...
  • 本文內容: 什麼是觸發器 創建觸發器 單條觸發器語句 多條觸發器語句 查看觸發器 刪除觸發器 觸發器的新舊記錄引用 首發日期:2018-04-14 什麼是觸發器: 觸發器用來在某些操作之後,“自動”執行一些操作。(比如插入了新的學生信息,那麼在班級表中應該修改學生數)。 當insert delete... ...
  • 當從B表數據更新到A表時: update A inner join B on A.aid=B.aid set A.user_name=B.username,A.phone=B.telwhere A.aid=A.aid 當從B表數據插入到A表時: insert A(`aid`,`typeid`,`ch ...
  • 首先根據 "準備工作" 中的操作導入大學模式,打開資料庫連接後進入到 MySQL 的交互界面,再使用命令 切換到 db book 資料庫。 單關係查詢 SQL 查詢的基本結構由三個子句構成, ,`from where from where select` 子句指定的運算,然後產生一個關係作為結果,即 ...
  • 由於SQL Server不常用,所以這裡只針對MySQL資料庫和Oracle資料庫的區別 (1) 對事務的提交 MySQL預設是自動提交,而Oracle預設不自動提交,需要用戶手動提交,需要在寫commit;指令或者點擊commit按鈕(2) 分頁查詢 MySQL是直接在SQL語句中寫"select ...
  • 本文內容: 什麼是視圖 創建視圖 查看視圖 視圖的修改 視圖的刪除 視圖的數據操作 首發日期:2018-04-13 什麼是視圖: 視圖是一種基於查詢結果的虛擬表,數據來源的表稱為基本表。 視圖的建立和刪除不影響基本表。 視圖的插入,修改操作會影響基本表。 如果視圖來自多個基本表,那麼不可以修改基本表... ...
  • 今天,正在開心的寫著代碼,突然多個人員反饋網站特別慢。 總結:一開始這個項目已經正常跑了一段時間了,不知道為什麼會突然出現這個問題。沒有深究,有知道的歡迎留言。 ...
  • https://www.cnblogs.com/xqzt/p/4482888.html ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...