【備份恢復】所有控制檔案丟失後 利用trace中的控制檔案備份執行恢復

不一樣的天空w發表於2016-10-16

丟失了所有控制檔案副本後進行恢復

注:在利用trace備份恢復控制檔案的時候,有一下兩個點要特別注意:
    - 只讀表空間
    - 臨時表空間

1.準備只讀表空間環境
SYS@ORA11GR2>create tablespace ts datafile
  2  '/u01/app/oracle/oradata/ORA11GR2/ts01.dbf' size
  3  5m,'/u01/app/oracle/oradata/ORA11GR2/ts02.dbf' size 5m;

Tablespace created.

SYS@ORA11GR2>select tablespace_name,status from dba_tablespaces where tablespace_name='TS';

TABLESPACE_NAME STATUS
--------------- ---------
TS              ONLINE
SYS@ORA11GR2>select file_id,file_name,status,online_status from dba_data_files where tablespace_name='TS';

   FILE_ID FILE_NAME                                     STATUS    ONLINE_
---------- --------------------------------------------- --------- -------
        12 /u01/app/oracle/oradata/ORA11GR2/ts01.dbf     AVAILABLE ONLINE
        13 /u01/app/oracle/oradata/ORA11GR2/ts02.dbf     AVAILABLE ONLINE

——將表空間ts該為read only:
SYS@ORA11GR2>alter tablespace ts read only;

Tablespace altered.

SYS@ORA11GR2>select tablespace_name,status from dba_tablespaces where tablespace_name='TS';

TABLESPACE_NAME STATUS
--------------- ---------
TS              READ ONLY

SYS@ORA11GR2>select file_id,file_name,status,online_status from dba_data_files where tablespace_name='TS';

   FILE_ID FILE_NAME                                     STATUS    ONLINE_
---------- --------------------------------------------- --------- -------
        12 /u01/app/oracle/oradata/ORA11GR2/ts01.dbf     AVAILABLE ONLINE
        13 /u01/app/oracle/oradata/ORA11GR2/ts02.dbf     AVAILABLE ONLINE

2.檢視控制檔案位置
SYS@ORA11GR2>select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORA11GR2/control01.ctl
/u01/app/oracle/oradata/ORA11GR2/control02.ctl

3.轉儲控制檔案到trace檔案中
SYS@ORA11GR2>oradebug setmypid(設定追蹤)
Statement processed.

SYS@ORA11GR2>alter database backup controlfile to trace;

Database altered.

SYS@ORA11GR2>oradebug tracefile_name(顯示產生的追蹤檔名稱)
/u01/app/oracle/diag/rdbms/ora11gr2/ORA11GR2/trace/ORA11GR2_ora_23019.trc
SYS@ORA11GR2>

4.開啟轉儲後檔案,以下為部分內容
SYS@ORA11GR2>!cat /u01/app/oracle/diag/rdbms/ora11gr2/ORA11GR2/trace/ORA11GR2_ora_23019.trc
———————————————————————————————————————
--     Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORA11GR2" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/u01/app/oracle/oradata/ORA11GR2/redo01.log',
    '/u01/app/oracle/oradata/ORA11GR2/redo01_a.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 2 (
    '/u01/app/oracle/oradata/ORA11GR2/redo02.log',
    '/u01/app/oracle/oradata/ORA11GR2/redo02_a.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 3 (
    '/u01/app/oracle/oradata/ORA11GR2/redo03.log',
    '/u01/app/oracle/oradata/ORA11GR2/redo03_a.log'
  ) SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u01/app/oracle/oradata/ORA11GR2/system01.dbf',
  '/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf',
  '/u01/app/oracle/oradata/ORA11GR2/ts_lob01.dbf',
  '/u01/app/oracle/oradata/ORA11GR2/users01.dbf',
  '/u01/app/oracle/oradata/ORA11GR2/example01.dbf',
  '/u01/app/oracle/oradata/ORA11GR2/ts_ora11gr2_01.dbf',
  '/u01/app/oracle/oradata/ORA11GR2/ts_idx01.dbf',
  '/u01/app/oracle/oradata/ORA11GR2/ts_catalog.dbf',
  '/u01/app/oracle/oradata/ORA11GR2/ts_users.dbf',
  '/u01/app/oracle/oradata/ORA11GR2/undo1.dbf'
