1. 程式人生 > 其它 >29.重建控制檔案

29.重建控制檔案

1.前言

  在oracle的運維過程中,時常會遇到一些場景需要重建控制檔案,以下是通過複製控制檔案到新路徑,執行一段時間後,再用老的控制檔案啟動資料庫重現。

2.步驟

SQL> shutdown abort     
ORACLE instance shut down.
SQL> startup mount

ORACLE instance started.

Total System Global Area  599785472 bytes
Fixed Size                  2098112 bytes
Variable Size             218106944
bytes Database Buffers 373293056 bytes Redo Buffers 6287360 bytes Database mounted. SQL> alter database backup controlfile to trace; ##這裡會生產一個trace檔案,該檔案中有一些控制檔案的建立語句 Database altered. SQL> oradebug setmypid Statement processed. SQL> oradebug tracefile_name /s01/oracle/
admin/cxywdb/udump/cxywdb_ora_3983.trc ##這個是trace檔案的位置 SQL> shutdown abort ORACLE instance shut down. SQL> startup nomount; ORACLE instance started. Total System Global Area 599785472 bytes Fixed Size 2098112 bytes Variable Size 218106944 bytes Database Buffers 373293056
bytes Redo Buffers 6287360 bytes SQL> @control.sql ##這裡應該是上面建立控制語句的sql檔案(用vim建立一個控制檔案) Control file created. SQL> select status from v$instance; STATUS ------------ MOUNTED SQL> recover database; Media recovery complete. SQL> alter database open; Database altered.

建立控制檔案的官方文件:https://docs.oracle.com/cd/B28359_01/server.111/b28310/control003.htm#ADMIN10064

精華參考:https://cloud.tencent.com/developer/article/1681540