Oracle备份恢复:oracle用老的控制文件备份恢复新建的数据文件
Oracle备份恢复:oracle用老的控制文件备份恢复新建的数据文件
备份控制文件并在备份后新建表空间和数据:
SQL> alter database backup controlfile to trace as '/home/oracle/ctl.sql';
Database altered.
SQL> create tablespace tbs_tbs datafile '/database/oradata/skyread/tbs_tbs.dbf' size 10M;
Tablespace created.
SQL> create table t02 tablespace tbs_tbs as select * from dict;
Table created
干净关闭数据库,模拟控制文件损坏:
SQL> shutdown immediate;
oracle@readerlogdb-> mv tbs_tbs.dbf tbs_tbs.dbf.bak
oracle@readerlogdb-> mv control01.ctl control01.ctl.bak
oracle@readerlogdb-> mv control02.ctl control02.ctl.bak
oracle@readerlogdb-> mv control03.ctl control03.ctl.bak
SQL> startup;
ORACLE instance started.
Total System Global Area 5049942016 bytes
Fixed Size 2090880 bytes
Variable Size 1375733888 bytes
Database Buffers 3657433088 bytes
Redo Buffers 14684160 bytes
ORA-00205: error in identifying control file, check alert log for more info
这个门用的是刚才备份的脚本新建,可见里面无 tbs_tbs这个数据文件:
SQL>CREATE CONTROLFILE REUSE DATABASE "SKYREAD" NORESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 20
MAXLOGMEMBERS 5
MAXDATAFILES 1000
MAXINSTANCES 8
MAXLOGHISTORY 2337
LOGFILE
GROUP 1 '/database/oradata/skyread/redo01.log' SIZE 512M,
GROUP 2 '/database/oradata/skyread/redo02.log' SIZE 512M,
GROUP 3 '/database/oradata/skyread/redo03.log' SIZE 512M,
GROUP 4 '/database/oradata/skyread/redo04.log' SIZE 512M,
GROUP 5 '/database/oradata/skyread/redo05.log' SIZE 512M