CHARACTER SET AL32UTF8
;
-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEFAULT DEVICE TYPE TO','DISK');
-- Configure RMAN configuration record 2
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
-- Configure RMAN configuration record 3
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK BACKUP TYPE TO COPY PARALLELISM 1');
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/FRA/ORA11GR2/archivelog/2016_10_01/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- Set Database Guard and/or Supplemental Logging
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Files in read-only tablespaces are now named.
ALTER DATABASE RENAME FILE 'MISSING00011'
  TO '/u01/app/oracle/oradata/ORA11GR2/ts1.dbf';
ALTER DATABASE RENAME FILE 'MISSING00012'
  TO '/u01/app/oracle/oradata/ORA11GR2/ts01.dbf';
ALTER DATABASE RENAME FILE 'MISSING00013'
  TO '/u01/app/oracle/oradata/ORA11GR2/ts02.dbf';
-- Online the files in read-only tablespaces.
ALTER TABLESPACE "TS1" ONLINE;
ALTER TABLESPACE "TS" ONLINE;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/ORA11GR2/temp01.dbf'
     SIZE 87031808  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
——————————————————————————————————————
注:在轉儲的控制檔案中,沒有隻讀表空間的內容,本測試是先生成轉儲檔案,再恢復的,往往在控制檔案丟失之前很少會有人轉儲控制檔案的(當然了,一般情況都會備份控制檔案的),如果沒有轉儲控制檔案的話,我們也可以在其他資料庫中轉儲控制檔案,按照目標庫的情況進行調整,然後再建立
———————————————————————————————————————

