爬虫网站开发,公司常用网站开发软件,小程序代理合同范本,组合图片可以用在网站做链接吗二、有rman备份的恢复 2.1 只损坏一个控制文件的情况 本文档的恢复场景都是针对的多控制文件的情况#xff0c;如果你只有一个那当我没说#x1f604;。 查看控制文件
SQL show parameter control_files;NAME TYPE VALUE
---------------------…二、有rman备份的恢复 2.1 只损坏一个控制文件的情况 本文档的恢复场景都是针对的多控制文件的情况如果你只有一个那当我没说。 查看控制文件
SQL show parameter control_files;NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /oracle/app/oradata/orcl/control01.ctl, /oracle/app/oradata/orcl/control02.ctl模拟破坏
[oracleredhat11g8 orcl]$ echo /oracle/app/oradata/orcl/control01.ctl后台日志可以看到会报控制文件有坏块但是实例还没有宕
Errors in file /oracle/app/diag/rdbms/orcl/orcl/trace/orcl_ckpt_30033.trc (incident38401):
ORA-00227: corrupt block detected in control file: (block 1, # blocks 1)
ORA-00202: control file: /oracle/app/oradata/orcl/control01.ctl做一次检查点切换
SQL alter system checkpoint;
alter system checkpoint
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 26789
Session ID: 153 Serial number: 2627后台日志显示实例被异常终止
CKPT (ospid: 30033): terminating the instance due to error 227
Wed Feb 13 08:20:11 2019
System state dump requested by (instance1, osid30033 (CKPT)), summary[abnormal instance termination].
System State dumped to trace file /oracle/app/diag/rdbms/orcl/orcl/trace/orcl_diag_30021_20190213082011.trc
Dumping diagnostic data in directory[cdmp_20190213082011], requested by (instance1, osid30033 (CKPT)), summary[abnormal instance termination].
Instance terminated by CKPT, pid 30033恢复方法
cp control02.ctl control01.ctl然后重新startup实例运行正常。
2.2 所有控制文件都损坏的情况 模拟破坏
[oracleredhat11g8 orcl]$ echo control01.ctl
[oracleredhat11g8 orcl]$ echo control02.ctl
SQL alter system checkpoint;
alter system checkpoint
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 26927
Session ID: 135 Serial number: 13后台日志情况和前面一样在发生检查点切换后实例就宕了。
恢复方法
RMAN restore controlfile from /home/oracle/rman/full_08tpot0t_1_1;Starting restore at 13-FEB-19
using channel ORA_DISK_1channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name/oracle/app/oradata/orcl/control01.ctl
output file name/oracle/app/oradata/orcl/control02.ctl
Finished restore at 13-FEB-19RMAN recover database;//对控制文件进行归档redo恢复
RMAN alter database open resetlogs;database opened三、没有rman备份的恢复
[oracleredhat11g8 orcl]$ echo control01.ctl
[oracleredhat11g8 orcl]$ echo control02.ctl
[oracleredhat11g8 orcl]$ !sql
sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Wed Feb 13 08:59:38 2019Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL alter system checkpoint;
alter system checkpoint
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 27123
Session ID: 72 Serial number: 3恢复方法若是还能mount的话倒简单alter database backup controlfile to trace as /tmp/ctl.txt;即可如果不能mount的话只能麻烦点恢复
通过参数文件获取数据库名
SQL startup nomount;
ORACLE instance started.Total System Global Area 2471931904 bytes
Fixed Size 2255752 bytes
Variable Size 620758136 bytes
Database Buffers 1845493760 bytes
Redo Buffers 3424256 bytes
SQL create pfile/tmp/orcl.ora from spfile;File created.*.db_nameorcl查询字符集
SQL select userenv(language) from dual;USERENV(LANGUAGE)
----------------------------------------------------
AMERICAN_AMERICA.US7ASCII获取数据文件名和redo文件名
[oracleredhat11g8 orcl]$ ls -lh *.dbf
-rw-r-----. 1 oracle oinstall 254M Feb 13 08:54 jason01.dbf
-rw-r-----. 1 oracle oinstall 101M Feb 13 08:54 odc01.dbf
-rw-r-----. 1 oracle oinstall 1.3G Feb 13 08:54 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 781M Feb 13 08:54 system01.dbf
-rw-r-----. 1 oracle oinstall 9.9G Feb 13 08:54 temp01.dbf
-rw-r-----. 1 oracle oinstall 11M Feb 3 06:50 temp02.dbf
-rw-r-----. 1 oracle oinstall 2.6G Feb 13 08:54 test.dbf
-rw-r-----. 1 oracle oinstall 1.9G Feb 13 08:54 undotbs01.dbf
-rw-r-----. 1 oracle oinstall 11G Feb 13 08:54 users01.dbf[oracleredhat11g8 orcl]$ ls -lh *.log
-rw-r-----. 1 oracle oinstall 51M Feb 13 08:54 redo01.log
-rw-r-----. 1 oracle oinstall 51M Feb 13 08:54 redo02.log
-rw-r-----. 1 oracle oinstall 51M Feb 13 08:59 redo03.log编写重建脚本(注意临时文件不要写进重建脚本里不然会报如下错误)
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01160: file is not a data file
ORA-01110: data file : /oracle/app/oradata/orcl/temp01.dbfCREATE CONTROLFILE REUSE DATABASE ORCL RESETLOGS ARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100MAXINSTANCES 8MAXLOGHISTORY 292
LOGFILEGROUP 1 /oracle/app/oradata/orcl/redo01.log SIZE 50M BLOCKSIZE 512,GROUP 2 /oracle/app/oradata/orcl/redo02.log SIZE 50M BLOCKSIZE 512,GROUP 3 /oracle/app/oradata/orcl/redo03.log SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE/oracle/app/oradata/orcl/jason01.dbf,/oracle/app/oradata/orcl/odc01.dbf,/oracle/app/oradata/orcl/sysaux01.dbf,/oracle/app/oradata/orcl/system01.dbf,/oracle/app/oradata/orcl/test.dbf,/oracle/app/oradata/orcl/undotbs01.dbf,/oracle/app/oradata/orcl/users01.dbf
CHARACTER SET US7ASCII
;SQL alter database open resetlogs;Database altered.四、注意事项 1、除了2.1这种通过cp另一个控制文件恢复的情景其他情景都需要在恢复完后做一个RMAN全备份因为resetlogs打开后之前的备份片都会失效。
2、控制文件最好能做冗余就算坏了一个还可以用另一个恢复。