博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle Study之--Oracle RAC重建控制文件
阅读量:7236 次
发布时间:2019-06-29

本文共 8156 字,大约阅读时间需要 27 分钟。

系统环境:

操作系统: AIX5.3

Cluster:  Oracle 10gR2 CRS

Oracle:   Oracle 10gR2

  在RAC环境下重建控制文件和在单实例上类似,只是有些步骤需要注意:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[oracle@aix211 ~]$cat mkln.sh 
ln -s /dev/rsystem           /u01/app/oracle/oradata/prod/system01.dbf
ln -s /dev/rsysaux           /u01/app/oracle/oradata/prod/sysaux01.dbf
ln -s /dev/rusers            /u01/app/oracle/oradata/prod/users01.dbf
ln -s /dev/rundotbs1         /u01/app/oracle/oradata/prod/undotbs01.dbf 
ln -s /dev/rundotbs2         /u01/app/oracle/oradata/prod/undotbs02.dbf
ln -s /dev/rtemp             /u01/app/oracle/oradata/prod/temp01.dbf
ln -s /dev/rcontrol1_1         /u01/app/oracle/oradata/prod/control01.ctl
ln -s /dev/rcontrol2_2         /u01/app/oracle/oradata/prod/control02.ctl
ln -s /dev/rcontrol3_3         /u01/app/oracle/oradata/prod/control03.ctl
ln -s /dev/rredo1_1          /u01/app/oracle/oradata/prod/log11.log
ln -s /dev/rredo1_2          /u01/app/oracle/oradata/prod/log12.log
ln -s /dev/rredo2_1          /u01/app/oracle/oradata/prod/log21.log
ln -s /dev/rredo2_2          /u01/app/oracle/oradata/prod/log22.log
ln -s /dev/rindex            /u01/app/oracle/oradata/prod/index01.dbf
ln -s /dev/rspfile           /u01/app/oracle/oradata/prod/spfile01
ln -s /dev/rexample          /u01/app/oracle/oradata/prod/example01.dbf

   Database存储在在RAW上。

1、首先在一个节点备份controlfile

1
2
3
4
5
6
7
8
9
10
11
12
13
[oracle@aix201 ~]$sqlplus 
'/as sysdba'
SQL*Plus: Release 
10.2.
0.1.
0 
- Production 
on 
Mon Mar 
23 
16
:
16
:
07 
2015
Copyright (c) 
1982
2005
, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 
10.2.
0.1.
0 
- 64bit Production
With the Partitioning, Real Application Clusters, OLAP 
and 
Data Mining options
 
SQL> select status 
from 
v$instance;
STATUS
------------
OPEN
SQL> alter database backup controlfile to trace;
Database altered.

2、查看控制文件的trace备份(udump)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
CREATE CONTROLFILE REUSE DATABASE 
"PROD" 
NORESETLOGS  NOARCHIVELOG
    
MAXLOGFILES 
192
    
MAXLOGMEMBERS 
3
    
MAXDATAFILES 
1024
    
MAXINSTANCES 
32
    
MAXLOGHISTORY 
292
LOGFILE
  
GROUP 
1 
'/u01/app/oracle/oradata/prod/log11.log'  
SIZE 50M,
  
GROUP 
2 
'/u01/app/oracle/oradata/prod/log12.log'  
SIZE 50M,
  
GROUP 
3 
'/u01/app/oracle/oradata/prod/log21.log'  
SIZE 50M,
  
GROUP 
4 
'/u01/app/oracle/oradata/prod/log22.log'  
SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  
'/u01/app/oracle/oradata/prod/system01.dbf'
,
  
'/u01/app/oracle/oradata/prod/undotbs01.dbf'
,
  
'/u01/app/oracle/oradata/prod/sysaux01.dbf'
,
  
'/u01/app/oracle/oradata/prod/users01.dbf'
,
  
'/u01/app/oracle/oradata/prod/example01.dbf'
,
  
'/u01/app/oracle/oradata/prod/undotbs02.dbf'
CHARACTER SET ZHS16GBK
;

3、关闭database,启动其中一个instance到弄mount

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
SQL> startup nomount;
ORACLE instance started.
Total System Global Area  
612368384 
bytes
Fixed Size                  
2022832 
bytes
Variable Size             
184549968 
bytes
Database Buffers          
423624704 
bytes
Redo Buffers                
2170880 
bytes
 