5.手工刪除控制檔案
SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/*.ctl
/u01/app/oracle/oradata/ORA11GR2/control01.ctl
/u01/app/oracle/oradata/ORA11GR2/control02.ctl

SYS@ORA11GR2>!rm /u01/app/oracle/oradata/ORA11GR2/*.ctl

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/*.ctl
ls: /u01/app/oracle/oradata/ORA11GR2/*.ctl: No such file or directory

6.切換日誌,強制歸檔出錯(因為歸檔觸發ckpt寫到控制檔案資訊,但此時已經沒有了對應的物理控制檔案了)
SYS@ORA11GR2>alter system archive log current;
alter system archive log current
*
ERROR at line 1:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ORA11GR2/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
(((控制檔案刪除以後,資料庫是正常執行的;不過當修改結構資訊時,會寫控制檔案,會立即報錯!!!!!!!)))

7.一致性關閉資料庫已經不可能了(控制檔案丟失,無法同步SCN),採取強制手段
SYS@ORA11GR2>shutdown immediate;
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ORA11GR2/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SYS@ORA11GR2>
SYS@ORA11GR2>shutdown abort;
ORACLE instance shut down.

8.按照轉儲檔案中的步驟恢復控制檔案,nomount啟動資料庫
SYS@ORA11GR2>startup nomount;(僅僅開啟例項)
ORACLE instance started.

Total System Global Area  730714112 bytes
Fixed Size                  2256832 bytes
Variable Size             452984896 bytes
Database Buffers          272629760 bytes
Redo Buffers                2842624 bytes

9.採用NORESETLOGS方式建立控制檔案
SYS@ORA11GR2>create controlfile reuse database "ORA11GR2" noresetlogs  archivelog
  2      maxlogfiles 16
  3      maxlogmembers 3
  4      maxdatafiles 100
  5      maxinstances 8
  6      maxloghistory 292
  7  logfile
  8    group 1 (
  9      '/u01/app/oracle/oradata/ORA11GR2/redo01.log',
 10      '/u01/app/oracle/oradata/ORA11GR2/redo01_a.log'
 11    ) size 50m blocksize 512,
 12    group 2 (
 13      '/u01/app/oracle/oradata/ORA11GR2/redo02.log',
 14      '/u01/app/oracle/oradata/ORA11GR2/redo02_a.log'
 15    ) size 50m blocksize 512,
 16    group 3 (
 17      '/u01/app/oracle/oradata/ORA11GR2/redo03.log',
 18      '/u01/app/oracle/oradata/ORA11GR2/redo03_a.log'
 19    ) size 50m blocksize 512
 20  -- standby logfile
 21  datafile
 22    '/u01/app/oracle/oradata/ORA11GR2/system01.dbf',
 23    '/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf',
 24    '/u01/app/oracle/oradata/ORA11GR2/ts_lob01.dbf',
 25    '/u01/app/oracle/oradata/ORA11GR2/users01.dbf',
 26    '/u01/app/oracle/oradata/ORA11GR2/example01.dbf',
 27    '/u01/app/oracle/oradata/ORA11GR2/ts_ora11gr2_01.dbf',
 28    '/u01/app/oracle/oradata/ORA11GR2/ts_idx01.dbf',
 29    '/u01/app/oracle/oradata/ORA11GR2/ts_catalog.dbf',
 30    '/u01/app/oracle/oradata/ORA11GR2/ts_users.dbf',
 31    '/u01/app/oracle/oradata/ORA11GR2/undo1.dbf'
 32  character set al32utf8
 33  ;

Control file created.

10.因為之前shutdown沒有采取一致性關閉,所以,需要recover database,recover後,可正常open資料庫
SYS@ORA11GR2>select status from v$instance;

STATUS
------------
MOUNTED(控制檔案建立成功之後自動處於mount狀態)

SYS@ORA11GR2>alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/app/oracle/oradata/ORA11GR2/system01.dbf'


SYS@ORA11GR2>recover database;
ORA-00283: recovery session canceled due to errors
ORA-01244: unnamed datafile(s) added to control file by media recovery
ORA-01110: data file 13: '/u01/app/oracle/oradata/ORA11GR2/ts02.dbf'
ORA-01110: data file 12: '/u01/app/oracle/oradata/ORA11GR2/ts01.dbf'

SYS@ORA11GR2>recover database;
ORA-00283: recovery session canceled due to errors
ORA-01111: name for data file 12 is unknown - rename to correct file
ORA-01110: data file 12:
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00012'
ORA-01157: cannot identify/lock data file 12 - see DBWR trace file
ORA-01111: name for data file 12 is unknown - rename to correct file
ORA-01110: data file 12:
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00012'

——解決:
SYS@ORA11GR2>alter database datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00012' offline;
Database altered.

SYS@ORA11GR2>recover database;
ORA-00283: recovery session canceled due to errors
ORA-01111: name for data file 13 is unknown - rename to correct file
ORA-01110: data file 13:
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00013'
ORA-01157: cannot identify/lock data file 13 - see DBWR trace file
ORA-01111: name for data file 13 is unknown - rename to correct file
ORA-01110: data file 13:
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00013'

SYS@ORA11GR2>alter database datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00013' offline;

Database altered.

SYS@ORA11GR2>recover database;
Media recovery complete.

——啟庫:
SYS@ORA11GR2>alter database open;

Database altered.

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/*.ctl
/u01/app/oracle/oradata/ORA11GR2/control01.ctl
/u01/app/oracle/oradata/ORA11GR2/control02.ctl
(控制檔案恢復回來了)!!!!!!!!!
注:看視恢復完成,不過可以很清晰的看到轉儲的控制檔案中,還有幾步沒有完成,進行;

11.再次檢視錶空間和資料檔案狀態:
注:我們可以看到,只讀表空間的狀態依然是read only,不過資料檔案的路徑、名字及狀態都有所變化
SYS@ORA11GR2>select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
TEMP                           ONLINE
USERS                          ONLINE
EXAMPLE                        ONLINE
TS_ORA11GR2                    ONLINE
TS_CATALOG                     ONLINE
TS_USERS                       ONLINE
UNDO1                          ONLINE
TS_IDX_1                       ONLINE
TS_LOB                         ONLINE

TABLESPACE_NAME                STATUS
------------------------------ ---------
TS1                            READ ONLY
TS                             READ ONLY

13 rows selected.

SYS@ORA11GR2>col file_name for a52
SYS@ORA11GR2>select file_name,status,online_status from dba_data_files;

FILE_NAME                                            STATUS    ONLINE_
---------------------------------------------------- --------- -------
/u01/app/oracle/oradata/ORA11GR2/undo1.dbf           AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_users.dbf        AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_catalog.dbf      AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_idx01.dbf        AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_ora11gr2_01.dbf  AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/example01.dbf       AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/users01.dbf         AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_lob01.dbf        AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf        AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/system01.dbf        AVAILABLE SYSTEM
/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED0 AVAILABLE RECOVER

FILE_NAME                                            STATUS    ONLINE_
---------------------------------------------------- --------- -------
0012

/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED0 AVAILABLE RECOVER
0013

/u01/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING0 AVAILABLE OFFLINE
0011


13    ows selected.

12.按照轉儲的步驟繼續rename資料檔案(按照轉儲檔案內的內容修改)
注:如果不rename資料檔案的話,資料檔案是沒法ONLINE的
SYS@ORA11GR2>alter database rename file'UNNAMED00012' to '/u01/app/oracle/oradata/ORA11GR2/ts01.dbf';

Database altered.

SYS@ORA11GR2>alter database rename file'UNNAMED00013' to '/u01/app/oracle/oradata/ORA11GR2/ts02.dbf';

Database altered.

13.按照轉儲步驟,修改表空間online
SYS@ORA11GR2>alter tablespace ts online;

Tablespace altered.

14.再次檢視錶空間、資料檔案的狀態,已經恢復原貌
SYS@ORA11GR2>select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
TEMP                           ONLINE
USERS                          ONLINE
EXAMPLE                        ONLINE
TS_ORA11GR2                    ONLINE
TS_CATALOG                     ONLINE
TS_USERS                       ONLINE
UNDO1                          ONLINE
TS_IDX_1                       ONLINE
TS_LOB                         ONLINE

TABLESPACE_NAME                STATUS
------------------------------ ---------
TS1                            READ ONLY
TS                             READ ONLY

13 rows selected.

SYS@ORA11GR2>select file_name,status,online_status from dba_data_files;

FILE_NAME                                                    STATUS    ONLINE_
------------------------------------------------------------ --------- -------
/u01/app/oracle/oradata/ORA11GR2/undo1.dbf                   AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_users.dbf                AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_catalog.dbf              AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_idx01.dbf                AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_ora11gr2_01.dbf          AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/example01.dbf               AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/users01.dbf                 AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_lob01.dbf                AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf                AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/system01.dbf                AVAILABLE SYSTEM
/u01/app/oracle/oradata/ORA11GR2/ts01.dbf                    AVAILABLE ONLINE

FILE_NAME                                                    STATUS    ONLINE_
------------------------------------------------------------ --------- -------
/u01/app/oracle/oradata/ORA11GR2/ts02.dbf                    AVAILABLE ONLINE
/u01/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00011     AVAILABLE OFFLINE

13 rows selected.

——也可以按照轉儲檔案將ts1表空間rename,不過對於不需要的可以直接drop:
SYS@ORA11GR2>drop tablespace ts1 including contents and datafiles;

Tablespace dropped.
——驗證:
SYS@ORA11GR2>select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
TEMP                           ONLINE
USERS                          ONLINE
EXAMPLE                        ONLINE
TS_ORA11GR2                    ONLINE
TS_CATALOG                     ONLINE
TS_USERS                       ONLINE
UNDO1                          ONLINE
TS_IDX_1                       ONLINE
TS_LOB                         ONLINE

TABLESPACE_NAME                STATUS
------------------------------ ---------
TS                             READ ONLY

12 rows selected.

SYS@ORA11GR2>select file_name,status,online_status from dba_data_files;

FILE_NAME                                                    STATUS    ONLINE_
------------------------------------------------------------ --------- -------
/u01/app/oracle/oradata/ORA11GR2/undo1.dbf                   AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_users.dbf                AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_catalog.dbf              AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_idx01.dbf                AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_ora11gr2_01.dbf          AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/example01.dbf               AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/users01.dbf                 AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/ts_lob01.dbf                AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf                AVAILABLE ONLINE
/u01/app/oracle/oradata/ORA11GR2/system01.dbf                AVAILABLE SYSTEM
/u01/app/oracle/oradata/ORA11GR2/ts01.dbf                    AVAILABLE ONLINE

FILE_NAME                                                    STATUS    ONLINE_
------------------------------------------------------------ --------- -------
/u01/app/oracle/oradata/ORA11GR2/ts02.dbf                    AVAILABLE ONLINE

12 rows selected.

15.轉儲步驟中還涉及到了臨時表空間,我們驗證一下,重建控制檔案後,臨時表空間的情況,沒有任何資料檔案
SYS@ORA11GR2>select file_name,tablespace_name from dba_temp_files;

no rows selected
(臨時表空間對應的物理檔案及其路徑,都沒有)

16.按照轉儲中的語句給臨時表空間增加資料檔案
SYS@ORA11GR2>select * from database_properties where property_name like '%TEMP%';

PROPERTY_NAME             PROPERTY_VALUE  DESCRIPTION
------------------------- --------------- ----------------------------------------
DEFAULT_TEMP_TABLESPACE   TEMP            Name of default temporary tablespace

SYS@ORA11GR2>ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/ORA11GR2/temp01.dbf' SIZE 87031808  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

Tablespace altered.

17.臨時檔案已新增成功(臨時表空間對應的物理檔案及其路徑)
SYS@ORA11GR2>select tablespace_name,file_name from dba_temp_files;

TABLESPACE FILE_NAME
---------- ---------------------------------------------
TEMP       /u01/app/oracle/oradata/ORA11GR2/temp01.dbf

至此,控制檔案恢復完畢!!!!!!!!!!!!!!!!!!!!!!!

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2126522/,如需轉載,請註明出處,否則將追究法律責任。

相關文章