利用trace重建控制檔案

2021-07-23 01:12:22 字數 2865 閱讀 6556

控制檔案是

oracle

資料庫用來查詢資料庫檔案,並從總體上管理資料庫狀態的根檔案

包括-

資料庫名稱和資料庫唯一識別符號(

dbid)

- 建立資料庫的時間戳

- 有關資料檔案、

聯機重做日誌檔案、和歸檔重做日誌檔案的資訊

- 表空間資訊

- rman

備份

將控制檔案備份到trace

alter" rel="noopener noreferrer">sys@test>alter

database backup controlfile to trace;

database altered.

編寫查詢trace檔案指令碼

!vi" rel="noopener noreferrer">sys@test>!vi

gettrcname.sql

select    d.value

|| '/'

|| lower (rtrim (i.instance, chr (0)))

|| '_ora_'

|| p.spid

|| '.trc' trace_file_name

from (select p.spid

from sys.v$mystat m, sys.v$session s, sys.v$process p

where m.statistic# = 1 and s.sid = m.sid and p.addr = s.paddr) p,

(select t.instance

from sys.v$thread t, sys.v$parameter v

where v.name = 'thread'

and (v.value = 0 or t.thread# = to_number (v.value))) i,

(select value

from sys.v$parameter

where name = 'user_dump_dest') d/

查詢trace檔案

@gettrcname" rel="noopener noreferrer">sys@test>@gettrcname

檢視

oracle@test

(tns v1-v3)

*** 2016-09-06 11:12:38.496

*** session id:(1.5) 2016-09-06 11:12:38.496

*** client id:() 2016-09-06 11:12:38.496

*** service name:() 2016-09-06 11:12:38.496

*** module name:(

sqlplus@test

從startup nomount開始 依次保留logfile、datafile、recover database等

startup" rel="noopener noreferrer">sys@test>startup

nomount

oracle instance started.

total system global area 1653518336 bytes

fixed size                  2253784 bytes

variable size            1006636072 bytes

database buffers          637534208 bytes

redo buffers                7094272 bytes

11:47:41

create" rel="noopener noreferrer">sys@test>create

control file created.

11:50:26

alter" rel="noopener noreferrer">sys@test>alter

11:50:26

alter" rel="noopener noreferrer">sys@test>alter

system altered.

11:50:38

sys@test

>

database altered.

11:50:40

sys@test

>

tablespace altered.

11:50:40

sys@test

>

tablespace altered.

11:50:40

sys@test

>

tablespace altered.

11:50:40

11:50:40" rel="noopener noreferrer">sys@test>11:50:40

2 database altered.

11:50:40

11:50:40" rel="noopener noreferrer">sys@test>11:50:40

2 database altered.

11:50:41

11:50:41" rel="noopener noreferrer">sys@test>11:50:41

2 database altered.

11:50:41

11:50:41" rel="noopener noreferrer">sys@test>11:50:41

2 database altered. 

Oracle 利用trace檔案重建控制檔案

重建步驟 1 生成trace檔案 alter database backup controlfile to trace 2 找到生成的trace檔案 show parameter dumpuser dump dest 檔案對應的路徑即為trace檔案的路徑 3 關閉資料庫 shutdown imme...

重建控制檔案

1 在庫完好的時候先備份一下controlfile以備不時之需 sql alter database backup controlfile to trace sql exit cd oracle base admin oracle sid udump ls ltrh tail 1 rw r 1ora...

重建控制檔案原理

非正常關機後 noresetlogs重建控制檔案 控制檔案中scn來自 最後一次將日誌寫入磁碟的scn sql select checkpoint change from v datafile checkpoint change 928548 928548 928548 928548 sql sel...