SQL> @/home/oracle/cr_ctr.sql
CREATE CONTROLFILE REUSE DATABASE 
"PROD" 
NORESETLOGS  NOARCHIVELOG
*
ERROR 
at 
line 
1
:
ORA
-01503
: CREATE CONTROLFILE failed
ORA
-12720
: operation requires database is 
in 
EXCLUSIVE mode
SQL> show parameter cluster
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean     TRUE
cluster_database_instances           integer     
2
cluster_interconnects                string
 
---创建失败,原因是在RAC下控制文件时处于共享(share)模式,需启动到独立(
exclusive
)模式,才能重建;修改cluster_database 为
false
,然后重建

重新建立控制文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
SQL> alter system set cluster_database =
false 
scope=spfile;
System altered.
SQL> startup nomount
ORACLE instance started.
Total System Global Area  
612368384 
bytes
Fixed Size                  
2022832 
bytes
Variable Size             
184549968 
bytes
Database Buffers          
423624704 
bytes
Redo Buffers                
2170880 
bytes
 
SQL> show parameter cluster
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean     FALSE
cluster_database_instances           integer     
1
cluster_interconnects                string
 
SQL> @/home/oracle/cr_ctr.sql
Control file created.
 
告警日志:
alter.log:
Mon Mar 
23 
16
:
41
:
00 
2015
CREATE CONTROLFILE REUSE DATABASE 
"PROD" 
NORESETLOGS  NOARCHIVELOG
    
MAXLOGFILES 
192
    
MAXLOGMEMBERS 
3
    
MAXDATAFILES 
1024
    
MAXINSTANCES 
32
    
MAXLOGHISTORY 
292
LOGFILE
  
GROUP 
1 
'/u01/app/oracle/oradata/prod/log11.log'  
SIZE 50M,
  
GROUP 
2 
'/u01/app/oracle/oradata/prod/log12.log'  
SIZE 50M,
  
GROUP 
3 
'/u01/app/oracle/oradata/prod/log21.log'  
SIZE 50M,
  
GROUP 
4 
'/u01/app/oracle/oradata/prod/log22.log'  
SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  
'/u01/app/oracle/oradata/prod/system01.dbf'
,
  
'/u01/app/oracle/oradata/prod/undotbs01.dbf'
,
  
'/u01/app/oracle/oradata/prod/sysaux01.dbf'
,
  
'/u01/app/oracle/oradata/prod/users01.dbf'
,
  
'/u01/app/oracle/oradata/prod/example01.dbf'
,
  
'/u01/app/oracle/oradata/prod/undotbs02.dbf'
CHARACTER SET ZHS16GBK
Mon Mar 
23 
16
:
41
:
00 
2015
WARNING: Default Temporary Tablespace 
not 
specified 
in 
CREATE DATABASE command
Default Temporary Tablespace will be necessary 
for 
a locally managed database 
in 
future release
WARNING: You are creating/reusing datafile /u01/app/oracle/oradata/prod/control01.ctl.
WARNING: Oracle recommends creating 
new 
datafiles 
on 
devices 
with 
zero offset. The command 
"/usr/sbin/mklv -y LVname -T O -w n -s n -r n VGname NumPPs" 
can be used. Please contact Oracle customer support 
for 
more details.
WARNING: You are creating/reusing datafile /u01/app/oracle/oradata/prod/control01.ctl.
WARNING: Oracle recommends creating 
new 
datafiles 
on 
devices 
with 
zero offset. The command 
"/usr/sbin/mklv -y LVname -T O -w n -s n -r n VGname NumPPs" 
can be used. Please contact Oracle customer support 
for 
more details.
WARNING: You are creating/reusing datafile /u01/app/oracle/oradata/prod/control02.ctl.
WARNING: Oracle recommends creating 
new 
datafiles 
on 
devices 
with 
zero offset. The command 
"/usr/sbin/mklv -y LVname -T O -w n -s n -r n VGname NumPPs" 
can be used. Please contact Oracle customer support 
for 
more details.
WARNING: You are creating/reusing datafile /u01/app/oracle/oradata/prod/control02.ctl.
WARNING: Oracle recommends creating 
new 
datafiles 
on 
devices 
with 
zero offset. The command 
"/usr/sbin/mklv -y LVname -T O -w n -s n -r n VGname NumPPs" 
can be used. Please contact Oracle customer support 
for 
more details.
Setting recovery target incarnation to 
1
Mon Mar 
23 
16
:
41
:
05 
2015
Successful mount of redo thread 
1
with 
mount id 
286981148
Mon Mar 
23 
16
:
41
:
05 
2015
Completed: CREATE CONTROLFILE REUSE DATABASE 
"PROD" 
NORESETLOGS  NOARCHIVELOG
    
