问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

如何重建RAC的控制文件

发布网友 发布时间:2022-04-13 16:51

我来回答

1个回答

热心网友 时间:2022-04-13 18:20

环境:
OS:Red Hat Linux As 5
DB:10.2.0.4

在全部控制文件丢失或损坏,而且没有备份的情况下,可以使用重建控制文件的办法打开数据库.以下模拟所有的控制文件丢失的情况下重建控制文件.

1.备份控制文件(数据库mount或是open状态)
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL>alter database backup controlfile to trace as '/u01/ftp/bak_controlfile';

2.删除控制文件
[oracle@hxl oracl]$ rm control01.ctl
rm: remove regular file `control01.ctl'? y
[oracle@hxl oracl]$ rm control02.ctl
rm: remove regular file `control02.ctl'? y
[oracle@hxl oracl]$ rm control03.ctl
rm: remove regular file `control03.ctl'? y

3.关闭数据库后尝试打开数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 734003200 bytes
Fixed Size 1221564 bytes
Variable Size 218106948 bytes
Database Buffers 511705088 bytes
Redo Buffers 2969600 bytes
ORA-00205: error in identifying control file, check alert log for more info
这个时候数据无法打开,以为我们已经删除了控制文件.

4.查看备份控制文件的内容
[oracle@hxl ftp]$ more bak_controlfile
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="oracl"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_10='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_10='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_10='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_10='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_10=ENABLE
--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
-- 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 "ORACL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/oracl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/oracl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/oracl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf',
'/u01/app/oracle/oradata/oracl/undotbs01.dbf',
'/u01/app/oracle/oradata/oracl/sysaux01.dbf',
'/u01/app/oracle/oradata/oracl/users01.dbf'
CHARACTER SET WE8ISO8859P1
;
-- 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/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/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
-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- 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/oracl/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
-- Set #2. RESETLOGS 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.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- 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 "ORACL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/oracl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/oracl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/oracl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf',
'/u01/app/oracle/oradata/oracl/undotbs01.dbf',
'/u01/app/oracle/oradata/oracl/sysaux01.dbf',
'/u01/app/oracle/oradata/oracl/users01.dbf'
CHARACTER SET WE8ISO8859P1
;
-- 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/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/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 USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- 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/oracl/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
5.从备份控制文件中提取我们需要的部分,这里我们选择RESETLOGS,将如下内容保存文件为
create_confile.sql

CREATE CONTROLFILE REUSE DATABASE "ORACL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/oracl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/oracl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/oracl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf',
'/u01/app/oracle/oradata/oracl/undotbs01.dbf',
'/u01/app/oracle/oradata/oracl/sysaux01.dbf',
'/u01/app/oracle/oradata/oracl/users01.dbf'
CHARACTER SET WE8ISO8859P1
;

6.执行create_confile.sql
SQL>set sqlblanklines on -- 因为文件中有空行,需要将该选项打开,否则执行的时候报语法错误
SQL>@/u01/ftp/create_confile.sql

SQL> alter database open resetlogs;
Database altered.

说明:
重建控制文件后,若备份信息是存储在控制文件的,该信息会丢失.
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
平方公里与亩有什么区别? 申请名称预先核准应提交哪些档 申请名称预先核准应提交哪些资料 申请名称预先核准需要哪些资料 如何隐藏iphonex的刘海? 07款凯美瑞遥控怎么换电池 金针云耳蒸滑鸡做法 爱奇艺VIP会员有哪些免费领取或者低价购买的渠道?持续更新中_百度知 ... 吸尘器应该怎么选?全屋灰尘清洁神器——追觅 V16 吸尘器深度测评 两个长方形重叠部分的面积相当于小长方形面积的4分之1,相当于大的6分... 中国银行网上银行的密码是什么组成的 去德国留学应该办什么信用卡 德国留学生关于国际卡的问题 到德国留学办什么样的银行卡好 中国德国留学生办什么银行卡比较好 去德国留学,我想先在国内中国银行办银行卡 德国留学前去德意志银行开户需注意的问题有哪些 淘宝签到红包退货支付宝还要扣钱吗? 那个淘宝左上角有和我一样签到领的是支付宝现金的吗?开通了芝麻GO可提现到支付宝,但签到中断会扣回去 电脑运行是突然黑屏,显示器出现几个英文no signal 支付宝和淘宝中的集分宝怎么得到?可以签到得到吗? 我的电脑黑屏出现字母 NO SIGNAL 该怎么解决啊!急!!! 我的集分宝想每天签到,但是显示账号未绑定支付宝,怎样绑定支付宝? 显示器黑屏显示VGA no signal 请问去德国留学要办什么卡好? nosignal是什么意思怎样解决?为什么电脑开机显示屏是黑屏? 我家电脑打开出现No signal.然后就黑屏,指示灯橙色? 为什么指甲上有小坑? 巧克力碰到水为什么会反砂 如何诊断RAC数据库上的“IPC Send timeout”问题 c语言中%3d是什么意思? 那里有监控摄像头组装的原材料 有没有哪里可以提供监控摄像头组装配件的,我想自己组装摄像头 元气盲盒抽中手机技巧 自己组装一套监控,需要什么?最好有主机和摄像头推荐.摄像头要清晰点的 支付宝将银行卡解绑后如何重新绑定? 我想安装4个监控摄像头,需要什么装备。 元气部落盲盒属于哪家公司 联想平板电脑怎么下微信版问道手游 元气玛特和泡泡玛特的关系 电脑下载问道怎么安装 在元气部落买了各潮电玩家盲盒被坑? 元气玛特怎么退款 如何评价综艺《夏日少年派》? 在哪里下载问道!下载完了以后可以安装,玩的!准确点的网子! 怎么下载 问道小秘书 宜丰有什么景点 有哪些适合女孩子(初中生)看的小说......要校园类的哦!谢谢各位啦 适合初中女生看的书 八个小时用导航能消耗多少流量?