MAXLOGFILES 
192
    
MAXLOGMEMBERS 
3
    
MAXDATAFILES 
1024
    
MAXINSTANCES 
32
    
MAXLOGHISTORY 
292
LOGFILE
  
GROUP 
1 
'/u01/app/oracle/oradata/prod/log11.log'  
SIZE 50M,
  
GROUP 
2 
'/u01/app/oracle/oradata/prod/log12.log'  
SIZE 50M,
  
GROUP 
3 
'/u01/app/oracle/oradata/prod/log21.log'  
SIZE 50M,
  
GROUP 
4 
'/u01/app/oracle/oradata/prod/log22.log'  
SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  
'/u01/app/oracle/oradata/prod/system01.dbf'
,
  
'/u01/app/oracle/oradata/prod/undotbs01.dbf'
,
  
'/u01/app/oracle/oradata/prod/sysaux01.dbf'
,
  
'/u01/app/oracle/oradata/prod/users01.dbf'
,
  
'/u01/app/oracle/oradata/prod/example01.dbf'
,
  
'/u01/app/oracle/oradata/prod/undotbs02.dbf'
CHARACTER SET ZHS16GBK

4、重建成功,启动到open

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
SQL> select status 
from 
v$instance;
STATUS
------------
MOUNTED
 
SQL> alter database open;
Database altered.
 
添加临时表空间数据文件:
SQL> select name 
from 
v$tempfile;
no rows selected
 
SQL> select tablespace_name 
from 
dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
TEMP
USERS
UNDOTBS2
EXAMPLE
7 
rows selected.
 
SQL> alter tablespace temp add 
  
2  
tempfile 
'/u01/app/oracle/oradata/prod/temp01.dbf' 
size 100m reuse;
Tablespace altered.
SQL>  select name 
from 
v$tempfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prod/temp01.dbf

5、修改cluster_database参数,启动所有instance

1
2
SQL> alter system set cluster_database =
true 
scope=spfile;
System altered.

启动所有Instance,如果所有instance启动成功,则controlfile重建成功。

本文转自 客居天涯 51CTO博客,原文链接:http://blog.51cto.com/tiany/1623515,如需转载请自行联系原作者
你可能感兴趣的文章
Web App开发入门
查看>>
PHP实现金额数字转换成大写函数
查看>>
QQ空间HD(1)-UIPopoverController基本使用
查看>>
虚拟互换(virtual swap)
查看>>
点滴记录——在Ubuntu 14.04中使SublimeText 3支持中文输入法
查看>>
ARP欺骗病毒,网页“篡改”,注入iframe代码!
查看>>
IE读取并显示本地图像文件的方法
查看>>
自学android半年,已从.net转型成android程序员,分享下这个过程
查看>>
ImageView显示网络图片
查看>>
linux防止sshd被爆破(安装denyhosts)
查看>>
【P4语言学习】Parser解析器
查看>>
python问题:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'(转)
查看>>
测试人员职业规划
查看>>
Twenty Newsgroups Classification任务之二seq2sparse(3)
查看>>
教育单元测试mock框架优化之路(中)
查看>>
网易老司机:网络性能问题该怎样监控与定位?
查看>>
为什么LinkedIn放弃MySQL slowlog,转用基于网络层的慢查询分析器?
查看>>
何小鹏:跟李斌赌输了 将付一辆ES8顶配的购车款给对方
查看>>
OPPO R11继续升温,8月8日将推出巴萨定制机
查看>>
从主流厂商宣传语看中国CRM领域的发展
查看>>