-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.xml
637 lines (402 loc) · 238 KB
/
atom.xml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>ShijieQin</title>
<link href="/atom.xml" rel="self"/>
<link href="https://shijieqin.github.io/"/>
<updated>2019-01-08T02:31:53.000Z</updated>
<id>https://shijieqin.github.io/</id>
<author>
<name>Shijie Qin</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>kube-scheduler</title>
<link href="https://shijieqin.github.io/2019/01/08/kube-scheduler/"/>
<id>https://shijieqin.github.io/2019/01/08/kube-scheduler/</id>
<published>2019-01-08T02:31:53.000Z</published>
<updated>2019-01-08T02:31:53.000Z</updated>
<content type="html"><![CDATA[<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>只是为了便于自己理解和记忆做的记录,大多摘自网站 <a href="https://feisky.xyz/kubernetes-handbook/" target="_blank" rel="external">https://feisky.xyz/kubernetes-handbook/</a></p><h3 id="kube-scheduler"><a href="#kube-scheduler" class="headerlink" title="kube-scheduler"></a>kube-scheduler</h3><p>kube-scheduler 负责分配调度 Pod 到集群内的节点上,它监听 kube-apiserver,查询还未分配 Node 的 Pod,然后根据调度策略为这些 Pod 分配节点(更新 Pod 的 <code>NodeName</code> 字段)。</p><p>调度器需要充分考虑诸多的因素:</p><ul><li>公平调度</li><li>资源高效利用</li><li>QoS</li><li>affinity 和 anti-affinity</li><li>数据本地化(data locality)</li><li>内部负载干扰(inter-workload interference)</li><li>deadlines</li></ul><h3 id="指定-Node-节点调度"><a href="#指定-Node-节点调度" class="headerlink" title="指定 Node 节点调度"></a>指定 Node 节点调度</h3><blockquote class="pullquote mindmap"><p>#主题</p><p>##一级分支</p><p>###二级分支</p><p>##一级分支</p><p>##一级分支</p><p>###二级分支</p><p>####三级分支</p></blockquote>]]></content>
<summary type="html">
<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>只是为了便于自己理解和记忆做的记录,大多摘自网站 <a href="https://feisky.xyz/kubernetes-handbo
</summary>
<category term="k8s学习笔记" scheme="https://shijieqin.github.io/categories/k8s%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/"/>
<category term="k8s" scheme="https://shijieqin.github.io/tags/k8s/"/>
</entry>
<entry>
<title>tomcat为什么会内存溢出</title>
<link href="https://shijieqin.github.io/2018/12/06/tomcat%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BC%9A%E5%86%85%E5%AD%98%E6%BA%A2%E5%87%BA/"/>
<id>https://shijieqin.github.io/2018/12/06/tomcat为什么会内存溢出/</id>
<published>2018-12-06T01:59:56.000Z</published>
<updated>2018-12-06T01:59:56.000Z</updated>
<content type="html"><![CDATA[<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><h3 id="1-OutOfMemoryError:-Java-heap-space"><a href="#1-OutOfMemoryError:-Java-heap-space" class="headerlink" title="1. OutOfMemoryError: Java heap space"></a>1. OutOfMemoryError: Java heap space</h3><p>这个应该是是最常见的内存溢出报错。</p><p>例子:</p><p>沙县小吃大厅=heap space;坐下吃饭=正常的业务请求;吃饭完离开=业务请求结束;打扫餐桌=GC内存回收</p><p>需要明确的:</p><ul><li>大厅容量有限,因此能放下的桌子是有限的</li><li>不能让食客坐有上一个食客吃完之后还未清理的桌子</li><li>食客用餐期间不能清理食客的桌子</li><li>打扫桌子是服务员定时的或在没有桌子可用的时候进行打扫</li><li>没桌子可用是打扫桌子需要等所有能打扫的桌子打扫完之后才能继续提供服务</li><li>不可能让食客吃完之后顺便打扫桌子</li></ul><p>好,以上明确之后,我们来用这个例子说明Java heap space溢出的问题</p><p>讲解:</p><p>正常情况下食客来吃沙县小吃 –> 老板招待食客坐下 –> 食客点餐,吃饭</p><p> –> 食客离开 –> 老板定时收拾桌子。</p><p>上面的情况是正常的情况,一切看着都是在有序的进行。有一天,可能是由于这个沙县小吃做的比较好吃,突然火了,成网红店了,食客突然增多了。店面还是那个店面,桌子数量还是那么多,来一个食客坐下吃饭,再来一个食客坐下吃饭。食客吃完,走了,打扫桌子,接待下一个顾客。可是一下进来吃饭的人太多,桌子被占满了,又有食客来了,完了,没地方坐了,这时候没办法,暂停接待客人,让食客等着,开始打扫桌子,后面陆续有食客来,还得让食客等着,排的队越来越长,等待时间也越来越长,长到超过食客忍耐的极限,就相当于tomcat访问不了了。</p><p>其实会发现,问题很简单,就是能接待的食客数量低于要来吃饭的食客数量。</p><p>可能有人会说,店面扩大点,多摆点桌子就好了,这其实就相当于增大heap space。是,这确实是一个解决方法,但那样的话有三个问题:</p><ol><li>成本会增加很多</li><li>可用土地面积就那么大了,店面不允许扩大了</li><li>增加桌子数量之后,还是不够,等桌子占满的时候,开始暂停接待客人,进行全面打扫,由于桌子面积不变,桌子数量增多,全部打扫完的时间也就变长,因此暂停接待的时间就增加了,体验也不好。</li></ol><p>这时候有第二种方案,减小桌子大小,比如之前只有8人桌,来一个人也得坐8人桌,所以可以接待的客人就少了。那我优化下,去掉一些8人桌,换成4人桌和2人桌,是不是可以接待的客人就多了?最后发现不能再减小桌子大小了,怎么办,开分店!有钱了,任性了,开分店。</p><p>这就是方案三了,开了分店之后,相应的能接待的人就多了。</p>]]></content>
<summary type="html">
<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><h3 id="1-OutOfMemoryError:-Java-heap-space"><a href="#1-OutOfMemoryError
</summary>
<category term="答女朋友问" scheme="https://shijieqin.github.io/categories/%E7%AD%94%E5%A5%B3%E6%9C%8B%E5%8F%8B%E9%97%AE/"/>
<category term="tomcat" scheme="https://shijieqin.github.io/tags/tomcat/"/>
<category term="内存" scheme="https://shijieqin.github.io/tags/%E5%86%85%E5%AD%98/"/>
</entry>
<entry>
<title>oracle12.2rac新增节点后出现undo被占用</title>
<link href="https://shijieqin.github.io/2018/11/29/oracle12-2rac%E6%96%B0%E5%A2%9E%E8%8A%82%E7%82%B9%E5%90%8E%E5%87%BA%E7%8E%B0undo%E8%A2%AB%E5%8D%A0%E7%94%A8/"/>
<id>https://shijieqin.github.io/2018/11/29/oracle12-2rac新增节点后出现undo被占用/</id>
<published>2018-11-29T02:03:27.000Z</published>
<updated>2018-11-29T02:03:27.000Z</updated>
<content type="html"><![CDATA[<h3 id="描述"><a href="#描述" class="headerlink" title="描述"></a>描述</h3><p>ORACLE 12.2 rac环境下新增一个节点之后,新增节点上的PDB启动失败。下面简单记录下解决问题的过程,有时间再详细梳理。</p><a id="more"></a><h3 id="解决过程"><a href="#解决过程" class="headerlink" title="解决过程"></a>解决过程</h3><p>表象:<br> 节点创建成功后,泰尔和海银的PDB不能open,会报某个undo表空间被占用。<br> 拓邦启动之后自动变为受限模式</p><p>解决过程:</p><ol><li>undo被占用,先考虑了新增节点的默认undo是否是执行被占用undo的,发现不是,都有自己的默认undo表空间</li><li>考虑能否释放undo,PDB1被占用的undo不是任何节点的默认undo,因此考虑删除,发现删除不掉,有未提交事务(这个问题没解决)</li><li>PDB2被占用的undo是节点2使用的undo,考虑替换undo之后,无法删除被占用的undo</li><li>开始考虑为什么节点三的pdb会去用其他的undo表空间,理论上应该用自己的undo表空间</li><li>在可用节点查看已存在的undo,发现节点三的undo表空间不存在</li><li>查看alert日志,发现在实例创建时,节点3的undo表空间创建失败</li><li>怀疑是因为节点三的undo创建失败,自动去查找已存在的<em>.undo。(注意,是</em>.undo,还需要验证,不过PDB3的也创建失败,但是没有尝试使用其他节点的undo,而是启动为受限模式了,并且每次启动都会尝试去创建undo),创建不成功,会在alert报错</li><li>手动创建节点三的undo,并重新制定给节点三,启动成功,问题解决。</li></ol>]]></content>
<summary type="html">
<h3 id="描述"><a href="#描述" class="headerlink" title="描述"></a>描述</h3><p>ORACLE 12.2 rac环境下新增一个节点之后,新增节点上的PDB启动失败。下面简单记录下解决问题的过程,有时间再详细梳理。</p>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="undo" scheme="https://shijieqin.github.io/categories/oracle/undo/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="RAC" scheme="https://shijieqin.github.io/tags/RAC/"/>
<category term="UNDO" scheme="https://shijieqin.github.io/tags/UNDO/"/>
<category term="ISSUE" scheme="https://shijieqin.github.io/tags/ISSUE/"/>
</entry>
<entry>
<title>python常见错误</title>
<link href="https://shijieqin.github.io/2018/08/29/python%E5%B8%B8%E8%A7%81%E9%94%99%E8%AF%AF/"/>
<id>https://shijieqin.github.io/2018/08/29/python常见错误/</id>
<published>2018-08-29T02:43:48.000Z</published>
<updated>2018-08-29T02:43:48.000Z</updated>
<content type="html"><![CDATA[<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>记录一些奇葩问题</p><h3 id="Python-List-遍历"><a href="#Python-List-遍历" class="headerlink" title="Python List 遍历"></a>Python List 遍历</h3><h4 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">alist=[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>]</div><div class="line"><span class="keyword">for</span> i <span class="keyword">in</span> alist:</div><div class="line"> <span class="keyword">print</span> i</div><div class="line"> alist.remove(i) </div><div class="line"><span class="number">1</span></div><div class="line"><span class="number">3</span></div><div class="line"><span class="number">5</span></div></pre></td></tr></table></figure><h4 id="原因"><a href="#原因" class="headerlink" title="原因"></a>原因</h4><p>使用<code>for i in list</code>的方式遍历列表时,使用的是下标操作,remove使用的是值操作,最初alist的值为[1,2,3,4,5,6]</p><p>循环的第一次,下标指向0,此时打印出来的值为1,执行remove之后,列表变为[2,3,4,5,6]</p><p>此时进行循环的第二次的时候,下标为1,但是alist列表下标为1的位置的值变为了3</p><p>后面以此类推。</p>]]></content>
<summary type="html">
<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>记录一些奇葩问题</p>
<h3 id="Python-List-遍历"><a href="#Python-List-遍历" class="
</summary>
<category term="python" scheme="https://shijieqin.github.io/categories/python/"/>
<category term="python" scheme="https://shijieqin.github.io/tags/python/"/>
</entry>
<entry>
<title>brainwave</title>
<link href="https://shijieqin.github.io/2018/06/26/brainwave/"/>
<id>https://shijieqin.github.io/2018/06/26/brainwave/</id>
<published>2018-06-26T03:00:37.000Z</published>
<updated>2018-06-26T03:00:37.000Z</updated>
<content type="html"><![CDATA[<h3 id="待研究"><a href="#待研究" class="headerlink" title="待研究"></a>待研究</h3><ul><li><a href="https://docs.oracle.com/en/database/oracle/oracle-database/18/bradv/rman-performing-flashback-dbpitr.html#GUID-A7D05B55-F5EA-46BC-A025-09F423349BAF" target="_blank" rel="external">Flashback Table</a></li><li><a href="">UNDO_RETENTION</a></li><li><a href="https://docs.oracle.com/en/database/oracle/oracle-database/18/bradv/rman-performing-flashback-dbpitr.html#GUID-D953DEDB-4C98-4BA9-B5FE-CCBA68679C3F" target="_blank" rel="external">Flashback Drop</a></li><li><a href="https://docs.oracle.com/en/database/oracle/oracle-database/18/bradv/rman-performing-flashback-dbpitr.html#GUID-6520BA73-8BFF-4D79-9970-589A2FDA0C82" target="_blank" rel="external">Flashback Database</a></li><li><a href="https://docs.oracle.com/en/database/oracle/oracle-database/18/admqs/performing-backup-and-recovery.html#GUID-CBC5870F-2C9A-4F67-B5E9-D65049AD1E8E" target="_blank" rel="external">Media Recovery</a></li><li></li></ul>]]></content>
<summary type="html">
<h3 id="待研究"><a href="#待研究" class="headerlink" title="待研究"></a>待研究</h3><ul>
<li><a href="https://docs.oracle.com/en/database/oracle/oracle-d
</summary>
<category term="brainwave" scheme="https://shijieqin.github.io/categories/brainwave/"/>
<category term="brainwave" scheme="https://shijieqin.github.io/tags/brainwave/"/>
</entry>
<entry>
<title>mysql存储引擎学习笔记</title>
<link href="https://shijieqin.github.io/2018/05/22/mysql%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/"/>
<id>https://shijieqin.github.io/2018/05/22/mysql存储引擎学习笔记/</id>
<published>2018-05-22T01:28:12.000Z</published>
<updated>2018-05-22T01:28:12.000Z</updated>
<summary type="html">
</summary>
<category term="mysql" scheme="https://shijieqin.github.io/tags/mysql/"/>
</entry>
<entry>
<title>delete oracle dg config</title>
<link href="https://shijieqin.github.io/2018/04/24/delete-oracle-dg-config/"/>
<id>https://shijieqin.github.io/2018/04/24/delete-oracle-dg-config/</id>
<published>2018-04-24T08:03:10.000Z</published>
<updated>2018-04-24T08:03:10.000Z</updated>
<content type="html"><![CDATA[<h3 id="简述"><a href="#简述" class="headerlink" title="简述"></a>简述</h3><p>反向操作,取消oracle dataguard,恢复数据库为非dg状态</p><a id="more"></a><h3 id="操作"><a href="#操作" class="headerlink" title="操作"></a>操作</h3><h4 id="主库取消日志传输"><a href="#主库取消日志传输" class="headerlink" title="主库取消日志传输"></a>主库取消日志传输</h4><p>在主库执行</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">alter system set log_archive_dest_state_2=defer;</div><div class="line">alter system set log_archive_dest_2=''</div><div class="line">alter system set log_archive_dest_state_2 = 'enable';</div></pre></td></tr></table></figure><p>备注:在这里,我的dg日志传输的参数配置在log_archive_dest_state_2,具体,根据自己的配置。可使用如下命令查询</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">show parameter log_archive_dest</div></pre></td></tr></table></figure><p><img src="https://ws4.sinaimg.cn/large/006tNc79ly1fqnt7as7pbj317g0acq4v.jpg" alt=""></p><p>找到VALUE 为service的</p><p>前面的NAME 就是该参数名</p><h4 id="主库取消FORCE-LOGGING"><a href="#主库取消FORCE-LOGGING" class="headerlink" title="主库取消FORCE LOGGING"></a>主库取消FORCE LOGGING</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">SQL> ALTER DATABASE NO FORCE LOGGING;</div><div class="line">Database altered.</div><div class="line">SQL> select log_mode,force_logging from v$database;</div><div class="line">LOG_MODE FORCE_LOGGING</div><div class="line">------------------------------------ ---------------------------------------------------------------------------------------------------------------------</div><div class="line">ARCHIVELOG NO</div></pre></td></tr></table></figure><h4 id="主库修改standby-file-management-为MANUAL"><a href="#主库修改standby-file-management-为MANUAL" class="headerlink" title="主库修改standby_file_management 为MANUAL"></a>主库修改standby_file_management 为MANUAL</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set standby_file_management = 'MANUAL';</div><div class="line">System altered.</div><div class="line">SQL> show parameter standby_file_management;</div><div class="line">NAME TYPE VALUE</div><div class="line">------------------------------------ --------------------------------- ------------------------------</div><div class="line">standby_file_management string MANUAL</div></pre></td></tr></table></figure><h4 id="修改归档日志的参数值,删除角色和DB-UNIQUE-NAME的指定"><a href="#修改归档日志的参数值,删除角色和DB-UNIQUE-NAME的指定" class="headerlink" title="修改归档日志的参数值,删除角色和DB_UNIQUE_NAME的指定"></a>修改归档日志的参数值,删除角色和DB_UNIQUE_NAME的指定</h4><p>原值:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">SQL> show parameter log_archive_dest_1</div><div class="line">NAME TYPE VALUE</div><div class="line">------------------------------------ --------------------------------- ------------------------------</div><div class="line">log_archive_dest_1 string LOCATION=+ARCHIVE_LOG VALID_FO</div><div class="line"> R=(ALL_LOGFILES,ALL_ROLES) DB_</div><div class="line"> UNIQUE_NAME=srmcloud</div></pre></td></tr></table></figure><p>改为:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">SQL> show parameter log_archive_dest_1</div><div class="line">NAME TYPE VALUE</div><div class="line">------------------------------------ --------------------------------- ------------------------------</div><div class="line">log_archive_dest_1 string LOCATION=+ARCHIVE_LOG</div></pre></td></tr></table></figure><p>命令:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">alter system set log_archive_dest_1='LOCATION=+ARCHIVE_LOG';</div></pre></td></tr></table></figure><p><strong><em>注:其中的LOCATION根据具体情况修改</em></strong></p><h4 id="设置FAL-SERVER为空"><a href="#设置FAL-SERVER为空" class="headerlink" title="设置FAL_SERVER为空"></a>设置FAL_SERVER为空</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set FAL_SERVER='';</div><div class="line">System altered.</div></pre></td></tr></table></figure><h4 id="设置log-archive-config为空"><a href="#设置log-archive-config为空" class="headerlink" title="设置log_archive_config为空"></a>设置log_archive_config为空</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">alter system set log_archive_config='';</div></pre></td></tr></table></figure><h4 id="删除standby日志组"><a href="#删除standby日志组" class="headerlink" title="删除standby日志组"></a>删除standby日志组</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">SQL> select group#,thread#,sequence#,archived,status from v$standby_log;</div><div class="line"> GROUP# THREAD# SEQUENCE# ARCHIVED STATUS</div><div class="line">---------- ---------- ---------- --------- ------------------------------</div><div class="line"> 11 0 0 YES UNASSIGNED</div><div class="line"> 12 0 0 YES UNASSIGNED</div><div class="line"> 13 0 0 YES UNASSIGNED</div><div class="line"> 14 0 0 YES UNASSIGNED</div><div class="line">SQL> ALTER DATABASE DROP STANDBY LOGFILE GROUP 11;</div><div class="line">Database altered.</div><div class="line">SQL> ALTER DATABASE DROP STANDBY LOGFILE GROUP 12;</div><div class="line">Database altered.</div><div class="line">SQL> ALTER DATABASE DROP STANDBY LOGFILE GROUP 13;</div><div class="line">Database altered.</div><div class="line">SQL> ALTER DATABASE DROP STANDBY LOGFILE GROUP 14;</div><div class="line">Database altered.</div></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h3 id="简述"><a href="#简述" class="headerlink" title="简述"></a>简述</h3><p>反向操作,取消oracle dataguard,恢复数据库为非dg状态</p>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="dg" scheme="https://shijieqin.github.io/categories/oracle/dg/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="dg" scheme="https://shijieqin.github.io/tags/dg/"/>
</entry>
<entry>
<title>oracle 11.2.0.4 RAC PSU PATCH</title>
<link href="https://shijieqin.github.io/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/"/>
<id>https://shijieqin.github.io/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/</id>
<published>2018-03-06T15:02:13.000Z</published>
<updated>2018-03-06T15:02:13.000Z</updated>
<content type="html"><![CDATA[<h3 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h3><table><thead><tr><th>Key</th><th>Value</th></tr></thead><tbody><tr><td>操作系统</td><td>centos 7.4</td></tr><tr><td>数据库版本</td><td>11.2.0.4</td></tr><tr><td>集群</td><td>RAC</td></tr></tbody></table><a id="more"></a><h3 id="下载相关补丁"><a href="#下载相关补丁" class="headerlink" title="下载相关补丁"></a>下载相关补丁</h3><p>使用如下链接下载opatch:</p><p><a href="https://updates.oracle.com/download/6880880.html" target="_blank" rel="external"><strong>Patch 6880880</strong></a></p><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/0E6496DB-55E6-48F7-8A09-FE1B0912270C.png" alt="Patch" title="Patch"><p>使用如下链接下载GI PSU和DB PSU:</p><p><a href="https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=348876990616918&id=2285559.1&_afrWindowMode=0&_adf.ctrl-state=11pj6gra9g_4" target="_blank" rel="external">PSU</a></p><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/62A03F6E-D3BF-43CC-993E-64B7969E611E.png" alt="GIPSU" title="GIPSU"><p>下载最新的GI PSU</p><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/AA5B7B78-6B61-4549-8486-C59D16EA9F19.png" alt="DBPSU" title="DBPSU"><p>下载最新的DB PSU</p><h3 id="阅读GI-PSU的README文档"><a href="#阅读GI-PSU的README文档" class="headerlink" title="阅读GI PSU的README文档"></a>阅读GI PSU的README文档</h3><p>解压p27107360_112040_Linux-x86-64.zip</p><p>阅读<code>27107360</code>下的README.html</p><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/410A9E5C-A7A2-40D5-A463-F1BC94F9DBFD.png" alt="README.html" title="README.html"><p>要求OPatch的版本为11.2.0.3.6或更高</p><p>使用如下命令查看OPatch的版本</p><p><code>$ORACLE_HOME/OPatch/opatch version</code></p><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/65D08584-D9D9-48C6-9749-04120BC956C9.png" alt="version" title="version"><p>版本为11.2.0.3.4,因此需要升级OPatch</p><h3 id="升级OPatch"><a href="#升级OPatch" class="headerlink" title="升级OPatch"></a>升级OPatch</h3><p>两个节点GRID用户和ORACLE用户都做如下操作</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.pre6880880 </div><div class="line">unzip -d $ORACLE_HOME <OPATCH-ZIP_LOCATION>p6880880_112000_Linux-x86-64.zip</div></pre></td></tr></table></figure><h3 id="解压补丁文件"><a href="#解压补丁文件" class="headerlink" title="解压补丁文件"></a>解压补丁文件</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">unzip p27107360_112040_Linux-x86-64.zip</div></pre></td></tr></table></figure><h3 id="检查补丁之间有无冲突"><a href="#检查补丁之间有无冲突" class="headerlink" title="检查补丁之间有无冲突"></a>检查补丁之间有无冲突</h3><p>需要注意grid用户的$ORACLE_HOME 的权限</p><p>使用grid用户和oracle用户执行如下命令检测有无冲突</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cd 27107360</div><div class="line">$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./</div></pre></td></tr></table></figure><p>GRID用户执行结果如下</p><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/E0981114-D126-4DCC-B4C9-367E0178A2C5.png" alt="E0981114-D126-4DCC-B4C9-367E0178A2C5" title="E0981114-D126-4DCC-B4C9-367E0178A2C5"><p>ORACLE用户执行结果如下</p><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/DDF83237-8128-4CE9-B2B9-B89188487CE7.png" alt="DDF83237-8128-4CE9-B2B9-B89188487CE7" title="DDF83237-8128-4CE9-B2B9-B89188487CE7"><h3 id="节点1打补丁"><a href="#节点1打补丁" class="headerlink" title="节点1打补丁"></a>节点1打补丁</h3><p>需要关闭节点1</p><p>grid用户</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /u01/software/gi_psu/27107360/</div></pre></td></tr></table></figure><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/B0EE43C2-0243-4572-B30D-3A7E9C578695.png" alt="1" title="1"><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/0C4D1C68-8A41-456D-A13B-C9074D272051.png" alt="1" title="1"><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/4E2FB3E2-E8B2-4D80-9336-9BA4A931E3B7.png" alt="1" title="1"><p>oracle 用户</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /u01/software/gi_psu/27107360/</div></pre></td></tr></table></figure><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/CAC0761E-F98A-4F5A-8D44-D1E5E358F3C9.png" alt="1" title="1"><p>报错,补丁22502505需要安装11.2.0.4.0的oracle.usm</p><p>这里只需要打26925576即可</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /u01/software/gi_psu/27107360/26925576</div></pre></td></tr></table></figure><p>输出略</p><p>。。。</p><h3 id="节点2打补丁"><a href="#节点2打补丁" class="headerlink" title="节点2打补丁"></a>节点2打补丁</h3><p>与节点1打补丁的操作一模一样</p><p>打完之后启动数据库集群</p><h3 id="升级数据字典"><a href="#升级数据字典" class="headerlink" title="升级数据字典"></a>升级数据字典</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">cd $ORACLE_HOME/rdbms/admin</div><div class="line">sqlplus /nolog</div><div class="line">SQL> CONNECT / AS SYSDBA</div><div class="line">SQL> @catbundle.sql psu apply</div><div class="line">SQL> QUIT</div><div class="line"></div><div class="line">cd $ORACLE_HOME/rdbms/admin</div><div class="line">sqlplus /nolog</div><div class="line">SQL> CONNECT / AS SYSDBA</div><div class="line">SQL> @utlrp.sql</div></pre></td></tr></table></figure><p>重启数据库集群</p><h3 id="验证补丁是否打成功"><a href="#验证补丁是否打成功" class="headerlink" title="验证补丁是否打成功"></a>验证补丁是否打成功</h3><p>各节点的GI HOME和ORACLE HOME都执行验证。</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">$ cd $ORACLE_HOME/OPatch</div><div class="line">$ ./opatch lsinventory</div></pre></td></tr></table></figure><img src="/2018/03/06/oracle-11-2-0-4-RAC-PSU-PATCH/7C617DFC-B085-4C91-9537-BB87A92F5323.png" alt="1" title="1"><p>数据库的验证。</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">SQL> select * from dba_registry_history;</div></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h3 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h3><table>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>操作系统</td>
<td>centos 7.4</td>
</tr>
<tr>
<td>数据库版本</td>
<td>11.2.0.4</td>
</tr>
<tr>
<td>集群</td>
<td>RAC</td>
</tr>
</tbody>
</table>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/categories/oracle/rac/"/>
<category term="patch" scheme="https://shijieqin.github.io/categories/oracle/rac/patch/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/tags/rac/"/>
<category term="patch" scheme="https://shijieqin.github.io/tags/patch/"/>
</entry>
<entry>
<title>shell 编程</title>
<link href="https://shijieqin.github.io/2018/01/12/shell-%E7%BC%96%E7%A8%8B/"/>
<id>https://shijieqin.github.io/2018/01/12/shell-编程/</id>
<published>2018-01-12T07:11:56.000Z</published>
<updated>2018-01-12T07:11:56.000Z</updated>
<content type="html"><![CDATA[<h3 id="描述"><a href="#描述" class="headerlink" title="描述"></a>描述</h3><p>记录shell编程出现的坑和一些常用的语法</p><a id="more"></a><h3 id="SHELL-参数"><a href="#SHELL-参数" class="headerlink" title="SHELL 参数"></a>SHELL 参数</h3><ul><li>${parameter:?word}</li></ul><p><em>当parameter指示的参数没有被设值的时候,将会通过标准错误的方式显示word中的语句。</em></p><h3 id="shell中各种括号的使用记录"><a href="#shell中各种括号的使用记录" class="headerlink" title="shell中各种括号的使用记录"></a>shell中各种括号的使用记录</h3><h4 id="小括号-又称圆括号"><a href="#小括号-又称圆括号" class="headerlink" title="小括号(又称圆括号)"></a>小括号(又称圆括号)</h4><h5 id="单小括号"><a href="#单小括号" class="headerlink" title="单小括号"></a>单小括号</h5><ol><li><p>新开一个进程来执行命令</p><p><img src="https://ws2.sinaimg.cn/large/006tNc79ly1fqp12rs566j30v6082wg5.jpg" alt="mage-20180425172533"></p><p>如图所示,<strong>括号中的命令将会新开一个子shell顺序执行,所以括号中的变量不能够被脚本余下的部分使用。括号中多个命令之间用分号隔开,最后一个命令可以没有分号,各命令和括号之间不必有空格。</strong></p></li><li><p>作为$()来使用用于将()中的命令执行的结果替换回原来的位置</p></li><li><p>用于初始化数组。如:array=(a b c d)</p></li></ol><h5 id="双小括号"><a href="#双小括号" class="headerlink" title="双小括号"></a>双小括号</h5><ol><li><p>整数扩展。这种扩展计算是整数型的计算,不支持浮点型。((exp))结构扩展并计算一个算术表达式的值,如果表达式的结果为0,那么返回的退出状态码为1,或者 是”假”,而一个非零值的表达式所返回的退出状态码将为0,或者是”true”。若是逻辑判断,表达式exp为真则为1,假则为0</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">[root@zabbix-server ~]# NUM=0</div><div class="line">[root@zabbix-server ~]# if (($NUM));then echo true;else echo false;fi</div><div class="line">false</div><div class="line">[root@zabbix-server ~]# NUM=1</div><div class="line">[root@zabbix-server ~]# if (($NUM));then echo true;else echo false;fi</div><div class="line">true</div><div class="line">[root@zabbix-server ~]# if ((1>2));then echo true;else echo false;fi</div><div class="line">false</div><div class="line">[root@zabbix-server ~]# if ((1<2));then echo true;else echo false;fi</div><div class="line">true</div><div class="line">[root@zabbix-server ~]# if ((1==2));then echo true;else echo false;fi</div><div class="line">false</div></pre></td></tr></table></figure></li><li><p>只要括号中的运算符、表达式符合C语言运算规则,都可用在\$((exp))中,甚至是三目运算符。作不同进位(如二进制、八进制、十六进制)运算时,输出结果全都自动转化成了十进制。</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@zabbix-server ~]# echo $((16#10))</div><div class="line">16</div></pre></td></tr></table></figure></li><li><p>做数学运算</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">[root@zabbix-server ~]# a=1</div><div class="line">[root@zabbix-server ~]# ((a++))</div><div class="line">[root@zabbix-server ~]# echo $a</div><div class="line">2</div><div class="line">[root@zabbix-server ~]# ((a--))</div><div class="line">[root@zabbix-server ~]# echo $a</div><div class="line">1</div><div class="line">[root@zabbix-server ~]# ((a=a+2))</div><div class="line">[root@zabbix-server ~]# echo $a</div><div class="line">3</div><div class="line">[root@zabbix-server ~]# ((a=a*2))</div><div class="line">[root@zabbix-server ~]# echo $a</div><div class="line">6</div></pre></td></tr></table></figure></li><li><p>常用于算术运算比较,双括号中的变量可以不使用$符号前缀。括号内支持多个表达式用逗号分开。 只要括号中的表达式符合C语言运算规则,比如可以直接使用for((i=0;i<5;i++))</p></li></ol><h5 id="特殊公式"><a href="#特殊公式" class="headerlink" title="特殊公式"></a>特殊公式</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">echo ${ZABBIX_SOURCE_DIR:=zabbix-3.4.8}</div></pre></td></tr></table></figure><p>作用是如果ZABBIX_SOURCE_DIR不为空则输出$ZABBIX_SOURCE_DIR,否则输出zabbix-3.4.8,同时把zabbix-3.4.8赋值给ZABBIX_SOURCE_DIR。</p><h3 id="执行命令时不走alias"><a href="#执行命令时不走alias" class="headerlink" title="执行命令时不走alias"></a>执行命令时不走alias</h3><blockquote><p>关于Linux的拷贝命令我们都知道cp的参数 -f的意思是:</p><p>-f, –force if an existing destination file cannot be opened, remove it and try again</p><p>也就是说-f可以覆盖目的目录下有的文件,</p><p>但你有没有发现过这种情况,即使使用了-f也无法覆盖?</p><p>原因何在呢?</p><p>默认cp命令是有别名(alias cp=’cp -i’)的,无法强制覆盖,即使你用 -f 参数也无法强制覆盖文件。</p><p>可以使用\cp 执行cp命令时不走alias </p><p><code>\cp * -rf ../../test</code></p><p>网上还有一种解决方法:临时取消cp的alias</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"><span class="meta">></span>#unalias cp</div><div class="line"><span class="meta">></span>#cp a /test/a</div><div class="line"><span class="meta">></span></div></pre></td></tr></table></figure></blockquote><h3 id="常用的判断"><a href="#常用的判断" class="headerlink" title="常用的判断"></a>常用的判断</h3><ul><li><p>–b 当file存在并且是块文件时返回真</p></li><li><p>-c 当file存在并且是字符文件时返回真</p></li><li><p>-d 当pathname存在并且是一个目录时返回真</p></li><li><p>-e 当pathname指定的文件或目录存在时返回真</p></li><li><p>-f 当file存在并且是正规文件时返回真</p></li><li><p>-g 当由pathname指定的文件或目录存在并且设置了SGID位时返回为真</p></li><li><p>-h 当file存在并且是符号链接文件时返回真,该选项在一些老系统上无效</p></li><li><p>-k 当由pathname指定的文件或目录存在并且设置了“粘滞”位时返回真</p></li><li><p>-p 当file存在并且是命令管道时返回为真</p></li><li><p>-r 当由pathname指定的文件或目录存在并且可读时返回为真</p></li><li><p>-s 当file存在文件大小大于0时返回真</p></li><li><p>-u 当由pathname指定的文件或目录存在并且设置了SUID位时返回真</p></li><li><p>-w 当由pathname指定的文件或目录存在并且可执行时返回真。一个目录为了它的内容被访问必然是可执行的。</p></li><li><p>-o 当由pathname指定的文件或目录存在并且被子当前进程的有效用户ID所指定的用户拥有时返回真。</p><hr></li><li><p>-eq 等于</p></li><li>-ne 不等于</li><li>-gt 大于</li><li>-lt 小于</li><li>-le 小于等于</li><li>-ge 大于等于</li><li>-z 空串</li><li>= 两个字符相等</li><li>!= 两个字符不等</li><li>-n 非空串</li></ul><h3 id="常用的判断命令是否存在"><a href="#常用的判断命令是否存在" class="headerlink" title="常用的判断命令是否存在"></a>常用的判断命令是否存在</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"><span class="meta">$</span> command -v foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; }</div><div class="line"><span class="meta">$</span> type foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; }</div><div class="line"><span class="meta">$</span> hash foo 2>/dev/null || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; }</div></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h3 id="描述"><a href="#描述" class="headerlink" title="描述"></a>描述</h3><p>记录shell编程出现的坑和一些常用的语法</p>
</summary>
<category term="shell" scheme="https://shijieqin.github.io/categories/shell/"/>
<category term="shell" scheme="https://shijieqin.github.io/tags/shell/"/>
</entry>
<entry>
<title>asmlib创建的磁盘在线扩容</title>
<link href="https://shijieqin.github.io/2018/01/11/asmlib%E5%88%9B%E5%BB%BA%E7%9A%84%E7%A3%81%E7%9B%98%E5%9C%A8%E7%BA%BF%E6%89%A9%E5%AE%B9/"/>
<id>https://shijieqin.github.io/2018/01/11/asmlib创建的磁盘在线扩容/</id>
<published>2018-01-11T11:35:45.000Z</published>
<updated>2018-01-11T11:35:45.000Z</updated>
<content type="html"><![CDATA[<h3 id="说明"><a href="#说明" class="headerlink" title="说明"></a>说明</h3><p>本环境的asm磁盘是通过asmlib创建的,不适用于scsi的磁盘。</p><p>新增磁盘为/dev/xvdd</p><a id="more"></a><h3 id="操作过程"><a href="#操作过程" class="headerlink" title="操作过程"></a>操作过程</h3><h4 id="分区"><a href="#分区" class="headerlink" title="分区"></a>分区</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div></pre></td><td class="code"><pre><div class="line">[root@srm-db ~]# fdisk /dev/xvdd </div><div class="line">Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel</div><div class="line">Building a new DOS disklabel with disk identifier 0x36af11d0.</div><div class="line">Changes will remain in memory only, until you decide to write them.</div><div class="line">After that, of course, the previous content won't be recoverable.</div><div class="line"></div><div class="line">Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)</div><div class="line"></div><div class="line">WARNING: DOS-compatible mode is deprecated. It's strongly recommended to</div><div class="line"> switch off the mode (command 'c') and change display units to</div><div class="line"> sectors (command 'u').</div><div class="line"></div><div class="line">Command (m for help): n</div><div class="line">Command action</div><div class="line"> e extended</div><div class="line"> p primary partition (1-4)</div><div class="line">p</div><div class="line">Partition number (1-4): 1</div><div class="line">First cylinder (1-65270, default 1): </div><div class="line">Using default value 1</div><div class="line">Last cylinder, +cylinders or +size{K,M,G} (1-65270, default 65270): </div><div class="line">Using default value 65270</div><div class="line"></div><div class="line">Command (m for help): w</div><div class="line">The partition table has been altered!</div><div class="line"></div><div class="line">Calling ioctl() to re-read partition table.</div><div class="line">Syncing disks.</div><div class="line">[root@srm-db ~]#</div></pre></td></tr></table></figure><h4 id="查看现有ASM磁盘"><a href="#查看现有ASM磁盘" class="headerlink" title="查看现有ASM磁盘"></a>查看现有ASM磁盘</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@srm-db ~]# oracleasm listdisks</div><div class="line">DATA</div><div class="line">DATA2</div></pre></td></tr></table></figure><h4 id="添加新的asm磁盘"><a href="#添加新的asm磁盘" class="headerlink" title="添加新的asm磁盘"></a>添加新的asm磁盘</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">[root@srm-db ~]# oracleasm createdisk DATA3 /dev/xvdd1</div><div class="line">Writing disk header: done</div><div class="line">Instantiating disk: done</div><div class="line">[root@srm-db ~]# oracleasm listdisks</div><div class="line">DATA</div><div class="line">DATA2</div><div class="line">DATA3</div><div class="line">[root@srm-db ~]#</div></pre></td></tr></table></figure><h4 id="查看数据库中记录的asm磁盘"><a href="#查看数据库中记录的asm磁盘" class="headerlink" title="查看数据库中记录的asm磁盘"></a>查看数据库中记录的asm磁盘</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div></pre></td><td class="code"><pre><div class="line">[root@srm-db ~]# su - grid</div><div class="line">[grid@srm-db ~]$ sqlplus / as sysasm </div><div class="line"></div><div class="line">SQL*Plus: Release 12.2.0.1.0 Production on Thu Jan 11 19:42:07 2018</div><div class="line"></div><div class="line">Copyright (c) 1982, 2016, Oracle. All rights reserved.</div><div class="line"></div><div class="line"></div><div class="line">Connected to:</div><div class="line">Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production</div><div class="line"></div><div class="line">SQL> select name, path, mode_status, state, disk_number,failgroup from v$asm_disk;</div><div class="line"></div><div class="line">NAME</div><div class="line">------------------------------</div><div class="line">PATH</div><div class="line">--------------------------------------------------------------------------------</div><div class="line">MODE_ST STATE DISK_NUMBER FAILGROUP</div><div class="line">------- -------- ----------- ------------------------------</div><div class="line"></div><div class="line">/dev/oracleasm/disks/DATA3</div><div class="line">ONLINENORMAL 0</div><div class="line"></div><div class="line">DATA_0000</div><div class="line">/dev/oracleasm/disks/DATA</div><div class="line">ONLINENORMAL 0 DATA_0000</div><div class="line"></div><div class="line">NAME</div><div class="line">------------------------------</div><div class="line">PATH</div><div class="line">--------------------------------------------------------------------------------</div><div class="line">MODE_ST STATE DISK_NUMBER FAILGROUP</div><div class="line">------- -------- ----------- ------------------------------</div><div class="line"></div><div class="line">DATA_0001</div><div class="line">/dev/oracleasm/disks/DATA2</div><div class="line">ONLINENORMAL 1 DATA_0001</div><div class="line"></div><div class="line"></div><div class="line">SQL></div></pre></td></tr></table></figure><p>新增的asm磁盘为<code>/dev/oracleasm/disks/DATA3</code></p><h4 id="查看磁盘组名称"><a href="#查看磁盘组名称" class="headerlink" title="查看磁盘组名称"></a>查看磁盘组名称</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">SQL> select group_number,name,TOTAL_MB, FREE_MB from v$asm_diskgroup</div><div class="line"> 2 ;</div><div class="line"></div><div class="line">GROUP_NUMBER NAME TOTAL_MB FREE_MB</div><div class="line">------------ ------------------------------ ---------- ----------</div><div class="line"> 1 DATA 1023988 36588</div><div class="line"></div><div class="line">SQL></div></pre></td></tr></table></figure><p>DATA磁盘组就是要扩容的磁盘组</p><h4 id="扩容DATA磁盘组"><a href="#扩容DATA磁盘组" class="headerlink" title="扩容DATA磁盘组"></a>扩容DATA磁盘组</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"></div><div class="line">SQL> alter diskgroup DATA add disk '/dev/oracleasm/disks/DATA3' rebalance power 10;</div><div class="line"></div><div class="line">Diskgroup altered.</div><div class="line"></div><div class="line">SQL></div></pre></td></tr></table></figure><h4 id="观察reblance"><a href="#观察reblance" class="headerlink" title="观察reblance"></a>观察reblance</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line">SQL> select * from v$asm_operation;</div><div class="line"></div><div class="line">GROUP_NUMBER OPERA PASS STAT POWER ACTUAL SOFAR EST_WORK</div><div class="line">------------ ----- --------- ---- ---------- ---------- ---------- ----------</div><div class="line"> EST_RATE EST_MINUTES ERROR_CODECON_ID</div><div class="line">---------- ----------- -------------------------------------------- ----------</div><div class="line"> 1 REBAL COMPACT WAIT 10 10 0 0</div><div class="line"> 0 0 0</div><div class="line"></div><div class="line"> 1 REBAL REBALANCE RUN 10 10 553182304</div><div class="line"> 2268 33 0</div><div class="line"></div><div class="line"> 1 REBAL REBUILD DONE 10 10 0 0</div><div class="line"> 0 0 0</div><div class="line"></div><div class="line"></div><div class="line">SQL></div></pre></td></tr></table></figure><p>当没有输出时,则表明reblance完成</p><h4 id="修改reblance-power"><a href="#修改reblance-power" class="headerlink" title="修改reblance power"></a>修改reblance power</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ALTER DISKGROUP DATA REBALANCE POWER 1;</div></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h3 id="说明"><a href="#说明" class="headerlink" title="说明"></a>说明</h3><p>本环境的asm磁盘是通过asmlib创建的,不适用于scsi的磁盘。</p>
<p>新增磁盘为/dev/xvdd</p>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="asm" scheme="https://shijieqin.github.io/categories/oracle/asm/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="asm" scheme="https://shijieqin.github.io/tags/asm/"/>
</entry>
<entry>
<title>DG Broker配置</title>
<link href="https://shijieqin.github.io/2017/12/31/DG-Broker%E9%85%8D%E7%BD%AE/"/>
<id>https://shijieqin.github.io/2017/12/31/DG-Broker配置/</id>
<published>2017-12-31T08:20:18.000Z</published>
<updated>2017-12-31T08:20:18.000Z</updated>
<content type="html"><![CDATA[<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>Dgmgrl表示Data Guard Manager Command Line Interface,用来管理维护Dataguard,而且该命令系统自带不需要额外安装,命令简单易上手,容易学习,比sqlplus用来更加简单一些.</p><p>本文参考了如下几篇文档:</p><blockquote><p><a href="https://community.oracle.com/docs/DOC-1007327" target="_blank" rel="external">https://community.oracle.com/docs/DOC-1007327</a></p><p><a href="http://blog.csdn.net/u011364306/article/details/50523117" target="_blank" rel="external">http://blog.csdn.net/u011364306/article/details/50523117</a></p><p><a href="http://blog.csdn.net/u011364306/article/details/50534654" target="_blank" rel="external">http://blog.csdn.net/u011364306/article/details/50534654</a></p></blockquote><a id="more"></a><h3 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h3><p><strong><em>注:本文的配置是基于我的另一篇文章<a href="/2017/12/28/Oracle11g-dataguard配置/" title="Oracle11g-dataguard配置">Oracle11g-dataguard配置</a>搭建出来的dg环境进行的配置</em></strong></p><h4 id="配置监听"><a href="#配置监听" class="headerlink" title="配置监听"></a>配置监听</h4><p>主备库都需要配置监听,需添加如下监听内容</p><p>主库(srmcloud):</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div></pre></td><td class="code"><pre><div class="line">LISTENER =</div><div class="line"> (DESCRIPTION_LIST =</div><div class="line"> (DESCRIPTION =</div><div class="line"> (ADDRESS = (PROTOCOL = TCP)(HOST = srmcloud)(PORT = 1521))</div><div class="line"> )</div><div class="line"> )</div><div class="line">SID_LIST_LISTENER=</div><div class="line"> (SID_LIST =</div><div class="line"> (SID_DESC =</div><div class="line"> (GLOBAL_DBNAME = srmcloud)</div><div class="line"> (ORACLE_HOME = /home/oracle/opt/oracle/product/11.2.0/dbhome_1)</div><div class="line"> (SID_NAME = srmcloud)</div><div class="line"> )</div><div class="line"> (SID_DESC =</div><div class="line"> (GLOBAL_DBNAME = srmcloud_dgmgrl)</div><div class="line"> (ORACLE_HOME = /home/oracle/opt/oracle/product/11.2.0/dbhome_1)</div><div class="line"> (SID_NAME = srmcloud)</div><div class="line"> )</div><div class="line"> )</div></pre></td></tr></table></figure><p>其中</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">(SID_DESC =</div><div class="line"> (GLOBAL_DBNAME = srmcloud_dgmgrl)</div><div class="line"> (ORACLE_HOME = /home/oracle/opt/oracle/product/11.2.0/dbhome_1)</div><div class="line"> (SID_NAME = srmcloud)</div><div class="line"> )</div></pre></td></tr></table></figure><p>为新添加的代码,GLOBAL_DBNAME一定要以<code>dgmgrl</code>结尾,备库一样,修改为如下内容</p><p>备库(srmclouddg):</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div></pre></td><td class="code"><pre><div class="line">LISTENER =</div><div class="line"> (DESCRIPTION_LIST =</div><div class="line"> (DESCRIPTION =</div><div class="line"> (ADDRESS = (PROTOCOL = TCP)(HOST = srmclouddg)(PORT = 1521))</div><div class="line"> )</div><div class="line"> )</div><div class="line">SID_LIST_LISTENER=</div><div class="line"> (SID_LIST =</div><div class="line"> (SID_DESC =</div><div class="line"> (GLOBAL_DBNAME = srmclouddg)</div><div class="line"> (ORACLE_HOME = /home/oracle/opt/oracle/product/11.2.0/dbhome_1)</div><div class="line"> (SID_NAME = srmcloud)</div><div class="line"> )</div><div class="line"> (SID_DESC =</div><div class="line"> (GLOBAL_DBNAME = srmclouddg_dgmgrl)</div><div class="line"> (ORACLE_HOME = /home/oracle/opt/oracle/product/11.2.0/dbhome_1)</div><div class="line"> (SID_NAME = srmcloud)</div><div class="line"> )</div><div class="line"> )</div></pre></td></tr></table></figure><p><strong><em>注:添加完成后,重启主备库的监听</em></strong></p><h4 id="配置DG-Broker-multiplexed-configuration-files"><a href="#配置DG-Broker-multiplexed-configuration-files" class="headerlink" title="配置DG Broker multiplexed configuration files"></a>配置DG Broker multiplexed configuration files</h4><p>如下操作在<strong>主备库</strong>都需要执行</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set dg_broker_config_file1='/home/oracle/opt/oracle/oradata/srmcloud/dg_config1.dat' scope=both;</div><div class="line">System altered.</div><div class="line">SQL> alter system set dg_broker_config_file2='/home/oracle/opt/oracle/oradata/srmcloud/dg_config2.dat' scope=both;</div><div class="line">System altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><h4 id="start-the-Broker"><a href="#start-the-Broker" class="headerlink" title="start the Broker"></a>start the Broker</h4><p>如下操作在<strong>主备库</strong>都需要执行</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set dg_broker_start=true scope=both;</div><div class="line">System altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><p>这时可以查看后台启动了一个dmon进程</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[oracle@srmcloud ~]$ ps -ef | grep dmon</div><div class="line">oracle 20464 1 0 05:54 ? 00:00:00 ora_dmon_srmcloud</div><div class="line">oracle 20579 18643 0 06:16 pts/1 00:00:00 grep dmon</div><div class="line">[oracle@srmcloud ~]$</div></pre></td></tr></table></figure><h4 id="配置Broker-Configuration"><a href="#配置Broker-Configuration" class="headerlink" title="配置Broker Configuration"></a>配置Broker Configuration</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">[oracle@srmcloud ~]$ dgmgrl sys/handhand</div><div class="line">DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production</div><div class="line">Copyright (c) 2000, 2009, Oracle. All rights reserved.</div><div class="line">Welcome to DGMGRL, type "help" for information.</div><div class="line">Connected.</div><div class="line">DGMGRL> create configuration srmcloud_srmclouddg_config as primary database is srmcloudconnect identifier is 'srmcloud';</div><div class="line">Configuration "srmcloud_srmclouddg_config" created with primary database "srmcloud"</div><div class="line">DGMGRL></div></pre></td></tr></table></figure><p><strong><em>注:</em></strong></p><ul><li><strong><em>其中identifier后面的内容是tns中配置的tnsname</em></strong></li><li><strong><em>有文章说在oracle12c中,由于配置了LOG_ARCHIVE_DEST_n的参数,导致报如下错误,Error: ORA-16698: LOG_ARCHIVE_DEST_n parameter set for object to be added,这种问题在11g中不会出现,至于12c是否真的会出现,可自行测试,解决办法就是将LOG_ARCHIVE_DEST_n参数置为空,等配置好之后再改回去。</em></strong></li></ul><h4 id="Add-the-standby-to-the-configuration"><a href="#Add-the-standby-to-the-configuration" class="headerlink" title="Add the standby to the configuration"></a>Add the standby to the configuration</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">DGMGRL> add database srmclouddg as connect identifier is 'srmclouddg';</div><div class="line">Database "srmclouddg" added</div><div class="line">DGMGRL>show configuration</div><div class="line">Configuration - srmcloud_srmclouddg_config</div><div class="line"> Protection Mode: MaxPerformance</div><div class="line"> Databases:</div><div class="line"> srmcloud - Primary database</div><div class="line"> srmclouddg - Physical standby database</div><div class="line">Fast-Start Failover: DISABLED</div><div class="line">Configuration Status:</div><div class="line">DISABLED</div><div class="line">DGMGRL></div></pre></td></tr></table></figure><h4 id="Enable-that-Configuration"><a href="#Enable-that-Configuration" class="headerlink" title="Enable that Configuration."></a>Enable that Configuration.</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">DGMGRL> enable configuration;</div><div class="line">Enabled.</div><div class="line">DGMGRL> show configuration</div><div class="line">Configuration - srmcloud_srmclouddg_config</div><div class="line"> Protection Mode: MaxPerformance</div><div class="line"> Databases:</div><div class="line"> srmcloud - Primary database</div><div class="line"> srmclouddg - Physical standby database</div><div class="line">Fast-Start Failover: DISABLED</div><div class="line">Configuration Status:</div><div class="line">SUCCESS</div><div class="line">DGMGRL></div></pre></td></tr></table></figure><h3 id="验证"><a href="#验证" class="headerlink" title="验证"></a>验证</h3><h4 id="验证切换"><a href="#验证切换" class="headerlink" title="验证切换"></a>验证切换</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line">DGMGRL> switchover to srmclouddg;</div><div class="line">Performing switchover NOW, please wait...</div><div class="line">Operation requires a connection to instance "srmcloud" on database "srmclouddg"</div><div class="line">Connecting to instance "srmcloud"...</div><div class="line">Connected.</div><div class="line">New primary database "srmclouddg" is opening...</div><div class="line">Operation requires startup of instance "srmcloud" on database "srmcloud"</div><div class="line">Starting instance "srmcloud"...</div><div class="line">ORACLE instance started.</div><div class="line">Database mounted.</div><div class="line">Database opened.</div><div class="line">Switchover succeeded, new primary is "srmclouddg"</div><div class="line">DGMGRL> show configuration;</div><div class="line">Configuration - srmcloud_srmclouddg_config</div><div class="line"> Protection Mode: MaxPerformance</div><div class="line"> Databases:</div><div class="line"> srmclouddg - Primary database</div><div class="line"> srmcloud - Physical standby database</div><div class="line">Fast-Start Failover: DISABLED</div><div class="line">Configuration Status:</div><div class="line">SUCCESS</div><div class="line">DGMGRL></div></pre></td></tr></table></figure><h4 id="验证手动关闭,并启动备机,自动启用日志应用"><a href="#验证手动关闭,并启动备机,自动启用日志应用" class="headerlink" title="验证手动关闭,并启动备机,自动启用日志应用"></a>验证手动关闭,并启动备机,自动启用日志应用</h4><p>之前需要手动启动日志应用才可以。</p><p>这里使用的是上一步切换过的主备库,主库为srmclouddg,备库为srmcloud</p><p>备库:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">SQL> shutdown immediate;</div><div class="line">Database closed.</div><div class="line">Database dismounted.</div><div class="line">ORACLE instance shut down.</div><div class="line">SQL></div></pre></td></tr></table></figure><p>主库:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">DGMGRL> show database srmcloud</div><div class="line">Database - srmcloud</div><div class="line"> Role: PHYSICAL STANDBY</div><div class="line"> Intended State: OFFLINE</div><div class="line"> Transport Lag: (unknown)</div><div class="line"> Apply Lag: (unknown)</div><div class="line"> Apply Rate: (unknown)</div><div class="line"> Real Time Query: OFF</div><div class="line"> Instance(s):</div><div class="line"> srmcloud</div><div class="line">Database Status:</div><div class="line">SHUTDOWN</div><div class="line">DGMGRL></div></pre></td></tr></table></figure><p>备库:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">SQL> startup;</div><div class="line">ORACLE instance started.</div><div class="line">Total System Global Area 1553305600 bytes</div><div class="line">Fixed Size 2253544 bytes</div><div class="line">Variable Size 1426066712 bytes</div><div class="line">Database Buffers 117440512 bytes</div><div class="line">Redo Buffers 7544832 bytes</div><div class="line">Database mounted.</div><div class="line">Database opened.</div><div class="line">SQL></div></pre></td></tr></table></figure><p>主库:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">tabase - srmcloud</div><div class="line"> Role: PHYSICAL STANDBY</div><div class="line"> Intended State: APPLY-ON</div><div class="line"> Transport Lag: 0 seconds (computed 0 seconds ago)</div><div class="line"> Apply Lag: 0 seconds (computed 0 seconds ago)</div><div class="line"> Apply Rate: 0 Byte/s</div><div class="line"> Real Time Query: ON</div><div class="line"> Instance(s):</div><div class="line"> srmcloud</div><div class="line">Database Status:</div><div class="line">SUCCESS</div><div class="line">DGMGRL></div></pre></td></tr></table></figure><p>可以看出,自动启用了日志应用,不需要在sqlplus中输入alter database recover managed standby database …类似的语句,并且备库自动启动为<code>PHYSICAL STANDBY</code>的角色,不需要手动指定,OPEN_MODE自动为<code>READ ONLY WITH APPLY</code>模式,也不需要手动指定</p>]]></content>
<summary type="html">
<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>Dgmgrl表示Data Guard Manager Command Line Interface,用来管理维护Dataguard,而且该命令系统自带不需要额外安装,命令简单易上手,容易学习,比sqlplus用来更加简单一些.</p>
<p>本文参考了如下几篇文档:</p>
<blockquote>
<p><a href="https://community.oracle.com/docs/DOC-1007327" target="_blank" rel="external">https://community.oracle.com/docs/DOC-1007327</a></p>
<p><a href="http://blog.csdn.net/u011364306/article/details/50523117" target="_blank" rel="external">http://blog.csdn.net/u011364306/article/details/50523117</a></p>
<p><a href="http://blog.csdn.net/u011364306/article/details/50534654" target="_blank" rel="external">http://blog.csdn.net/u011364306/article/details/50534654</a></p>
</blockquote>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="dg" scheme="https://shijieqin.github.io/categories/oracle/dg/"/>
<category term="broker" scheme="https://shijieqin.github.io/categories/oracle/dg/broker/"/>
<category term="dgmgrl" scheme="https://shijieqin.github.io/categories/oracle/dg/broker/dgmgrl/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="dg" scheme="https://shijieqin.github.io/tags/dg/"/>
<category term="broker" scheme="https://shijieqin.github.io/tags/broker/"/>
<category term="dgmgrl" scheme="https://shijieqin.github.io/tags/dgmgrl/"/>
</entry>
<entry>
<title>Oracle11g dataguard配置</title>
<link href="https://shijieqin.github.io/2017/12/28/Oracle11g-dataguard%E9%85%8D%E7%BD%AE/"/>
<id>https://shijieqin.github.io/2017/12/28/Oracle11g-dataguard配置/</id>
<published>2017-12-28T09:49:27.000Z</published>
<updated>2017-12-28T09:49:27.000Z</updated>
<content type="html"><![CDATA[<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>DG的配置过程,参考了如下两篇文章:</p><blockquote><p><a href="http://www.cnblogs.com/tippoint/archive/2013/04/18/3029019.html" target="_blank" rel="external">http://www.cnblogs.com/tippoint/archive/2013/04/18/3029019.html</a></p><p><a href="http://blog.itpub.net/29324876/viewspace-1246133/" target="_blank" rel="external">http://blog.itpub.net/29324876/viewspace-1246133/</a></p></blockquote><p>主库IP:10.211.55.6</p><p>备库IP:10.211.55.7</p><p>安装之前使用如下命令同步主备库的时间</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ntpdate -u 0.centos.pool.ntp.org</div></pre></td></tr></table></figure><a id="more"></a><h3 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h3><h4 id="判断DG是否已安装"><a href="#判断DG是否已安装" class="headerlink" title="判断DG是否已安装"></a>判断DG是否已安装</h4><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">SQL> select * from v$option where parameter = 'Oracle Data Guard';</div><div class="line">PARAMETER VALUE</div><div class="line"><span class="comment">------------------- ---------</span></div><div class="line">Oracle Data Guard TRUE</div><div class="line">SQL></div></pre></td></tr></table></figure><p>如果是true表示已经安装可以配置,否则需要安装相应组件。</p><h4 id="设置主库为强制记录日志"><a href="#设置主库为强制记录日志" class="headerlink" title="设置主库为强制记录日志"></a>设置主库为强制记录日志</h4><p>默认情况下数据库操作会记录redo log,但是在一些特定的情况下可以使用nologging来不生成redo信息</p><ul><li>表的批量INSERT(通过/<em>+APPEND </em>/提示使用“直接路径插入“。或采用SQL*Loader直接路径加载)。表数据不生成redo,但是 </li></ul><p>所有索引修改会生成redo,但是所有索引修改会生成redo(尽管表不生成日志,但这个表上的索引却会生成redo!)。 </p><ul><li>LOB操作(对大对象的更新不必生成日志)。 </li><li>通过CREATE TABLE AS SELECT创建表</li><li>各种ALTER TABLE操作,如MOVE和SPLIT</li><li>在一些表迁移和表空间迁移中,可以使用alter table a nologging;或者alter tablespace snk nologging;在操作完成后再修改回logging状态。</li></ul><p>这里需要多说一句,如果你使用nologging导入大批量数据,以后对这些数据的修改会在redo或者archive log中,但是基准的数据是没有的,所以一旦介质损坏是无法完全恢复的,必须在使用nologging完成切换回logging后,做一次全备或者0级备份。</p><h5 id="强制记录日志"><a href="#强制记录日志" class="headerlink" title="强制记录日志"></a>强制记录日志</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">SQL> alter database force logging;</div><div class="line">Database altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><h5 id="检查状态-YES为强制"><a href="#检查状态-YES为强制" class="headerlink" title="检查状态(YES为强制)"></a>检查状态(YES为强制)</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">SQL> select name,force_logging from v$database;</div><div class="line">NAME FORCE_LOG</div><div class="line"><span class="comment">--------------------------- ---------</span></div><div class="line">SRMCLOUD YES</div><div class="line">SQL></div></pre></td></tr></table></figure><h5 id="如果需要在主库添加或者删除数据文件时,这些文件也会在备份添加或删除,使用如下"><a href="#如果需要在主库添加或者删除数据文件时,这些文件也会在备份添加或删除,使用如下" class="headerlink" title="如果需要在主库添加或者删除数据文件时,这些文件也会在备份添加或删除,使用如下"></a>如果需要在主库添加或者删除数据文件时,这些文件也会在备份添加或删除,使用如下</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set standby_file_management = 'AUTO';</div><div class="line">System altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><h4 id="创建standby-log-files"><a href="#创建standby-log-files" class="headerlink" title="创建standby log files"></a>创建standby log files</h4><p>从库使用standby log files来保存从主库接收到的重做日志。既然主要是从库在使用,那为什么需要在主库上也建立standby log files ? 原因主要由两个:一是主库可能转换为备库,而备库是需要有standby log files的 二是如果主库建立了standby log files那备库会自动建立。</p><p>创建standby log files需要注意两点:</p><ul><li>standby log files的大小和redo log files一样</li></ul><ul><li>一般而言, standbyredo 日志文件组数要比 primary 数据库的 online redo 日志文件组数至少多一个。推荐 standbyredo 日志组数量基于 primary 数据库的线程数(这里的线程数可以理解为 rac 结构中的 rac节点数)。有一个推荐的公式可以做参考:(每线程的日志组数+1)<em>最大线程数<br>假设现在节点是1个,则=(3+1)</em>1=4<br>如果是双节点 则=(3+1)*2=8<br>这里我们创建4个standby logfile:</li></ul><h5 id="查询redo日志大小"><a href="#查询redo日志大小" class="headerlink" title="查询redo日志大小"></a>查询redo日志大小</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">SQL> select group#,bytes/1024/1024 as M from v$log;</div><div class="line"> GROUP# M</div><div class="line"><span class="comment">---------- ----------</span></div><div class="line"> 1 100</div><div class="line"> 2 100</div><div class="line"> 3 100</div><div class="line">SQL></div></pre></td></tr></table></figure><p>这里是100M,三个</p><h5 id="创建"><a href="#创建" class="headerlink" title="创建"></a>创建</h5><p>不建议组号group#紧挨着redo,因为后续redo有可能调整,这里我们从建立从11到14的standby logfile</p><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">SQL> alter database add standby logfile group 11 '/home/oracle/opt/oracle/oradata/srmcloud/standby11.log' size 100M;</div><div class="line">Database altered.</div><div class="line">SQL> alter database add standby logfile group 12 '/home/oracle/opt/oracle/oradata/srmcloud/standby12.log' size 100M;</div><div class="line">Database altered.</div><div class="line">SQL> alter database add standby logfile group 13 '/home/oracle/opt/oracle/oradata/srmcloud/standby13.log' size 100M;</div><div class="line">Database altered.</div><div class="line">SQL> alter database add standby logfile group 14 '/home/oracle/opt/oracle/oradata/srmcloud/standby14.log' size 100M;</div><div class="line">Database altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><h4 id="创建密码文件并传输给备库"><a href="#创建密码文件并传输给备库" class="headerlink" title="创建密码文件并传输给备库"></a>创建密码文件并传输给备库</h4><p>一般数据库默认就有密码文件,存放在$ORACLE_HOME/dbs/orapwSID 这里为orapwsrmcloud</p><p>如果没有</p><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sql> orapwd file=$ORACLE_HOME/dbs/orapwsrmcloud password=oracle;</div></pre></td></tr></table></figure><p>检查REMOTE_LOGIN_PASSWORDFILE值是否为 EXCLUSIVE:</p><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sql> show parameter REMOTE_LOGIN_PASSWORDFILE;</div></pre></td></tr></table></figure><p>如果值不是EXCLUSIVE,则:</p><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sql> alter system set remote_login_passwordfile=exclusive scope=spfile;</div></pre></td></tr></table></figure><p>如果存在或者创建完成,将密码文件传输到standby 库的对应目录,并授权</p><h4 id="处理控制文件"><a href="#处理控制文件" class="headerlink" title="处理控制文件"></a>处理控制文件</h4><h5 id="查看控制文件位置"><a href="#查看控制文件位置" class="headerlink" title="查看控制文件位置"></a>查看控制文件位置</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">SQL> select name from v$controlfile;</div><div class="line">NAME</div><div class="line"><span class="comment">--------------------------------------------------------------------------------</span></div><div class="line">/home/oracle/opt/oracle/oradata/srmcloud/control01.ctl</div><div class="line">/home/oracle/opt/oracle/oradata/srmcloud/control02.ctl</div><div class="line">SQL></div></pre></td></tr></table></figure><h5 id="生成standby控制文件"><a href="#生成standby控制文件" class="headerlink" title="生成standby控制文件"></a>生成standby控制文件</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line">SQL> shutdown immediate</div><div class="line">Database closed.</div><div class="line">Database dismounted.</div><div class="line">ORACLE instance shut down.</div><div class="line">SQL> startup mount</div><div class="line">ORACLE instance started.</div><div class="line">Total System Global Area 1553305600 bytes</div><div class="line">Fixed Size 2253544 bytes</div><div class="line">Variable Size 1426066712 bytes</div><div class="line">Database Buffers 117440512 bytes</div><div class="line">Redo Buffers 7544832 bytes</div><div class="line">Database mounted.</div><div class="line">SQL> alter database create standby controlfile as '/tmp/standby_control01.ctl';</div><div class="line">Database altered.</div><div class="line">SQL> alter database open;</div><div class="line">Database altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><h5 id="然后在备库建立对应的目录-并授权"><a href="#然后在备库建立对应的目录-并授权" class="headerlink" title="然后在备库建立对应的目录,并授权"></a>然后在备库建立对应的目录,并授权</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[oracle@srmclouddg software]$ mkdir -p /home/oracle/opt/oracle/oradata/srmcloud/</div><div class="line">[oracle@srmclouddg software]$ chown oracle:oinstall /home/oracle/opt/oracle/oradata/srmcloud</div></pre></td></tr></table></figure><p>拷贝主库的控制文件到备库</p><h4 id="db-name和db-unique-name"><a href="#db-name和db-unique-name" class="headerlink" title="db_name和db_unique_name"></a>db_name和db_unique_name</h4><p>默认db_name和db_unique_name和实例名是一致的,这里是srmcloud。需要注意在DG中主库和从库的db_unique_name是不能一致的,需要区分开的。这里我们设置主库的db_unique_name为srmcloud,从库为srmclouddg。</p><h5 id="查看db-unique-name"><a href="#查看db-unique-name" class="headerlink" title="查看db_unique_name"></a>查看db_unique_name</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">SQL> show parameter db_unique_name</div><div class="line">NAME TYPE VALUE</div><div class="line"><span class="comment">-------------- --------------- ------------------ </span></div><div class="line">db_unique_name string srmcloud</div><div class="line">SQL></div></pre></td></tr></table></figure><h5 id="设置db-unique-name"><a href="#设置db-unique-name" class="headerlink" title="设置db_unique_name"></a>设置db_unique_name</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set db_unique_name=srmcloud scope=spfile;</div><div class="line">System altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><p><strong><em>注意虽然默认db_unique_name和db_name是一致的,但是需要显式设置,否则在spfile中没有此参数</em></strong></p><h4 id="闪回"><a href="#闪回" class="headerlink" title="闪回"></a>闪回</h4><p>略</p><h4 id="SQL-NET设置"><a href="#SQL-NET设置" class="headerlink" title="SQL*NET设置"></a>SQL*NET设置</h4><h5 id="配置主库监听-listener-ora"><a href="#配置主库监听-listener-ora" class="headerlink" title="配置主库监听(listener.ora)"></a>配置主库监听(listener.ora)</h5><p>虽然可以通过netca来进行配置,但是除了这个默认的外,我们还需要一个静态注册SID_LIST_LISTENER,如果没有此从参数,而且dataguard启动顺序不正确,主库会报PING[ARC1]:Heartbeat failed to connect to standby ‘<em>*</em>‘.Error is 12514导致归档无法完成<br>配置如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">LISTENER =</div><div class="line"> (DESCRIPTION_LIST =</div><div class="line"> (DESCRIPTION =</div><div class="line"> (ADDRESS = (PROTOCOL = TCP)(HOST = srmcloud)(PORT = 1521))</div><div class="line"> )</div><div class="line"> )</div><div class="line">SID_LIST_LISTENER=</div><div class="line"> (SID_LIST =</div><div class="line"> (SID_DESC =</div><div class="line"> (GLOBAL_DBNAME = srmcloud)</div><div class="line"> (ORACLE_HOME = /home/oracle/opt/oracle/product/11.2.0/dbhome_1)</div><div class="line"> (SID_NAME = srmcloud)</div><div class="line"> )</div><div class="line"> )</div></pre></td></tr></table></figure><h5 id="配置tns"><a href="#配置tns" class="headerlink" title="配置tns"></a>配置tns</h5><p>配置如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div></pre></td><td class="code"><pre><div class="line">SRMCLOUD =</div><div class="line"> (DESCRIPTION =</div><div class="line"> (ADDRESS_LIST =</div><div class="line"> (ADDRESS = (PROTOCOL = TCP)(HOST = 10.211.55.6)(PORT = 1521))</div><div class="line"> )</div><div class="line"> (CONNECT_DATA =</div><div class="line"> (SERVICE_NAME = srmcloud)</div><div class="line"> )</div><div class="line"> )</div><div class="line">SRMCLOUDDG =</div><div class="line"> (DESCRIPTION =</div><div class="line"> (ADDRESS_LIST =</div><div class="line"> (ADDRESS = (PROTOCOL = TCP)(HOST = 10.211.55.7)(PORT = 1521))</div><div class="line"> )</div><div class="line"> (CONNECT_DATA =</div><div class="line"> (SERVICE_NAME = srmclouddg)</div><div class="line"> )</div><div class="line"> )</div></pre></td></tr></table></figure><h5 id="传输到备库并修改listener-ora"><a href="#传输到备库并修改listener-ora" class="headerlink" title="传输到备库并修改listener.ora"></a>传输到备库并修改listener.ora</h5><p>如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">LISTENER =</div><div class="line"> (DESCRIPTION_LIST =</div><div class="line"> (DESCRIPTION =</div><div class="line"> (ADDRESS = (PROTOCOL = TCP)(HOST = srmclouddg)(PORT = 1521))</div><div class="line"> )</div><div class="line"> )</div><div class="line">SID_LIST_LISTENER=</div><div class="line"> (SID_LIST =</div><div class="line"> (SID_DESC =</div><div class="line"> (GLOBAL_DBNAME = srmclouddg)</div><div class="line"> (ORACLE_HOME = /home/oracle/opt/oracle/product/11.2.0/dbhome_1)</div><div class="line"> (SID_NAME = srmcloud)</div><div class="line"> )</div><div class="line"> )</div></pre></td></tr></table></figure><h4 id="日志传输配置"><a href="#日志传输配置" class="headerlink" title="日志传输配置"></a>日志传输配置</h4><h5 id="查看是否启用归档"><a href="#查看是否启用归档" class="headerlink" title="查看是否启用归档"></a>查看是否启用归档</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">SQL> Archive log list;</div><div class="line">Database log mode No Archive Mode</div><div class="line">Automatic archival Disabled</div><div class="line">Archive destination USE_DB_RECOVERY_FILE_DEST</div><div class="line">Oldest online log sequence 35</div><div class="line">Current log sequence 37</div><div class="line">SQL></div></pre></td></tr></table></figure><h5 id="启用归档并设置归档日志路径"><a href="#启用归档并设置归档日志路径" class="headerlink" title="启用归档并设置归档日志路径"></a>启用归档并设置归档日志路径</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set log_archive_dest_1='LOCATION=/home/oracle/opt/oracle/archive1 valid_for=(all_logfiles,primary_role) db_unique_name=srmcloud' scope=spfile;</div><div class="line">System altered.</div><div class="line">SQL> shutdown immediate;</div><div class="line">Database closed.</div><div class="line">Database dismounted.</div><div class="line">ORACLE instance shut down.</div><div class="line">SQL> startup mount;</div><div class="line">ORACLE instance started.</div><div class="line">Total System Global Area 1553305600 bytes</div><div class="line">Fixed Size 2253544 bytes</div><div class="line">Variable Size 1426066712 bytes</div><div class="line">Database Buffers 117440512 bytes</div><div class="line">Redo Buffers 7544832 bytes</div><div class="line">Database mounted.</div><div class="line">SQL> alter database archivelog;</div><div class="line">Database altered.</div><div class="line">SQL> alter database open;</div><div class="line">Database altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><h5 id="配置归档日志到备份库"><a href="#配置归档日志到备份库" class="headerlink" title="配置归档日志到备份库"></a>配置归档日志到备份库</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set log_archive_dest_2='SERVICE=srmclouddg lgwr sync valid_for=(online_logfile,primary_role) db_unique_name=srmclouddg';</div><div class="line">System altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><p><strong><em>要注意STANDBY_ARCHIVE_DEST 参数不需要,已经被官方弃用。设置此参数后启动数据库,只会报 ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance 错。</em></strong></p><h4 id="配置FAL-SERVER"><a href="#配置FAL-SERVER" class="headerlink" title="配置FAL_SERVER"></a>配置FAL_SERVER</h4><p>这个参数指定当日志传输出现问题时,备库到哪里去找缺少的归档日志。它用在备库接收的到的重做日志间有缺口的时候。这种情况会发生在日志传输出现中断时,比如你需要对备库进行维护操作。在备库维护期间,没有日志传输过来,这时缺口就出现了。设置了这个参数,备库就会主动去寻找那些缺少的日志,并要求主库进行传输。<br>你是主库,就填写:fal_server=从库<br>从库上就反过来:fal_server=主库<br><strong><em>注意:FAL_CLIENT在11g中已经废弃,虽然可以配置但是已经不起作用了</em></strong></p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set FAL_SERVER=srmclouddg;</div><div class="line">System altered.</div></pre></td></tr></table></figure><h4 id="Data-Guard-配置里的另外一个库的名字"><a href="#Data-Guard-配置里的另外一个库的名字" class="headerlink" title="Data Guard 配置里的另外一个库的名字"></a>Data Guard 配置里的另外一个库的名字</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set log_archive_config = 'dg_config=(srmcloud,srmclouddg)';</div><div class="line">System altered.</div></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">SQL> create pfile from spfile;</div></pre></td></tr></table></figure><p>手工修改pfile,如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div></pre></td><td class="code"><pre><div class="line">srmcloud.__db_cache_size=687865856</div><div class="line">srmcloud.__java_pool_size=16777216</div><div class="line">srmcloud.__large_pool_size=33554432</div><div class="line">srmcloud.__oracle_base='/home/oracle/opt/oracle'#ORACLE_BASE set from environment</div><div class="line">srmcloud.__pga_aggregate_target=469762048</div><div class="line">srmcloud.__sga_target=1090519040</div><div class="line">srmcloud.__shared_io_pool_size=0</div><div class="line">srmcloud.__shared_pool_size=335544320</div><div class="line">srmcloud.__streams_pool_size=0</div><div class="line">*.audit_file_dest='/home/oracle/opt/oracle/admin/srmcloud/adump'</div><div class="line">*.audit_trail='db'</div><div class="line">*.compatible='11.2.0.4.0'</div><div class="line">*.control_files='/home/oracle/opt/oracle/oradata/srmcloud/control01.ctl','/home/oracle/opt/oracle/oradata/srmcloud/control02.ctl'</div><div class="line">*.db_block_size=32768</div><div class="line">*.db_domain=''</div><div class="line">*.db_name='srmcloud'</div><div class="line">*.db_recovery_file_dest='/home/oracle/opt/oracle/fast_recovery_area'</div><div class="line">*.db_recovery_file_dest_size=5218762752</div><div class="line">*.db_unique_name='SRMCLOUD'</div><div class="line">*.diagnostic_dest='/home/oracle/opt/oracle'</div><div class="line">*.dispatchers='(PROTOCOL=TCP) (SERVICE=srmcloudXDB)'</div><div class="line">*.fal_server='SRMCLOUDDG'</div><div class="line">*.job_queue_processes=1000</div><div class="line">*.log_archive_config='dg_config=(srmcloud,srmclouddg)'</div><div class="line">*.log_archive_dest_1='LOCATION=/home/oracle/opt/oracle/archive1 valid_for=(all_logfiles,primary_role) db_unique_name=srmcloud'</div><div class="line">*.log_archive_dest_2='SERVICE=srmclouddg lgwr sync valid_for=(online_logfile,primary_role) db_unique_name=srmclouddg'</div><div class="line">*.log_archive_dest_state_1=enable</div><div class="line">*.log_archive_dest_state_2=enable</div><div class="line">*.log_archive_format='srmcloud_%t_%s_%r.dbf'</div><div class="line">*.memory_target=1546649600</div><div class="line">*.open_cursors=300</div><div class="line">*.processes=1500</div><div class="line">*.remote_login_passwordfile='EXCLUSIVE'</div><div class="line">*.sessions=1655</div><div class="line">*.standby_file_management='AUTO'</div><div class="line">*.undo_tablespace='UNDOTBS1'</div></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line">SQL> shutdown immediate;</div><div class="line">Database closed.</div><div class="line">Database dismounted.</div><div class="line">ORACLE instance shut down.</div><div class="line">SQL> create spfile from pfile;</div><div class="line">File created.</div><div class="line">SQL> startup;</div><div class="line">ORACLE instance started.</div><div class="line">Total System Global Area 1553305600 bytes</div><div class="line">Fixed Size 2253544 bytes</div><div class="line">Variable Size 1426066712 bytes</div><div class="line">Database Buffers 117440512 bytes</div><div class="line">Redo Buffers 7544832 bytes</div><div class="line">Database mounted.</div><div class="line">Database opened.</div><div class="line">SQL></div></pre></td></tr></table></figure><h4 id="传输pfile到备库并修改"><a href="#传输pfile到备库并修改" class="headerlink" title="传输pfile到备库并修改"></a>传输pfile到备库并修改</h4><p>只需修改如下项即可:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">*.db_name='srmcloud'</div><div class="line">*.db_unique_name='SRMCLOUDDG'</div><div class="line">*.fal_server='SRMCLOUD'</div><div class="line">*.log_archive_config='dg_config=(srmclouddg,srmcloud)'</div><div class="line">*.log_archive_dest_1='LOCATION=/home/oracle/opt/oracle/archive1 valid_for=(all_logfiles,primary_role) db_unique_name=srmclouddg'</div><div class="line">*.log_archive_dest_2='SERVICE=srmcloud lgwr sync valid_for=(online_logfile,primary_role) db_unique_name=srmcloud'</div></pre></td></tr></table></figure><p>建立相关目录</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">[root@srmclouddg srmcloud]# mkdir -p /home/oracle/opt/oracle/admin/srmcloud/</div><div class="line">[root@srmclouddg srmcloud]# cd /home/oracle/opt/oracle/admin/srmcloud/</div><div class="line">[root@srmclouddg srmcloud]# pwd</div><div class="line">/home/oracle/opt/oracle/admin/srmcloud</div><div class="line">[root@srmclouddg srmcloud]# mkdir adump dpdump pfile</div><div class="line">[root@srmclouddg srmcloud]# ll</div><div class="line">total 12</div><div class="line">drwxr-xr-x 2 root root 4096 Dec 28 21:38 adump</div><div class="line">drwxr-xr-x 2 root root 4096 Dec 28 21:38 dpdump</div><div class="line">drwxr-xr-x 2 root root 4096 Dec 28 21:38 pfile</div><div class="line">[root@srmclouddg srmcloud]# chown -R oracle:oinstall /home/oracle/opt/oracle/admin</div></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[oracle@srmclouddg dbs]$ mkdir -p /home/oracle/opt/oracle/fast_recovery_area</div></pre></td></tr></table></figure><h4 id="使用pfile启动备库到nomount"><a href="#使用pfile启动备库到nomount" class="headerlink" title="使用pfile启动备库到nomount"></a>使用pfile启动备库到nomount</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">SQL> startup nomount pfile='/home/oracle/opt/oracle/product/11.2.0/dbhome_1/dbs/initsrmcloud.ora';</div><div class="line">ORACLE instance started.</div><div class="line">Total System Global Area 1553305600 bytes</div><div class="line">Fixed Size 2253544 bytes</div><div class="line">Variable Size 1426066712 bytes</div><div class="line">Database Buffers 117440512 bytes</div><div class="line">Redo Buffers 7544832 bytes</div><div class="line">SQL></div></pre></td></tr></table></figure><p><strong><em>注意:要启动备库监听</em></strong></p><h4 id="Duplicate复制主库到备库"><a href="#Duplicate复制主库到备库" class="headerlink" title="Duplicate复制主库到备库"></a>Duplicate复制主库到备库</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div><div class="line">128</div><div class="line">129</div><div class="line">130</div><div class="line">131</div><div class="line">132</div><div class="line">133</div><div class="line">134</div></pre></td><td class="code"><pre><div class="line">[oracle@srmcloud ~]$ rman target sys/handhand@SRMCLOUD auxiliary sys/handhand@SRMCLOUDDG</div><div class="line">Recovery Manager: Release 11.2.0.4.0 - Production on Thu Dec 28 23:11:34 2017</div><div class="line">Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.</div><div class="line">connected to target database: SRMCLOUD (DBID=3572656870)</div><div class="line">connected to auxiliary database: SRMCLOUD (not mounted)</div><div class="line">RMAN> duplicate target database for standby from active database spfile set db_unique_name 'SRMCLOUD' nofilenamecheck;</div><div class="line">Starting Duplicate Db at 28-DEC-17</div><div class="line">using target database control file instead of recovery catalog</div><div class="line">allocated channel: ORA_AUX_DISK_1</div><div class="line">channel ORA_AUX_DISK_1: SID=10 device type=DISK</div><div class="line">contents of Memory Script:</div><div class="line">{</div><div class="line"> backup as copy reuse</div><div class="line"> targetfile '/home/oracle/opt/oracle/product/11.2.0/dbhome_1/dbs/orapwsrmcloud' auxiliary format</div><div class="line"> '/home/oracle/opt/oracle/product/11.2.0/dbhome_1/dbs/orapwsrmcloud' targetfile</div><div class="line"> '/home/oracle/opt/oracle/product/11.2.0/dbhome_1/dbs/spfilesrmcloud.ora' auxiliary format</div><div class="line"> '/home/oracle/opt/oracle/product/11.2.0/dbhome_1/dbs/spfilesrmcloud.ora' ;</div><div class="line"> sql clone "alter system set spfile= ''/home/oracle/opt/oracle/product/11.2.0/dbhome_1/dbs/spfilesrmcloud.ora''";</div><div class="line">}</div><div class="line">executing Memory Script</div><div class="line">Starting backup at 28-DEC-17</div><div class="line">allocated channel: ORA_DISK_1</div><div class="line">channel ORA_DISK_1: SID=1157 device type=DISK</div><div class="line">Finished backup at 28-DEC-17</div><div class="line">sql statement: alter system set spfile= ''/home/oracle/opt/oracle/product/11.2.0/dbhome_1/dbs/spfilesrmcloud.ora''</div><div class="line">contents of Memory Script:</div><div class="line">{</div><div class="line"> sql clone "alter system set db_unique_name =</div><div class="line"> ''SRMCLOUD'' comment=</div><div class="line"> '''' scope=spfile";</div><div class="line"> shutdown clone immediate;</div><div class="line"> startup clone nomount;</div><div class="line">}</div><div class="line">executing Memory Script</div><div class="line">sql statement: alter system set db_unique_name = ''SRMCLOUD'' comment= '''' scope=spfile</div><div class="line">Oracle instance shut down</div><div class="line">connected to auxiliary database (not started)</div><div class="line">Oracle instance started</div><div class="line">Total System Global Area 1553305600 bytes</div><div class="line">Fixed Size 2253544 bytes</div><div class="line">Variable Size 1426066712 bytes</div><div class="line">Database Buffers 117440512 bytes</div><div class="line">Redo Buffers 7544832 bytes</div><div class="line">contents of Memory Script:</div><div class="line">{</div><div class="line"> backup as copy current controlfile for standby auxiliary format '/home/oracle/opt/oracle/oradata/srmcloud/control01.ctl';</div><div class="line"> restore clone controlfile to '/home/oracle/opt/oracle/oradata/srmcloud/control02.ctl' from</div><div class="line"> '/home/oracle/opt/oracle/oradata/srmcloud/control01.ctl';</div><div class="line">}</div><div class="line">executing Memory Script</div><div class="line">Starting backup at 28-DEC-17</div><div class="line">using channel ORA_DISK_1</div><div class="line">channel ORA_DISK_1: starting datafile copy</div><div class="line">copying standby control file</div><div class="line">output file name=/home/oracle/opt/oracle/product/11.2.0/dbhome_1/dbs/snapcf_srmcloud.f tag=TAG20171228T231151 RECID=3 STAMP=963961911</div><div class="line">channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01</div><div class="line">Finished backup at 28-DEC-17</div><div class="line">Starting restore at 28-DEC-17</div><div class="line">allocated channel: ORA_AUX_DISK_1</div><div class="line">channel ORA_AUX_DISK_1: SID=9 device type=DISK</div><div class="line">channel ORA_AUX_DISK_1: copied control file copy</div><div class="line">Finished restore at 28-DEC-17</div><div class="line">contents of Memory Script:</div><div class="line">{</div><div class="line"> sql clone 'alter database mount standby database';</div><div class="line">}</div><div class="line">executing Memory Script</div><div class="line">sql statement: alter database mount standby database</div><div class="line">RMAN-05538: WARNING: implicitly using DB_FILE_NAME_CONVERT</div><div class="line">contents of Memory Script:</div><div class="line">{ set newname for tempfile 1 to</div><div class="line"> "/home/oracle/opt/oracle/oradata/srmcloud/temp01.dbf";</div><div class="line"> switch clone tempfile all;</div><div class="line"> set newname for datafile 1 to</div><div class="line"> "/home/oracle/opt/oracle/oradata/srmcloud/system01.dbf";</div><div class="line"> set newname for datafile 2 to</div><div class="line"> "/home/oracle/opt/oracle/oradata/srmcloud/sysaux01.dbf";</div><div class="line"> set newname for datafile 3 to</div><div class="line"> "/home/oracle/opt/oracle/oradata/srmcloud/undotbs01.dbf";</div><div class="line"> set newname for datafile 4 to</div><div class="line"> "/home/oracle/opt/oracle/oradata/srmcloud/users01.dbf";</div><div class="line"> backup as copy reuse</div><div class="line"> datafile 1 auxiliary format</div><div class="line"> "/home/oracle/opt/oracle/oradata/srmcloud/system01.dbf" datafile</div><div class="line"> 2 auxiliary format</div><div class="line"> "/home/oracle/opt/oracle/oradata/srmcloud/sysaux01.dbf" datafile</div><div class="line"> 3 auxiliary format</div><div class="line"> "/home/oracle/opt/oracle/oradata/srmcloud/undotbs01.dbf" datafile</div><div class="line"> 4 auxiliary format</div><div class="line"> "/home/oracle/opt/oracle/oradata/srmcloud/users01.dbf" ;</div><div class="line"> sql 'alter system archive log current';</div><div class="line">}</div><div class="line">executing Memory Script</div><div class="line">executing command: SET NEWNAME</div><div class="line">renamed tempfile 1 to /home/oracle/opt/oracle/oradata/srmcloud/temp01.dbf in control file</div><div class="line">executing command: SET NEWNAME</div><div class="line">executing command: SET NEWNAME</div><div class="line">executing command: SET NEWNAME</div><div class="line">executing command: SET NEWNAME</div><div class="line">Starting backup at 28-DEC-17</div><div class="line">using channel ORA_DISK_1</div><div class="line">channel ORA_DISK_1: starting datafile copy</div><div class="line">input datafile file number=00002 name=/home/oracle/opt/oracle/oradata/srmcloud/sysaux01.dbf</div><div class="line">output file name=/home/oracle/opt/oracle/oradata/srmcloud/sysaux01.dbf tag=TAG20171228T231202</div><div class="line">channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15</div><div class="line">channel ORA_DISK_1: starting datafile copy</div><div class="line">input datafile file number=00003 name=/home/oracle/opt/oracle/oradata/srmcloud/undotbs01.dbf</div><div class="line">output file name=/home/oracle/opt/oracle/oradata/srmcloud/undotbs01.dbf tag=TAG20171228T231202</div><div class="line">channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15</div><div class="line">channel ORA_DISK_1: starting datafile copy</div><div class="line">input datafile file number=00001 name=/home/oracle/opt/oracle/oradata/srmcloud/system01.dbf</div><div class="line">output file name=/home/oracle/opt/oracle/oradata/srmcloud/system01.dbf tag=TAG20171228T231202</div><div class="line">channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07</div><div class="line">channel ORA_DISK_1: starting datafile copy</div><div class="line">input datafile file number=00004 name=/home/oracle/opt/oracle/oradata/srmcloud/users01.dbf</div><div class="line">output file name=/home/oracle/opt/oracle/oradata/srmcloud/users01.dbf tag=TAG20171228T231202</div><div class="line">channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01</div><div class="line">Finished backup at 28-DEC-17</div><div class="line">sql statement: alter system archive log current</div><div class="line">contents of Memory Script:</div><div class="line">{</div><div class="line"> switch clone datafile all;</div><div class="line">}</div><div class="line">executing Memory Script</div><div class="line">datafile 1 switched to datafile copy</div><div class="line">input datafile copy RECID=3 STAMP=963961972 file name=/home/oracle/opt/oracle/oradata/srmcloud/system01.dbf</div><div class="line">datafile 2 switched to datafile copy</div><div class="line">input datafile copy RECID=4 STAMP=963961972 file name=/home/oracle/opt/oracle/oradata/srmcloud/sysaux01.dbf</div><div class="line">datafile 3 switched to datafile copy</div><div class="line">input datafile copy RECID=5 STAMP=963961972 file name=/home/oracle/opt/oracle/oradata/srmcloud/undotbs01.dbf</div><div class="line">datafile 4 switched to datafile copy</div><div class="line">input datafile copy RECID=6 STAMP=963961972 file name=/home/oracle/opt/oracle/oradata/srmcloud/users01.dbf</div><div class="line">Finished Duplicate Db at 28-DEC-17</div><div class="line">RMAN> quit</div></pre></td></tr></table></figure><h4 id="关闭,并使用pfile重启数据库,并创建spfile"><a href="#关闭,并使用pfile重启数据库,并创建spfile" class="headerlink" title="关闭,并使用pfile重启数据库,并创建spfile"></a>关闭,并使用pfile重启数据库,并创建spfile</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div></pre></td><td class="code"><pre><div class="line">SQL> shutdown immediate;</div><div class="line">ORA-01109: database not open</div><div class="line">Database dismounted.</div><div class="line">ORACLE instance shut down.</div><div class="line">SQL> startup nomount pfile='/home/oracle/opt/oracle/product/11.2.0/dbhome_1/dbs/initsrmcloud.ora';</div><div class="line">ORACLE instance started.</div><div class="line">Total System Global Area 1553305600 bytes</div><div class="line">Fixed Size 2253544 bytes</div><div class="line">Variable Size 1426066712 bytes</div><div class="line">Database Buffers 117440512 bytes</div><div class="line">Redo Buffers 7544832 bytes</div><div class="line">SQL> alter database mount standby database;</div><div class="line">Database altered.</div><div class="line">SQL> show parameter db_unique_name</div><div class="line">NAME TYPE</div><div class="line">------------------------------------ ---------------------------------</div><div class="line">VALUE</div><div class="line">------------------------------</div><div class="line">db_unique_name string</div><div class="line">SRMCLOUDDG</div><div class="line">SQL> create spfile from pfile;</div><div class="line">File created.</div><div class="line">SQL></div></pre></td></tr></table></figure><h4 id="关闭数据库,使用spfile重启数据库"><a href="#关闭数据库,使用spfile重启数据库" class="headerlink" title="关闭数据库,使用spfile重启数据库"></a>关闭数据库,使用spfile重启数据库</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line">SQL> shutdown immediate;</div><div class="line">ORA-01109: database not open</div><div class="line">Database dismounted.</div><div class="line">ORACLE instance shut down.</div><div class="line">SQL> startup nomount;</div><div class="line">ORACLE instance started.</div><div class="line">Total System Global Area 1553305600 bytes</div><div class="line">Fixed Size 2253544 bytes</div><div class="line">Variable Size 1426066712 bytes</div><div class="line">Database Buffers 117440512 bytes</div><div class="line">Redo Buffers 7544832 bytes</div><div class="line">SQL> alter database mount standby database;</div><div class="line">Database altered.</div><div class="line">SQL> alter database open read only;</div><div class="line">Database altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><h4 id="查看日志"><a href="#查看日志" class="headerlink" title="查看日志"></a>查看日志</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">SQL> select SEQUENCE#,FIRST_TIME,NEXT_TIME ,APPLIED from v$archived_log order by 1;</div><div class="line"> SEQUENCE# FIRST_TIME NEXT_TIME APPLIED</div><div class="line">---------- --------------- --------------- ---------------------------</div><div class="line"> 40 28-DEC-17 28-DEC-17 NO</div><div class="line"> 41 28-DEC-17 28-DEC-17 NO</div><div class="line"> 42 28-DEC-17 28-DEC-17 NO</div><div class="line"> 43 28-DEC-17 28-DEC-17 NO</div><div class="line"> 44 28-DEC-17 28-DEC-17 NO</div><div class="line">SQL></div></pre></td></tr></table></figure><p>已接收,但未应用</p><h4 id="开启备库日志应用"><a href="#开启备库日志应用" class="headerlink" title="开启备库日志应用"></a>开启备库日志应用</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">SQL> alter database recover managed standby database using current logfile disconnect from session;</div><div class="line">Database altered.</div><div class="line">SQL> select SEQUENCE#,FIRST_TIME,NEXT_TIME ,APPLIED from v$archived_log order by 1;</div><div class="line"> SEQUENCE# FIRST_TIME NEXT_TIME APPLIED</div><div class="line">---------- --------------- --------------- ---------------------------</div><div class="line"> 40 28-DEC-17 28-DEC-17 YES</div><div class="line"> 41 28-DEC-17 28-DEC-17 YES</div><div class="line"> 42 28-DEC-17 28-DEC-17 YES</div><div class="line"> 43 28-DEC-17 28-DEC-17 YES</div><div class="line"> 44 28-DEC-17 28-DEC-17 YES</div><div class="line">SQL></div></pre></td></tr></table></figure><h3 id="验证"><a href="#验证" class="headerlink" title="验证"></a>验证</h3><h4 id="数据传输验证"><a href="#数据传输验证" class="headerlink" title="数据传输验证"></a>数据传输验证</h4><h5 id="在主库创建用户"><a href="#在主库创建用户" class="headerlink" title="在主库创建用户"></a>在主库创建用户</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">SQL> create user test identified by test;</div><div class="line">User created.</div><div class="line">SQL> select username from dba_users where username='TEST';</div><div class="line">USERNAME</div><div class="line">--------------------------------------------------------------------------------</div><div class="line">TEST</div></pre></td></tr></table></figure><h5 id="在备库查询TEST用户是否存在"><a href="#在备库查询TEST用户是否存在" class="headerlink" title="在备库查询TEST用户是否存在"></a>在备库查询TEST用户是否存在</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">SQL> select username from dba_users where username='TEST';</div><div class="line">USERNAME</div><div class="line">--------------------------------------------------------------------------------</div><div class="line">TEST</div><div class="line">SQL></div></pre></td></tr></table></figure><p>dg数据传输正常</p><h4 id="主备切换验证"><a href="#主备切换验证" class="headerlink" title="主备切换验证"></a>主备切换验证</h4><p>#####主库切换为备库</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">SQL> alter database commit to switchover to physical standby with session shutdown;</div><div class="line">Database altered.</div><div class="line">SQL> startup mount;</div><div class="line">ORACLE instance started.</div><div class="line">Total System Global Area 1553305600 bytes</div><div class="line">Fixed Size 2253544 bytes</div><div class="line">Variable Size 1426066712 bytes</div><div class="line">Database Buffers 117440512 bytes</div><div class="line">Redo Buffers 7544832 bytes</div><div class="line">Database mounted.</div><div class="line">SQL> select database_role from v$database;</div><div class="line">DATABASE_ROLE</div><div class="line">------------------------------------------------</div><div class="line">PHYSICAL STANDBY</div><div class="line">SQL></div></pre></td></tr></table></figure><h5 id="备库切换为主库"><a href="#备库切换为主库" class="headerlink" title="备库切换为主库"></a>备库切换为主库</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div></pre></td><td class="code"><pre><div class="line">SQL> select database_role from v$database;</div><div class="line">DATABASE_ROLE</div><div class="line">------------------------------------------------</div><div class="line">PHYSICAL STANDBY</div><div class="line">SQL> select open_mode from v$database;</div><div class="line">OPEN_MODE</div><div class="line">------------------------------------------------------------</div><div class="line">READ ONLY WITH APPLY</div><div class="line">SQL> alter database commit to switchover to primary with session shutdown;</div><div class="line">Database altered.</div><div class="line">SQL> select database_role from v$database;</div><div class="line">DATABASE_ROLE</div><div class="line">------------------------------------------------</div><div class="line">PRIMARY</div><div class="line">SQL> select open_mode from v$database;</div><div class="line">OPEN_MODE</div><div class="line">------------------------------------------------------------</div><div class="line">MOUNTED</div><div class="line">SQL> alter database open;</div><div class="line">Database altered.</div><div class="line">SQL> select open_mode from v$database;</div><div class="line">OPEN_MODE</div><div class="line">------------------------------------------------------------</div><div class="line">READ WRITE</div><div class="line">SQL></div></pre></td></tr></table></figure><h5 id="启动原主库-现在为备库-为read-only模式,并启用日志自动应用"><a href="#启动原主库-现在为备库-为read-only模式,并启用日志自动应用" class="headerlink" title="启动原主库(现在为备库)为read only模式,并启用日志自动应用"></a>启动原主库(现在为备库)为read only模式,并启用日志自动应用</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">SQL> alter database open read only;</div><div class="line">Database altered.</div><div class="line">SQL> alter database recover managed standby database using current logfile disconnect from session;</div><div class="line">Database altered.</div><div class="line">SQL></div></pre></td></tr></table></figure><p>至此,DG配置完成</p><h3 id="管理"><a href="#管理" class="headerlink" title="管理"></a>管理</h3><p>dataguard启动关闭顺序</p><h4 id="监听"><a href="#监听" class="headerlink" title="监听"></a>监听</h4><p>先启从库再起主库</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">lsnrctl start</div></pre></td></tr></table></figure><h4 id="启动"><a href="#启动" class="headerlink" title="启动"></a>启动</h4><h5 id="先起从库"><a href="#先起从库" class="headerlink" title="先起从库"></a>先起从库</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">sql>startup nomount</div><div class="line">sql>alter database mount standby database;</div><div class="line">sql>alter database open read only;</div><div class="line">sql>alter database recover managed standby database using current logfile disconnect from session;</div></pre></td></tr></table></figure><h5 id="再启主库"><a href="#再启主库" class="headerlink" title="再启主库"></a>再启主库</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sql>startup</div></pre></td></tr></table></figure><h4 id="关闭-和开启正好相反"><a href="#关闭-和开启正好相反" class="headerlink" title="关闭(和开启正好相反)"></a>关闭(和开启正好相反)</h4><h5 id="先关主库:"><a href="#先关主库:" class="headerlink" title="先关主库:"></a>先关主库:</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sql>shutdown immediate</div></pre></td></tr></table></figure><h5 id="再关从库:"><a href="#再关从库:" class="headerlink" title="再关从库:"></a>再关从库:</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">sql>alter database recover managed standby database cancel;</div><div class="line">sql>shutdown immediate;</div></pre></td></tr></table></figure><h3 id="后续"><a href="#后续" class="headerlink" title="后续"></a>后续</h3><p>介绍一篇dg文章,写的比我好</p><p><a href="https://community.oracle.com/docs/DOC-1007058" target="_blank" rel="external">https://community.oracle.com/docs/DOC-1007058</a></p>]]></content>
<summary type="html">
<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>DG的配置过程,参考了如下两篇文章:</p>
<blockquote>
<p><a href="http://www.cnblogs.com/tippoint/archive/2013/04/18/3029019.html" target="_blank" rel="external">http://www.cnblogs.com/tippoint/archive/2013/04/18/3029019.html</a></p>
<p><a href="http://blog.itpub.net/29324876/viewspace-1246133/" target="_blank" rel="external">http://blog.itpub.net/29324876/viewspace-1246133/</a></p>
</blockquote>
<p>主库IP:10.211.55.6</p>
<p>备库IP:10.211.55.7</p>
<p>安装之前使用如下命令同步主备库的时间</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ntpdate -u 0.centos.pool.ntp.org</div></pre></td></tr></table></figure>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="dataguard" scheme="https://shijieqin.github.io/categories/oracle/dataguard/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="dataguard" scheme="https://shijieqin.github.io/tags/dataguard/"/>
</entry>
<entry>
<title>oracle 12C 单实例PDB插入到RAC环境下出现的问题</title>
<link href="https://shijieqin.github.io/2017/12/24/oracle-12C-%E5%8D%95%E5%AE%9E%E4%BE%8BPDB%E6%8F%92%E5%85%A5%E5%88%B0RAC%E7%8E%AF%E5%A2%83%E4%B8%8B%E5%87%BA%E7%8E%B0%E7%9A%84%E9%97%AE%E9%A2%98/"/>
<id>https://shijieqin.github.io/2017/12/24/oracle-12C-单实例PDB插入到RAC环境下出现的问题/</id>
<published>2017-12-24T03:49:33.000Z</published>
<updated>2017-12-24T03:49:33.000Z</updated>
<content type="html"><![CDATA[<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>本文记录在oracle 12C,通过pdb插拔的方式将单实例转换为rac环境出现的问题。</p><a id="more"></a><h3 id="undo表空间被占用"><a href="#undo表空间被占用" class="headerlink" title="undo表空间被占用"></a>undo表空间被占用</h3><h4 id="问题描述"><a href="#问题描述" class="headerlink" title="问题描述"></a>问题描述</h4><p>在迁移过程中,由于修改过源pdb的默认undo表空间,导致插入到rac环境的时候,出现undo表空间被占用的情况。</p><p><strong><em>注:这里,使用的是local undo的模式</em></strong></p><h4 id="问题重现"><a href="#问题重现" class="headerlink" title="问题重现"></a>问题重现</h4><h5 id="切换至测试pdb"><a href="#切换至测试pdb" class="headerlink" title="切换至测试pdb"></a>切换至测试pdb</h5><figure class="highlight sql"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">SQL> alter session set container = TEST;</div><div class="line">Session altered.</div></pre></td></tr></table></figure><h5 id="查询默认undo表空间,及数据文件位置"><a href="#查询默认undo表空间,及数据文件位置" class="headerlink" title="查询默认undo表空间,及数据文件位置"></a>查询默认undo表空间,及数据文件位置</h5><figure class="highlight sql"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">SQL> select tablespace_name,</div><div class="line"> file_name,</div><div class="line"> AUTOEXTENSIBLE,</div><div class="line"> bytes / 1024 / 1024 size_mb</div><div class="line"> from dba_data_files</div><div class="line"> where tablespace_name like '%UNDO%'; </div><div class="line">TABLESPACE_NAME FILE_NAME AUTOEXTEN SIZE_MB</div><div class="line"><span class="comment">--------------- --------------------------------------------------- --------- ----------</span></div><div class="line">UNDOTBS1 /u01/app/oracle/oradata/SRMCLOUD/test/undotbs01.dbf YES 1515</div></pre></td></tr></table></figure><h5 id="修改默认undo表空间"><a href="#修改默认undo表空间" class="headerlink" title="修改默认undo表空间"></a>修改默认undo表空间</h5><figure class="highlight sql"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">SQL> create undo tablespace undotbs2 datafile '/u01/app/oracle/oradata/SRMCLOUD/test/undotbs02.dbf' size 100m autoextend on;</div><div class="line">Tablespace created.</div><div class="line">SQL> alter system set undo_tablespace='UNDOTBS2' scope=both;</div><div class="line">System altered.</div><div class="line">SQL> drop tablespace UNDOTBS1 including contents and datafiles;</div><div class="line">Tablespace dropped.</div><div class="line">SQL> show parameter undo</div><div class="line">NAME TYPE VALUE</div><div class="line"><span class="comment">------------------------------------ --------------------------------- ------------------------------</span></div><div class="line">temp_undo_enabled boolean FALSE</div><div class="line">undo_management string AUTO</div><div class="line">undo_retention integer 900</div><div class="line">undo_tablespace string UNDOTBS2</div></pre></td></tr></table></figure><h5 id="切换回CDB"><a href="#切换回CDB" class="headerlink" title="切换回CDB"></a>切换回CDB</h5><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">SQL> alter session set container = CDB$ROOT</div></pre></td></tr></table></figure><h5 id="拔出测试PDB"><a href="#拔出测试PDB" class="headerlink" title="拔出测试PDB"></a>拔出测试PDB</h5><figure class="highlight sql"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">SQL> alter pluggable database TEST close immediate;</div><div class="line">Pluggable database altered.</div><div class="line">SQL> alter pluggable database TEST unplug into '/u01/app/oracle/oradata/SRMCLOUD/test.xml';</div><div class="line">Pluggable database altered.</div><div class="line">SQL> drop pluggable database TEST KEEP DATAFILES;</div><div class="line">Pluggable database dropped.</div></pre></td></tr></table></figure><h5 id="在rac下插入pdb"><a href="#在rac下插入pdb" class="headerlink" title="在rac下插入pdb"></a>在rac下插入pdb</h5><figure class="highlight sql"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">SQL> CREATE PLUGGABLE DATABASE test USING '/u01/app/oracle/test.xml' SOURCE_FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/SRMCLOUD/test/', '/u01/app/oracle/test/') MOVE FILE_NAME_CONVERT = ('/u01/app/oracle/test/', '+DATA/srmcloud/test/');</div><div class="line">Pluggable database created.</div></pre></td></tr></table></figure><h5 id="启动新插入的pdb"><a href="#启动新插入的pdb" class="headerlink" title="启动新插入的pdb"></a>启动新插入的pdb</h5><figure class="highlight sql"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">SQL> alter pluggable database TEST open instances=all;</div><div class="line"><span class="keyword">alter</span> <span class="keyword">pluggable</span> <span class="keyword">database</span> <span class="keyword">TEST</span> <span class="keyword">open</span> instances=all</div><div class="line">*</div><div class="line"><span class="keyword">ERROR</span> <span class="keyword">at</span> line <span class="number">1</span>:</div><div class="line">ORA<span class="number">-65107</span>: <span class="keyword">Error</span> encountered <span class="keyword">when</span> processing the <span class="keyword">current</span> task <span class="keyword">on</span> <span class="keyword">instance</span>:<span class="number">1</span></div><div class="line">ORA<span class="number">-30013</span>: <span class="keyword">undo</span> <span class="keyword">tablespace</span> <span class="string">'UNDOTBS2'</span> <span class="keyword">is</span> currently <span class="keyword">in</span> <span class="keyword">use</span></div></pre></td></tr></table></figure><h5 id="问题描述2"><a href="#问题描述2" class="headerlink" title="问题描述2"></a>问题描述2</h5><p>以上就重现了错误过程。</p><p>刚开始只是以为更改了默认undo表空间的名称,导致在插入oracle rac环境下的时候,oracle自动添加新的undo失败。(oracle 12c rac下,每个实例上的pdb使用的是不同的undo表空间)</p><p>针对以上猜想,尝试更改undo表空间为默认的名称后,重新插入,仍然失败</p><figure class="highlight sql"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">SQL> alter pluggable database TEST open instances=all;</div><div class="line"><span class="keyword">alter</span> <span class="keyword">pluggable</span> <span class="keyword">database</span> <span class="keyword">TEST</span> <span class="keyword">open</span> instances=all</div><div class="line">*</div><div class="line"><span class="keyword">ERROR</span> <span class="keyword">at</span> line <span class="number">1</span>:</div><div class="line">ORA<span class="number">-65107</span>: <span class="keyword">Error</span> encountered <span class="keyword">when</span> processing the <span class="keyword">current</span> task <span class="keyword">on</span> <span class="keyword">instance</span>:<span class="number">1</span></div><div class="line">ORA<span class="number">-30013</span>: <span class="keyword">undo</span> <span class="keyword">tablespace</span> <span class="string">'UNDOTBS1'</span> <span class="keyword">is</span> currently <span class="keyword">in</span> <span class="keyword">use</span></div></pre></td></tr></table></figure><h5 id="发现原因"><a href="#发现原因" class="headerlink" title="发现原因"></a>发现原因</h5><p>通过对比修改前与修改后的拔出文件<strong>test.xml</strong>发现,修改后比修改前,在拔出文件中多了一行如下参数</p><figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="tag"><<span class="name">spfile</span>></span>*.undo_tablespace='UNDOTBS1'<span class="tag"></<span class="name">spfile</span>></span></div></pre></td></tr></table></figure><p>由于这个参数的原因,导致pdb在插入的时候,统一把undo表空间指向为’UNDOTBS1’导致的。</p><p>解决方法就是,删除这一行数据即可。</p><h5 id="问题解决"><a href="#问题解决" class="headerlink" title="问题解决"></a>问题解决</h5><figure class="highlight sql"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">SQL> alter pluggable database TEST open instances=all;</div><div class="line">Pluggable database altered.</div></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>本文记录在oracle 12C,通过pdb插拔的方式将单实例转换为rac环境出现的问题。</p>
</summary>
<category term="oracle 12C" scheme="https://shijieqin.github.io/categories/oracle-12C/"/>
<category term="RAC" scheme="https://shijieqin.github.io/categories/oracle-12C/RAC/"/>
<category term="PDB" scheme="https://shijieqin.github.io/categories/oracle-12C/RAC/PDB/"/>
<category term="oracle 12C" scheme="https://shijieqin.github.io/tags/oracle-12C/"/>
<category term="RAC" scheme="https://shijieqin.github.io/tags/RAC/"/>
<category term="PDB" scheme="https://shijieqin.github.io/tags/PDB/"/>
</entry>
<entry>
<title>RAC删除节点</title>
<link href="https://shijieqin.github.io/2017/12/05/RAC%E5%88%A0%E9%99%A4%E8%8A%82%E7%82%B9/"/>
<id>https://shijieqin.github.io/2017/12/05/RAC删除节点/</id>
<published>2017-12-05T05:59:58.000Z</published>
<updated>2017-12-05T05:59:58.000Z</updated>
<content type="html"><![CDATA[<h3 id="目的"><a href="#目的" class="headerlink" title="目的"></a>目的</h3><p>删除节点node03</p><p>其中:</p><ul><li>数据库名为orcl</li><li>node03的实例名为orcl3</li></ul><a id="more"></a><h3 id="停止node03的数据库实例"><a href="#停止node03的数据库实例" class="headerlink" title="停止node03的数据库实例"></a>停止node03的数据库实例</h3><p>在任意一个可用节点上,这里用node01,grid用户执行如下命令</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">srvctl stop instance -d orcl -i orcl3</div></pre></td></tr></table></figure><h3 id="卸载node03上的数据库实例"><a href="#卸载node03上的数据库实例" class="headerlink" title="卸载node03上的数据库实例"></a>卸载node03上的数据库实例</h3><p>在任意一个可用节点上,这里用node01,oracle用户执行如下命令</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">dbca -silent -deleteInstance -nodeList node03 -gdbName orcl -instanceName orcl3 -sysDBAUserName sys -sysDBAPassword Hand1234</div></pre></td></tr></table></figure><p>结果如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line">[oracle@node01 ~]$ dbca -silent -deleteInstance -nodeList node03 -gdbName orcl -instanceName orcl3 -sysDBAUserName sys -sysDBAPassword Hand1234</div><div class="line">Deleting instance</div><div class="line">1% complete</div><div class="line">2% complete</div><div class="line">6% complete</div><div class="line">13% complete</div><div class="line">20% complete</div><div class="line">26% complete</div><div class="line">33% complete</div><div class="line">40% complete</div><div class="line">46% complete</div><div class="line">53% complete</div><div class="line">60% complete</div><div class="line">66% complete</div><div class="line">Completing instance management.</div><div class="line">100% complete</div><div class="line">Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl0.log" for further details.</div></pre></td></tr></table></figure><p>node01上,grid用户,执行如下命令验证是否删除</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">srvctl config database -d orcl</div></pre></td></tr></table></figure><p>结果如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div></pre></td><td class="code"><pre><div class="line">[grid@node01 ~]$ srvctl config database -d orcl</div><div class="line">Database unique name: orcl</div><div class="line">Database name: orcl</div><div class="line">Oracle home: /u01/app/oracle/product/12.2.0/dbhome_1</div><div class="line">Oracle user: oracle</div><div class="line">Spfile: +DATA/ORCL/PARAMETERFILE/spfile.277.961430953</div><div class="line">Password file: +DATA/ORCL/PASSWORD/pwdorcl.256.961427153</div><div class="line">Domain: myCluster.com</div><div class="line">Start options: open</div><div class="line">Stop options: immediate</div><div class="line">Database role: PRIMARY</div><div class="line">Management policy: AUTOMATIC</div><div class="line">Server pools:</div><div class="line">Disk Groups: DATA</div><div class="line">Mount point paths:</div><div class="line">Services:</div><div class="line">Type: RAC</div><div class="line">Start concurrency:</div><div class="line">Stop concurrency:</div><div class="line">OSDBA group: dba</div><div class="line">OSOPER group: oper</div><div class="line">Database instances: orcl1,orcl2</div><div class="line">Configured nodes: node01,node02</div><div class="line">CSS critical: no</div><div class="line">CPU count: 0</div><div class="line">Memory target: 0</div><div class="line">Maximum memory: 0</div><div class="line">Default network number for database services:</div><div class="line">Database is administrator managed</div></pre></td></tr></table></figure><p>重点关注 Database instance,发现没有orcl3</p><h3 id="停止node03的lisenter"><a href="#停止node03的lisenter" class="headerlink" title="停止node03的lisenter"></a>停止node03的lisenter</h3><p>在任意一个可用节点上,这里用node01,grid用户执行如下命令</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">srvctl disable listener -l LISTENER -n node03</div><div class="line">srvctl stop listener -l LISTENER -n node03</div></pre></td></tr></table></figure><h3 id="在node1上更新inventory"><a href="#在node1上更新inventory" class="headerlink" title="在node1上更新inventory"></a>在node1上更新inventory</h3><p>node01,oracle用户,执行如下命令</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">[oracle@node01 ~]$ echo $ORACLE_HOME</div><div class="line">/u01/app/oracle/product/12.2.0/dbhome_1</div><div class="line">[oracle@node01 bin]$ cd $ORACLE_HOME/oui/bin</div><div class="line">[oracle@node01 bin]$ ./runInstaller -updatenodelist ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 "CLUSTER_NODES={node01,node02}"</div><div class="line"></div><div class="line">Starting Oracle Universal Installer...</div><div class="line">Checking swap space: must be greater than 500 MB. Actual 8191 MB Passed</div><div class="line">The inventory pointer is located at /etc/oraInst.loc</div><div class="line">'UpdateNodeList' was successful.</div></pre></td></tr></table></figure><h3 id="在node03运行deinstall"><a href="#在node03运行deinstall" class="headerlink" title="在node03运行deinstall"></a>在node03运行deinstall</h3><p>node03,oracle用户,执行如下命令</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[oracle@node03 ~]$ cd $ORACLE_HOME/deinstall </div><div class="line">[oracle@node03 deinstall]$ ./deinstall -local</div></pre></td></tr></table></figure><h3 id="GRID层面删除node03"><a href="#GRID层面删除node03" class="headerlink" title="GRID层面删除node03"></a>GRID层面删除node03</h3><h4 id="检查"><a href="#检查" class="headerlink" title="检查"></a>检查</h4><p>node01上,grid用户,执行如下面命令检查</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[grid@node01 ~]$ olsnodes -s -t</div><div class="line">node01 Active Unpinned</div><div class="line">node02 Active Unpinned</div><div class="line">node03 Active Unpinned</div></pre></td></tr></table></figure><p>如果为node03pinned,使用如下命令设为Unpinned</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">crsctl unpin css-n node03</div></pre></td></tr></table></figure><h4 id="在node03节点执行以root用户执行deconfig"><a href="#在node03节点执行以root用户执行deconfig" class="headerlink" title="在node03节点执行以root用户执行deconfig"></a>在node03节点执行以root用户执行deconfig</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@node03 ~]# cd /u01/app/12.2.0/grid/crs/install/</div><div class="line">[root@node03 install]# ./rootcrs.sh -deconfig -deinstall -force</div></pre></td></tr></table></figure><p>结果如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div></pre></td><td class="code"><pre><div class="line">[root@node03 install]# ./rootcrs.sh -deconfig -deinstall -force</div><div class="line">Using configuration parameter file: /u01/app/12.2.0/grid/crs/install/crsconfig_params</div><div class="line">The log of current session can be found at:</div><div class="line"> /u01/app/grid/crsdata/node03/crsconfig/crsdeconfig_node03_2017-12-05_05-23-51PM.log</div><div class="line">CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'node03'</div><div class="line">CRS-2673: Attempting to stop 'ora.crsd' on 'node03'</div><div class="line">CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on server 'node03'</div><div class="line">CRS-2673: Attempting to stop 'ora.DATA.dg' on 'node03'</div><div class="line">CRS-2673: Attempting to stop 'ora.OCR_VOT_GIMR.dg' on 'node03'</div><div class="line">CRS-2673: Attempting to stop 'ora.chad' on 'node03'</div><div class="line">CRS-2677: Stop of 'ora.OCR_VOT_GIMR.dg' on 'node03' succeeded</div><div class="line">CRS-2677: Stop of 'ora.DATA.dg' on 'node03' succeeded</div><div class="line">CRS-2673: Attempting to stop 'ora.asm' on 'node03'</div><div class="line">CRS-2677: Stop of 'ora.asm' on 'node03' succeeded</div><div class="line">CRS-2673: Attempting to stop 'ora.ASMNET1LSNR_ASM.lsnr' on 'node03'</div><div class="line">CRS-2677: Stop of 'ora.chad' on 'node03' succeeded</div><div class="line">CRS-2677: Stop of 'ora.ASMNET1LSNR_ASM.lsnr' on 'node03' succeeded</div><div class="line">CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'node03' has completed</div><div class="line">CRS-2677: Stop of 'ora.crsd' on 'node03' succeeded</div><div class="line">CRS-2673: Attempting to stop 'ora.asm' on 'node03'</div><div class="line">CRS-2673: Attempting to stop 'ora.crf' on 'node03'</div><div class="line">CRS-2673: Attempting to stop 'ora.gpnpd' on 'node03'</div><div class="line">CRS-2673: Attempting to stop 'ora.mdnsd' on 'node03'</div><div class="line">CRS-2677: Stop of 'ora.crf' on 'node03' succeeded</div><div class="line">CRS-2677: Stop of 'ora.gpnpd' on 'node03' succeeded</div><div class="line">CRS-2677: Stop of 'ora.mdnsd' on 'node03' succeeded</div><div class="line">CRS-2677: Stop of 'ora.asm' on 'node03' succeeded</div><div class="line">CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'node03'</div><div class="line">CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'node03' succeeded</div><div class="line">CRS-2673: Attempting to stop 'ora.ctssd' on 'node03'</div><div class="line">CRS-2673: Attempting to stop 'ora.evmd' on 'node03'</div><div class="line">CRS-2677: Stop of 'ora.ctssd' on 'node03' succeeded</div><div class="line">CRS-2677: Stop of 'ora.evmd' on 'node03' succeeded</div><div class="line">CRS-2673: Attempting to stop 'ora.cssd' on 'node03'</div><div class="line">CRS-2677: Stop of 'ora.cssd' on 'node03' succeeded</div><div class="line">CRS-2673: Attempting to stop 'ora.gipcd' on 'node03'</div><div class="line">CRS-2677: Stop of 'ora.gipcd' on 'node03' succeeded</div><div class="line">CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'node03' has completed</div><div class="line">CRS-4133: Oracle High Availability Services has been stopped.</div><div class="line">2017/12/05 17:24:42 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector.</div><div class="line">2017/12/05 17:24:55 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector.</div><div class="line">2017/12/05 17:24:57 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node</div></pre></td></tr></table></figure><h4 id="验证结果"><a href="#验证结果" class="headerlink" title="验证结果"></a>验证结果</h4><p>node01上,grid用户,执行如下面命令检查</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[grid@node01 ~]$ olsnodes -s -t</div><div class="line">node01 Active Unpinned</div><div class="line">node02 Active Unpinned</div><div class="line">node03 Inactive Unpinned</div></pre></td></tr></table></figure><p>node03为Inactive</p><h4 id="在node01上删除节点node03的节点信息"><a href="#在node01上删除节点node03的节点信息" class="headerlink" title="在node01上删除节点node03的节点信息"></a>在node01上删除节点node03的节点信息</h4><p>node01上,root用户</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@node01 ~]# cd /u01/app/12.2.0/grid/bin/</div><div class="line">[root@node01 bin]# ./crsctl delete node -n node03</div><div class="line">CRS-4661: Node node03 successfully deleted.</div></pre></td></tr></table></figure><p>node01上,grid用户</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[grid@node01 ~]$ olsnodes -s -t</div><div class="line">node01 Active Unpinned</div><div class="line">node02 Active Unpinned</div></pre></td></tr></table></figure><h4 id="更新node03节点列表"><a href="#更新node03节点列表" class="headerlink" title="更新node03节点列表"></a>更新node03节点列表</h4><p>node03上,grid用户,执行如下命令</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[grid@node03 ~]$ cd /u01/app/12.2.0/grid/oui/bin/</div><div class="line">[grid@node03 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/12.2.0/grid/ "CLUSTER_NODES={node03}" CRS=TRUE -local</div><div class="line">Starting Oracle Universal Installer...</div><div class="line">Checking swap space: must be greater than 500 MB. Actual 8191 MB Passed</div><div class="line">The inventory pointer is located at /etc/oraInst.loc</div><div class="line">'UpdateNodeList' was successful.</div></pre></td></tr></table></figure><h4 id="在node03上删除grid"><a href="#在node03上删除grid" class="headerlink" title="在node03上删除grid"></a>在node03上删除grid</h4><p>node03上,grid用户,执行如下命令</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[grid@node03 bin]$ cd /u01/app/12.2.0/grid/deinstall/</div><div class="line">[grid@node03 deinstall]$ ./deinstall -local</div></pre></td></tr></table></figure><h4 id="node01节点上更新节点列表"><a href="#node01节点上更新节点列表" class="headerlink" title="node01节点上更新节点列表"></a>node01节点上更新节点列表</h4><p>node01上,grid用户</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[grid@node01 ~]$ cd /u01/app/12.2.0/grid/oui/bin/</div><div class="line">[grid@node01 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/12.2.0/grid "CLUSTER_NODES={node01,node02}" CRS=TRUE -silent</div><div class="line">Starting Oracle Universal Installer...</div><div class="line">Checking swap space: must be greater than 500 MB. Actual 8191 MB Passed</div><div class="line">The inventory pointer is located at /etc/oraInst.loc</div><div class="line">'UpdateNodeList' was successful.</div></pre></td></tr></table></figure><h4 id="验证是否删除成功"><a href="#验证是否删除成功" class="headerlink" title="验证是否删除成功"></a>验证是否删除成功</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">[grid@node01 bin]$ cluvfy stage -post nodedel -n node03</div><div class="line">Verifying Node Removal ...</div><div class="line"> Verifying CRS Integrity ...PASSED</div><div class="line"> Verifying Clusterware Version Consistency ...PASSED</div><div class="line">Verifying Node Removal ...PASSED</div><div class="line">Post-check for node removal was successful.</div><div class="line">CVU operation performed: stage -post nodedel</div><div class="line">Date: Dec 5, 2017 6:23:06 PM</div><div class="line">CVU home: /u01/app/12.2.0/grid/</div><div class="line">User: grid</div></pre></td></tr></table></figure><h3 id="附录"><a href="#附录" class="headerlink" title="附录"></a>附录</h3><p>如果出现vip没有删除的情况,可使用如下命令删除vip</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">cd /u01/app/12.2.0/grid/bin</div><div class="line">[root@bin]# srvctl stop vip ora.node03.vip</div><div class="line">[root@bin]# srvctl remove vip ora.node03.vip</div></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h3 id="目的"><a href="#目的" class="headerlink" title="目的"></a>目的</h3><p>删除节点node03</p>
<p>其中:</p>
<ul>
<li>数据库名为orcl</li>
<li>node03的实例名为orcl3</li>
</ul>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/categories/oracle/rac/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/tags/rac/"/>
</entry>
<entry>
<title>Oracle RAC 12CR2添加新节点</title>
<link href="https://shijieqin.github.io/2017/12/01/Oracle-RAC-12CR2%E6%B7%BB%E5%8A%A0%E6%96%B0%E8%8A%82%E7%82%B9/"/>
<id>https://shijieqin.github.io/2017/12/01/Oracle-RAC-12CR2添加新节点/</id>
<published>2017-12-01T06:20:37.000Z</published>
<updated>2017-12-01T06:20:37.000Z</updated>
<content type="html"><![CDATA[<h3 id="修改记录"><a href="#修改记录" class="headerlink" title="修改记录"></a>修改记录</h3><p>列出最近扩展节点遇到的一些问题。见文章最后。</p><p>1、扩展完节点之后,实例启动不成功,报<code>ORA-01618: redo thread 3 is not enabled - cannot mount</code></p><p>2、扩展完节点之后,实例启动不成功,报<code>ORA-30013: undo tablespace 'UNDOTBS1' is currently in use</code></p><h3 id="网段声明"><a href="#网段声明" class="headerlink" title="网段声明"></a>网段声明</h3><p>在之前安装的rac基础上添加新节点,启动node01、node02为原rac,node03为新添加节点</p><table><thead><tr><th>Name</th><th>node01</th><th>node02</th><th>node03</th></tr></thead><tbody><tr><td>Public IP</td><td>192.168.1.14</td><td>192.168.1.15</td><td>192.168.1.16</td></tr><tr><td>Private IP</td><td>192.168.6.2</td><td>192.168.6.3</td><td>192.168.6.4</td></tr><tr><td>Virtual IP</td><td>192.168.1.17</td><td>192.168.1.18</td><td>192.168.1.22</td></tr><tr><td>SCAN IP</td><td>192.168.1.19</td><td>192.168.1.120</td><td>192.168.1.21</td></tr><tr><td>NET IP</td><td>192.168.2.95</td><td>192.168.2.96</td><td>192.168.2.55</td></tr></tbody></table><a id="more"></a><h3 id="准备"><a href="#准备" class="headerlink" title="准备"></a>准备</h3><p>参考<a href="/2017/11/23/hwcloud上的Oracle-RAC-12cR2安装手册-1-环境的准备/" title="hwcloud上的Oracle RAC 12cR2安装手册(1)—环境准备">hwcloud上的Oracle RAC 12cR2安装手册(1)—环境准备</a>做如下准备:</p><ul><li>IP分配</li><li>安全组</li><li>修改主机名</li><li>配置host解析</li><li>关闭libvirt</li><li>禁用ZEROCONF</li><li>安装依赖</li><li>配置swap</li><li>配置内核</li><li>关闭NTP</li><li>配置PAM</li><li>修改limit文件</li><li>关闭SELinux</li><li>创建用户,用户组和文件夹</li><li>配置grid和oracle用户的环境变量</li><li>配置ssh互信</li><li>挂载共享存储到node03上,安装asmlib,使用<code>oracleasm scandisks</code>扫描磁盘组</li></ul><h3 id="安装Grid"><a href="#安装Grid" class="headerlink" title="安装Grid"></a>安装Grid</h3><h4 id="环境检查"><a href="#环境检查" class="headerlink" title="环境检查"></a>环境检查</h4><p>node01上,grid用户,执行如下命令进行node03的环境检查</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cluvfy stage -pre nodeadd -n node03 -fixup -verbose</div></pre></td></tr></table></figure><p>执行结果如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">CVU operation performed: stage -pre nodeadd</div><div class="line">Date: Dec 1, 2017 3:40:21 PM</div><div class="line">CVU home: /u01/app/12.2.0/grid/</div><div class="line">User: grid</div><div class="line">******************************************************************************************</div><div class="line">Following is the list of fixable prerequisites selected to fix in this session</div><div class="line">******************************************************************************************</div><div class="line">-------------- --------------- ----------------</div><div class="line">Check failed. Failed on nodes Reboot required?</div><div class="line">-------------- --------------- ----------------</div><div class="line">Package: cvuqdisk-1.0.10-1 node03 no</div><div class="line">Execute "/tmp/CVU_12.2.0.1.0_grid/runfixup.sh" as root user on nodes "node03" to perform the fix up operations manually</div><div class="line">Press ENTER key to continue after execution of "/tmp/CVU_12.2.0.1.0_grid/runfixup.sh" has completed on nodes "node03"</div></pre></td></tr></table></figure><p>根据提示,在node03上用root用户执行修复脚本,结果如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">Press ENTER key to continue after execution of "/tmp/CVU_12.2.0.1.0_grid/runfixup.sh" has completed on nodes "node03"</div><div class="line">Fix: Package: cvuqdisk-1.0.10-1</div><div class="line"> Node Name Status</div><div class="line"> ------------------------------------ ------------------------</div><div class="line"> node03 successful</div><div class="line">Result:</div><div class="line">"Package: cvuqdisk-1.0.10-1" was successfully fixed on all the applicable nodes</div><div class="line">[grid@node01 ~]$</div></pre></td></tr></table></figure><h4 id="临时禁用dns解析"><a href="#临时禁用dns解析" class="headerlink" title="临时禁用dns解析"></a>临时禁用dns解析</h4><p>由于grid安装时会校验dns中是否能检查到节点信息,图形化安装时可以手动忽略,这里静默添加,不能忽略,会报错退出,如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">INFO: [Dec 1, 2017 4:46:51 PM] resolv.conf Integrity: resolv.conf Integrity</div><div class="line">INFO: [Dec 1, 2017 4:46:51 PM] Severity:CRITICAL</div><div class="line">INFO: [Dec 1, 2017 4:46:51 PM] OverallStatus:VERIFICATION_FAILED</div><div class="line">INFO: [Dec 1, 2017 4:46:51 PM] *********************************************</div><div class="line">INFO: [Dec 1, 2017 4:46:51 PM] (Linux) resolv.conf Integrity: This task checks consistency of file /etc/resolv.conf file across nodes</div><div class="line">INFO: [Dec 1, 2017 4:46:51 PM] Severity:CRITICAL</div><div class="line">INFO: [Dec 1, 2017 4:46:51 PM] OverallStatus:VERIFICATION_FAILED</div></pre></td></tr></table></figure><p>所以临时禁用,如下:</p><p>node01, node02, node03节点,root用户</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">mv /etc/resolv.conf /etc/resolv.conf.bak</div></pre></td></tr></table></figure><h4 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h4><p>node01上,grid用户,执行如下命令:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cd $ORACLE_HOME/addnode</div><div class="line">./addnode.sh -silent "CLUSTER_NEW_NODES={node03}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={node03-vip.myCluster.com}" "CLUSTER_NEW_PUBLIC_HOSTNAMES={node03.myCluster.com}" "CLUSTER_NEW_NODE_ROLES={HUB}"</div></pre></td></tr></table></figure><p><strong><em>注:</em></strong></p><p><strong><em>以上参数都参考图形化安装时的配置</em></strong></p><p>结果如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">As a root user, execute the following script(s):</div><div class="line">1. /u01/app/oraInventory/orainstRoot.sh</div><div class="line">2. /u01/app/12.2.0/grid/root.sh</div><div class="line"></div><div class="line">Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes: </div><div class="line">[node03]</div><div class="line">Execute /u01/app/12.2.0/grid/root.sh on the following nodes: </div><div class="line">[node03]</div><div class="line"></div><div class="line">The scripts can be executed in parallel on all the nodes.</div><div class="line"></div><div class="line">.................................................. 100% Done.</div><div class="line">Successfully Setup Software.</div></pre></td></tr></table></figure><p>根据提示,用root用户在node03执行<code>/u01/app/oraInventory/orainstRoot.sh</code>,<code>/u01/app/12.2.0/grid/root.sh</code>即可</p><h3 id="安装oracle软件"><a href="#安装oracle软件" class="headerlink" title="安装oracle软件"></a>安装oracle软件</h3><p>node01上,oracle用户,执行如下命令:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cd $ORACLE_HOME/addnode</div><div class="line">./addnode.sh -silent "CLUSTER_NEW_NODES={node03}"</div></pre></td></tr></table></figure><p>结果如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">As a root user, execute the following script(s):</div><div class="line">1. /u01/app/oracle/product/12.2.0/dbhome_1/root.sh</div><div class="line"></div><div class="line">Execute /u01/app/oracle/product/12.2.0/dbhome_1/root.sh on the following nodes: </div><div class="line">[node03]</div><div class="line"></div><div class="line"></div><div class="line">.................................................. 100% Done.</div><div class="line">Successfully Setup Software.</div></pre></td></tr></table></figure><p>根据提示,使用root用户,在node03上执行<code>/u01/app/oracle/product/12.2.0/dbhome_1/root.sh</code>即可</p><h3 id="安装instance"><a href="#安装instance" class="headerlink" title="安装instance"></a>安装instance</h3><p>node01上,oracle用户,执行如下命令:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">dbca -silent -addInstance -nodeName node03 -gdbName orcl.myCluster.com -instanceName orcl3 -sysDBAUserName sys -sysDBAPassword Hand1234</div></pre></td></tr></table></figure><p>结果如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line">[oracle@node01 ~]$ dbca -silent -addInstance -nodeName node03 -gdbName orcl.myCluster.com -instanceName orcl3 -sysDBAUserName sys -sysDBAPassword Hand1234</div><div class="line">Adding instance</div><div class="line">1% complete</div><div class="line">2% complete</div><div class="line">6% complete</div><div class="line">13% complete</div><div class="line">20% complete</div><div class="line">26% complete</div><div class="line">33% complete</div><div class="line">40% complete</div><div class="line">46% complete</div><div class="line">53% complete</div><div class="line">66% complete</div><div class="line">Completing instance management.</div><div class="line">76% complete</div><div class="line">100% complete</div><div class="line">Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.</div></pre></td></tr></table></figure><p><strong><em>注:</em></strong></p><ul><li><strong><em>安装过程中,出现找不到磁盘组的情况</em></strong></li><li><strong><em>后把u01文件夹按之前的授权重新授权,重启服务器出现原来的RAC无法启动的问题,报错为CRS-0184 Cannot Communicate With The Crs Daemon in Oracle</em></strong></li><li><strong><em>通过在三个节点(其实只需在无法启动的节点)执行安装grid时和oracle生成的root.sh文件之后,能够正常启动数据库</em></strong></li><li><strong><em>安装第三个节点的实例能找到ASM磁盘</em></strong></li></ul><h3 id="验证"><a href="#验证" class="headerlink" title="验证"></a>验证</h3><h4 id="集群层"><a href="#集群层" class="headerlink" title="集群层"></a>集群层</h4><ul><li>crsctl check crs</li><li>crsctl check cluster -all</li><li>crsctl status res -t</li></ul><h4 id="应用层"><a href="#应用层" class="headerlink" title="应用层"></a>应用层</h4><ul><li>srvctl status nodeapps</li><li>srvctl status asm</li><li>srvctl status listener</li><li>srvctl status instance -d orcl -i orcl1,orcl2,orcl3</li></ul><h3 id="最后"><a href="#最后" class="headerlink" title="最后"></a>最后</h3><p>记得恢复/etc/resolv.conf !!!</p><h3 id="问题总结"><a href="#问题总结" class="headerlink" title="问题总结"></a>问题总结</h3><h4 id="ORA-01618-redo-thread-3-is-not-enabled-cannot-mount"><a href="#ORA-01618-redo-thread-3-is-not-enabled-cannot-mount" class="headerlink" title="ORA-01618: redo thread 3 is not enabled - cannot mount"></a>ORA-01618: redo thread 3 is not enabled - cannot mount</h4><h5 id="在可以使用的节点上检查redo日志组"><a href="#在可以使用的节点上检查redo日志组" class="headerlink" title="在可以使用的节点上检查redo日志组"></a>在可以使用的节点上检查redo日志组</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">SQL> set lines 200</div><div class="line">SQL> select * from v$Log;</div><div class="line"> GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCHIVED STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME CON_ID</div><div class="line">---------- ---------- ---------- ---------- ---------- ---------- --------- ------------------------------------------------ ------------- --------------- ------------ --------------- ----------</div><div class="line"> 1 1 4429 209715200 512 1 NO CURRENT 3711801002 21-MAR-18 1.8447E+19 0</div><div class="line"> 2 1 4428 209715200 512 1 NO ACTIVE 3711526576 21-MAR-18 3711801002 21-MAR-18 0</div><div class="line"> 3 2 4623 209715200 512 1 NO CURRENT 3711753735 21-MAR-18 1.8447E+19 0</div><div class="line"> 4 2 4622 209715200 512 1 NO INACTIVE 3711406786 21-MAR-18 3711753735 21-MAR-18 0</div></pre></td></tr></table></figure><h5 id="在可以使用的节点上添加thread-3日志"><a href="#在可以使用的节点上添加thread-3日志" class="headerlink" title="在可以使用的节点上添加thread 3日志"></a>在可以使用的节点上添加thread 3日志</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line">SQL> alter database add logfile thread 3('+DATA','+DATA') size 200m;</div><div class="line">Database altered.</div><div class="line">SQL> alter database add logfile thread 3('+DATA','+DATA') size 200m;</div><div class="line">Database altered.</div><div class="line">SQL> select * from v$Log;</div><div class="line"> GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCHIVED STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME CON_ID</div><div class="line">---------- ---------- ---------- ---------- ---------- ---------- --------- ------------------------------------------------ ------------- --------------- ------------ --------------- ----------</div><div class="line"> 1 1 4429 209715200 512 1 NO CURRENT 3711801002 21-MAR-18 1.8447E+19 0</div><div class="line"> 2 1 4428 209715200 512 1 NO INACTIVE 3711526576 21-MAR-18 3711801002 21-MAR-18 0</div><div class="line"> 3 2 4623 209715200 512 1 NO CURRENT 3711753735 21-MAR-18 1.8447E+19 0</div><div class="line"> 4 2 4622 209715200 512 1 NO INACTIVE 3711406786 21-MAR-18 3711753735 21-MAR-18 0</div><div class="line"> 5 3 0 209715200 512 2 YES UNUSED 0 0 0</div><div class="line"> 6 3 0 209715200 512 2 YES UNUSED 0 0 0</div><div class="line">6 rows selected.</div><div class="line">SQL> alter database enable thread 3;</div><div class="line">Database altered.</div></pre></td></tr></table></figure><h4 id="ORA-30013-undo-tablespace-‘UNDOTBS1’-is-currently-in-use"><a href="#ORA-30013-undo-tablespace-‘UNDOTBS1’-is-currently-in-use" class="headerlink" title="ORA-30013: undo tablespace ‘UNDOTBS1’ is currently in use"></a>ORA-30013: undo tablespace ‘UNDOTBS1’ is currently in use</h4><h5 id="在可用节点查看现有undo表空间"><a href="#在可用节点查看现有undo表空间" class="headerlink" title="在可用节点查看现有undo表空间"></a>在可用节点查看现有undo表空间</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">select tablespace_name,</div><div class="line"> file_name,</div><div class="line"> AUTOEXTENSIBLE,</div><div class="line"> bytes / 1024 / 1024 size_mb</div><div class="line"> from dba_data_files</div><div class="line"> where tablespace_name like '%UNDO%';</div></pre></td></tr></table></figure><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div></pre></td><td class="code"><pre><div class="line">TABLESPACE_NAME</div><div class="line">------------------------------------------------------------------------------------------</div><div class="line">FILE_NAME</div><div class="line">--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</div><div class="line">AUTOEXTEN SIZE_MB</div><div class="line">--------- ----------</div><div class="line">UNDOTBS1</div><div class="line">+DATA/SRMCLOUD/DATAFILE/undotbs1.278.963232783</div><div class="line">YES 3805</div><div class="line">UNDOTBS2</div><div class="line">+DATA/SRMCLOUD/DATAFILE/undotbs2.273.963232811</div><div class="line">YES 3075</div><div class="line">TABLESPACE_NAME</div><div class="line">------------------------------------------------------------------------------------------</div><div class="line">FILE_NAME</div><div class="line">--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</div><div class="line">AUTOEXTEN SIZE_MB</div><div class="line">--------- ----------</div><div class="line">UNDOTBS3</div><div class="line">+DATA/SRMCLOUD/DATAFILE/undotbs3.579.971361293</div><div class="line">YES 3805</div></pre></td></tr></table></figure><p>发现是有undotbs3的表空间,因此只需要修改第三节点的undo即可</p><h5 id="在可用节点修改第三节点的undo表空间"><a href="#在可用节点修改第三节点的undo表空间" class="headerlink" title="在可用节点修改第三节点的undo表空间"></a>在可用节点修改第三节点的undo表空间</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">SQL> alter system set undo_tablespace='UNDOTBS3' sid='srmcloud3';</div><div class="line">System altered.</div><div class="line">SQL></div></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h3 id="修改记录"><a href="#修改记录" class="headerlink" title="修改记录"></a>修改记录</h3><p>列出最近扩展节点遇到的一些问题。见文章最后。</p>
<p>1、扩展完节点之后,实例启动不成功,报<code>ORA-01618: redo thread 3 is not enabled - cannot mount</code></p>
<p>2、扩展完节点之后,实例启动不成功,报<code>ORA-30013: undo tablespace &#39;UNDOTBS1&#39; is currently in use</code></p>
<h3 id="网段声明"><a href="#网段声明" class="headerlink" title="网段声明"></a>网段声明</h3><p>在之前安装的rac基础上添加新节点,启动node01、node02为原rac,node03为新添加节点</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>node01</th>
<th>node02</th>
<th>node03</th>
</tr>
</thead>
<tbody>
<tr>
<td>Public IP</td>
<td>192.168.1.14</td>
<td>192.168.1.15</td>
<td>192.168.1.16</td>
</tr>
<tr>
<td>Private IP</td>
<td>192.168.6.2</td>
<td>192.168.6.3</td>
<td>192.168.6.4</td>
</tr>
<tr>
<td>Virtual IP</td>
<td>192.168.1.17</td>
<td>192.168.1.18</td>
<td>192.168.1.22</td>
</tr>
<tr>
<td>SCAN IP</td>
<td>192.168.1.19</td>
<td>192.168.1.120</td>
<td>192.168.1.21</td>
</tr>
<tr>
<td>NET IP</td>
<td>192.168.2.95</td>
<td>192.168.2.96</td>
<td>192.168.2.55</td>
</tr>
</tbody>
</table>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/categories/oracle/rac/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/tags/rac/"/>
</entry>
<entry>
<title>hwcloud上的Oracle-RAC-12cR2安装手册(4)--数据库实例的创建</title>
<link href="https://shijieqin.github.io/2017/11/30/hwcloud%E4%B8%8A%E7%9A%84Oracle-RAC-12cR2%E5%AE%89%E8%A3%85%E6%89%8B%E5%86%8C-4-%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AE%9E%E4%BE%8B%E7%9A%84%E5%88%9B%E5%BB%BA/"/>
<id>https://shijieqin.github.io/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/</id>
<published>2017-11-30T05:50:02.000Z</published>
<updated>2017-11-30T05:50:02.000Z</updated>
<content type="html"><![CDATA[<p>node01上,oracle用户,执行<code>dbca</code>,如下:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[oracle@node01 ~]$ dbca</div></pre></td></tr></table></figure><p>安装过程如下:</p><a id="more"></a><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step1.png" alt="创建一个数据库" title="创建一个数据库"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step2.png" alt="高级配置" title="高级配置"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step3.png" alt="安装RAC,选择自定义数据库" title="安装RAC,选择自定义数据库"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step4.png" alt="选择所有节点" title="选择所有节点"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step5.png" alt="设置全局数据库名和SID前缀,选择创建空白容器数据库" title="设置全局数据库名和SID前缀,选择创建空白容器数据库"><p><strong><em>注:</em></strong><br><strong><em>此处的SID前缀需要与环境变量里的ORACLE_SID对应:</em></strong><br><strong><em>例如,SID前缀设置orcl,ORACLE_SID需要设置为orcl1和orcl2。</em></strong></p><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step6.png" alt="选择ASM存储类型并选择DATA磁盘组" title="选择ASM存储类型并选择DATA磁盘组"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step7-2.png" alt="启用快速闪回去,并选择DATA磁盘组,大小根据实际需求设置,忽略提示,直接确定" title="启用快速闪回去,并选择DATA磁盘组,大小根据实际需求设置,忽略提示,直接确定"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step8.png" alt="默认" title="默认"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step9.png" alt="选择自动共享内存管理,并设置MEMORY_TARGET,建议物理内存的80%" title="选择自动共享内存管理,并设置MEMORY_TARGET,建议物理内存的80%"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step9-2.png" alt="块大小设置为32768B,进程数设置为1500" title="块大小设置为32768B,进程数设置为1500"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step9-3.png" alt="字符集选择AL32UTF8" title="字符集选择AL32UTF8"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step9-4.png" alt="选择专用服务器模式" title="选择专用服务器模式"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step10.png" alt="不启用EM" title="不启用EM"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step11.png" alt="使用统一密码" title="使用统一密码"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step12.png" alt="创建数据库" title="创建数据库"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step12-2.png" alt="忽略警告,确认" title="忽略警告,确认"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step13.png" alt="检查" title="检查"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step13-2.png" alt="忽略" title="忽略"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step13-3.png" alt="确认" title="确认"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step14.png" alt="配置完成" title="配置完成"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step15.png" alt="安装进行中" title="安装进行中"><img src="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/Step16.png" alt="安装完成,关闭" title="安装完成,关闭"><p>node01、node02上,oracle用户,执行<code>lsnrctl status</code>查看实例运行状态</p><p>node01:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div></pre></td><td class="code"><pre><div class="line">[oracle@node01 ~]$ lsnrctl status</div><div class="line">LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 30-NOV-2017 17:27:08</div><div class="line">Copyright (c) 1991, 2016, Oracle. All rights reserved.</div><div class="line">Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))</div><div class="line">STATUS of the LISTENER</div><div class="line">------------------------</div><div class="line">Alias LISTENER</div><div class="line">Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production</div><div class="line">Start Date 29-NOV-2017 18:45:30</div><div class="line">Uptime 0 days 22 hr. 41 min. 37 sec</div><div class="line">Trace Level off</div><div class="line">Security ON: Local OS Authentication</div><div class="line">SNMP OFF</div><div class="line">Listener Parameter File /u01/app/12.2.0/grid/network/admin/listener.ora</div><div class="line">Listener Log File /u01/app/grid/diag/tnslsnr/node01/listener/alert/log.xml</div><div class="line">Listening Endpoints Summary...</div><div class="line"> (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))</div><div class="line"> (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.14)(PORT=1521)))</div><div class="line"> (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.17)(PORT=1521)))</div><div class="line">Services Summary...</div><div class="line">Service "+ASM" has 1 instance(s).</div><div class="line"> Instance "+ASM1", status READY, has 1 handler(s) for this service...</div><div class="line">Service "+ASM_DATA" has 1 instance(s).</div><div class="line"> Instance "+ASM1", status READY, has 1 handler(s) for this service...</div><div class="line">Service "+ASM_OCR_VOT_GIMR" has 1 instance(s).</div><div class="line"> Instance "+ASM1", status READY, has 1 handler(s) for this service...</div><div class="line">Service "orcl.myCluster.com" has 1 instance(s).</div><div class="line"> Instance "orcl1", status READY, has 1 handler(s) for this service...</div><div class="line">Service "orclXDB.myCluster.com" has 1 instance(s).</div><div class="line"> Instance "orcl1", status READY, has 1 handler(s) for this service...</div><div class="line">The command completed successfully</div></pre></td></tr></table></figure><p>node02:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div></pre></td><td class="code"><pre><div class="line">[oracle@node02 ~]$ lsnrctl status</div><div class="line">LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 30-NOV-2017 17:29:46</div><div class="line">Copyright (c) 1991, 2016, Oracle. All rights reserved.</div><div class="line">Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))</div><div class="line">STATUS of the LISTENER</div><div class="line">------------------------</div><div class="line">Alias LISTENER</div><div class="line">Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production</div><div class="line">Start Date 29-NOV-2017 18:57:02</div><div class="line">Uptime 0 days 22 hr. 32 min. 43 sec</div><div class="line">Trace Level off</div><div class="line">Security ON: Local OS Authentication</div><div class="line">SNMP OFF</div><div class="line">Listener Parameter File /u01/app/12.2.0/grid/network/admin/listener.ora</div><div class="line">Listener Log File /u01/app/grid/diag/tnslsnr/node02/listener/alert/log.xml</div><div class="line">Listening Endpoints Summary...</div><div class="line"> (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))</div><div class="line"> (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.15)(PORT=1521)))</div><div class="line"> (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.18)(PORT=1521)))</div><div class="line">Services Summary...</div><div class="line">Service "+ASM" has 1 instance(s).</div><div class="line"> Instance "+ASM2", status READY, has 1 handler(s) for this service...</div><div class="line">Service "+ASM_DATA" has 1 instance(s).</div><div class="line"> Instance "+ASM2", status READY, has 1 handler(s) for this service...</div><div class="line">Service "+ASM_OCR_VOT_GIMR" has 1 instance(s).</div><div class="line"> Instance "+ASM2", status READY, has 1 handler(s) for this service...</div><div class="line">Service "orcl.myCluster.com" has 1 instance(s).</div><div class="line"> Instance "orcl2", status READY, has 1 handler(s) for this service...</div><div class="line">Service "orclXDB.myCluster.com" has 1 instance(s).</div><div class="line"> Instance "orcl2", status READY, has 1 handler(s) for this service...</div><div class="line">The command completed successfully</div></pre></td></tr></table></figure><p>node01、node02上,oracle用户,执行<code>sqlplus / as sysdba</code>尝试登录数据库,并执行<code>show pdbs;</code>查看pdb状态</p><p>node01:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">[oracle@node01 ~]$ sqlplus / as sysdba</div><div class="line">SQL*Plus: Release 12.2.0.1.0 Production on Thu Nov 30 17:37:41 2017</div><div class="line">Copyright (c) 1982, 2016, Oracle. All rights reserved.</div><div class="line">Connected to:</div><div class="line">Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production</div><div class="line">SQL> show pdbs;</div><div class="line"> CON_ID CON_NAME OPEN MODE RESTRICTED</div><div class="line">---------- ------------------------------ ---------- ----------</div><div class="line"> 2 PDB$SEED READ ONLY NO</div><div class="line">SQL></div></pre></td></tr></table></figure><p>node02:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">[oracle@node02 ~]$ sqlplus / as sysdba</div><div class="line">SQL*Plus: Release 12.2.0.1.0 Production on Thu Nov 30 17:39:15 2017</div><div class="line">Copyright (c) 1982, 2016, Oracle. All rights reserved.</div><div class="line">Connected to:</div><div class="line">Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production</div><div class="line">SQL> show pdbs;</div><div class="line"> CON_ID CON_NAME OPEN MODE RESTRICTED</div><div class="line">---------- ------------------------------ ---------- ----------</div><div class="line"> 2 PDB$SEED READ ONLY NO</div><div class="line">SQL></div></pre></td></tr></table></figure><p>至此,完成了数据库实例的创建,ORACLE RAC安装完成,后面测试ORACLE RAC个节点分开调整服务器配置,敬请期待。</p>]]></content>
<summary type="html">
<p>node01上,oracle用户,执行<code>dbca</code>,如下:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[oracle@node01 ~]$ dbca</div></pre></td></tr></table></figure>
<p>安装过程如下:</p>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/categories/oracle/rac/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/tags/rac/"/>
</entry>
<entry>
<title>hwcloud上的Oracle-RAC-12cR2安装手册(3)--oracle软件的安装</title>
<link href="https://shijieqin.github.io/2017/11/29/hwcloud%E4%B8%8A%E7%9A%84Oracle-RAC-12cR2%E5%AE%89%E8%A3%85%E6%89%8B%E5%86%8C-3-oracle%E8%BD%AF%E4%BB%B6%E7%9A%84%E5%AE%89%E8%A3%85/"/>
<id>https://shijieqin.github.io/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/</id>
<published>2017-11-29T12:38:13.000Z</published>
<updated>2017-11-29T12:38:13.000Z</updated>
<content type="html"><![CDATA[<p>node01上,oracle用户</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cd /u01/software/database/</div><div class="line">./runInstaller</div></pre></td></tr></table></figure><p>安装过程如下:</p><a id="more"></a><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step1.png" alt="取消安全更新" title="取消安全更新"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step1-2.png" alt="确认" title="确认"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step2.png" alt="仅安装数据库软件" title="仅安装数据库软件"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step3.png" alt="选择安装RAC" title="选择安装RAC"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step4.png" alt="选择所有节点" title="选择所有节点"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step5.png" alt="安装企业版" title="安装企业版"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step6.png" alt="确认安装目录" title="确认安装目录"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step7.png" alt="默认" title="默认"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step8.png" alt="检查" title="检查"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step8-2.png" alt="忽略全部,无需考虑DNS的报错,因为使用了host文件指定相关域名" title="忽略全部,无需考虑DNS的报错,因为使用了host文件指定相关域名"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step8-3.png" alt="确认继续" title="确认继续"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step9.png" alt="安装" title="安装"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step10.png" alt="安装进行中" title="安装进行中"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step10-2.png" alt="需要root用户执行脚本" title="需要root用户执行脚本"><p>node01、node02上,root用户,执行<code>/u01/app/oracle/product/12.2.0/dbhome_1/root.sh</code>如下:</p><p>node01:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">[root@node01 ~]# /u01/app/oracle/product/12.2.0/dbhome_1/root.sh</div><div class="line">Performing root user operation.</div><div class="line">The following environment variables are set as:</div><div class="line"> ORACLE_OWNER= oracle</div><div class="line"> ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1</div><div class="line">Enter the full pathname of the local bin directory: [/usr/local/bin]:</div><div class="line">The contents of "dbhome" have not changed. No need to overwrite.</div><div class="line">The contents of "oraenv" have not changed. No need to overwrite.</div><div class="line">The contents of "coraenv" have not changed. No need to overwrite.</div><div class="line">Entries will be added to the /etc/oratab file as needed by</div><div class="line">Database Configuration Assistant when a database is created</div><div class="line">Finished running generic part of root script.</div><div class="line">Now product-specific root actions will be performed.</div></pre></td></tr></table></figure><p>node02:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">[root@node02 ~]# /u01/app/oracle/product/12.2.0/dbhome_1/root.sh</div><div class="line">Performing root user operation.</div><div class="line">The following environment variables are set as:</div><div class="line"> ORACLE_OWNER= oracle</div><div class="line"> ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1</div><div class="line">Enter the full pathname of the local bin directory: [/usr/local/bin]:</div><div class="line">The contents of "dbhome" have not changed. No need to overwrite.</div><div class="line">The contents of "oraenv" have not changed. No need to overwrite.</div><div class="line">The contents of "coraenv" have not changed. No need to overwrite.</div><div class="line">Entries will be added to the /etc/oratab file as needed by</div><div class="line">Database Configuration Assistant when a database is created</div><div class="line">Finished running generic part of root script.</div><div class="line">Now product-specific root actions will be performed.</div></pre></td></tr></table></figure><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step10-3.png" alt="执行完成后,选择OK" title="执行完成后,选择OK"><img src="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/Step11.png" alt="关闭" title="关闭"><p>至此,完成了数据库软件的安装</p><p>接着看<a href="/2017/11/30/hwcloud上的Oracle-RAC-12cR2安装手册-4-数据库实例的创建/" title="hwcloud上的Oracle-RAC-12cR2安装手册(4)--数据库实例的创建">hwcloud上的Oracle-RAC-12cR2安装手册(4)--数据库实例的创建</a></p>]]></content>
<summary type="html">
<p>node01上,oracle用户</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cd /u01/software/database/</div><div class="line">./runInstaller</div></pre></td></tr></table></figure>
<p>安装过程如下:</p>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/categories/oracle/rac/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/tags/rac/"/>
</entry>
<entry>
<title>Centos6安装ASMLIB</title>
<link href="https://shijieqin.github.io/2017/11/27/abc/"/>
<id>https://shijieqin.github.io/2017/11/27/abc/</id>
<published>2017-11-27T08:30:19.000Z</published>
<updated>2017-11-27T08:30:19.000Z</updated>
<content type="html"><![CDATA[<h3 id="Centos6安装ASMLIB"><a href="#Centos6安装ASMLIB" class="headerlink" title="Centos6安装ASMLIB"></a>Centos6安装ASMLIB</h3><p>我这里操作系统用的是Centos 6.8,Centos 6系列和Redhat 6系列都可以按下面的方式安装,至于其他版本的下载连接,参考地址:<a href="http://www.oracle.com/technetwork/server-storage/linux/asmlib/index-101839.html?ssSourceSiteId=ocomen" target="_blank" rel="external">http://www.oracle.com/technetwork/server-storage/linux/asmlib/index-101839.html?ssSourceSiteId=ocomen</a></p><a id="more"></a><p><strong><em>注:以下操作需要在node01和node02两个节点上操作</em></strong></p><h4 id="下载相关软件"><a href="#下载相关软件" class="headerlink" title="下载相关软件"></a>下载相关软件</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@node01 ~]# wget http://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel6/amd64/2.1.8/oracleasm-support-2.1.8-1.el6.x86_64.rpm</div><div class="line">[root@node01 ~]# wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm</div></pre></td></tr></table></figure><h4 id="使用yum自动安装相关依赖"><a href="#使用yum自动安装相关依赖" class="headerlink" title="使用yum自动安装相关依赖"></a>使用yum自动安装相关依赖</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@node01 ~]# yum install oracleasm</div></pre></td></tr></table></figure><h4 id="使用yum本地安装下载好的两个安装包"><a href="#使用yum本地安装下载好的两个安装包" class="headerlink" title="使用yum本地安装下载好的两个安装包"></a>使用yum本地安装下载好的两个安装包</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@node01 ~]# yum localinstall oracleasmlib-2.0.4-1.el6.x86_64.rpm</div><div class="line">[root@node01 ~]# yum localinstall oracleasm-support-2.1.8-1.el6.x86_64.rpm</div></pre></td></tr></table></figure><h4 id="配置oracleasm服务"><a href="#配置oracleasm服务" class="headerlink" title="配置oracleasm服务"></a>配置oracleasm服务</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">[root@node01 ~]# oracleasm configure -i</div><div class="line">Configuring the Oracle ASM library driver.</div><div class="line">This will configure the on-boot properties of the Oracle ASM library</div><div class="line">driver. The following questions will determine whether the driver is</div><div class="line">loaded on boot and what permissions it will have. The current values</div><div class="line">will be shown in brackets ('[]'). Hitting <ENTER> without typing an</div><div class="line">answer will keep that current value. Ctrl-C will abort.</div><div class="line">Default user to own the driver interface []: grid</div><div class="line">Default group to own the driver interface []: asmadmin</div><div class="line">Start Oracle ASM library driver on boot (y/n) [n]: y</div><div class="line">Scan for Oracle ASM disks on boot (y/n) [y]: y</div><div class="line">Writing Oracle ASM library driver configuration: done</div></pre></td></tr></table></figure><h4 id="启动oracleasm"><a href="#启动oracleasm" class="headerlink" title="启动oracleasm"></a>启动oracleasm</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@node01 ~]# /etc/init.d/oracleasm enable</div></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h3 id="Centos6安装ASMLIB"><a href="#Centos6安装ASMLIB" class="headerlink" title="Centos6安装ASMLIB"></a>Centos6安装ASMLIB</h3><p>我这里操作系统用的是Centos 6.8,Centos 6系列和Redhat 6系列都可以按下面的方式安装,至于其他版本的下载连接,参考地址:<a href="http://www.oracle.com/technetwork/server-storage/linux/asmlib/index-101839.html?ssSourceSiteId=ocomen" target="_blank" rel="external">http://www.oracle.com/technetwork/server-storage/linux/asmlib/index-101839.html?ssSourceSiteId=ocomen</a></p>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="ASM" scheme="https://shijieqin.github.io/categories/oracle/ASM/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="ASM" scheme="https://shijieqin.github.io/tags/ASM/"/>
</entry>
<entry>
<title>centos6.8调整swap空间</title>
<link href="https://shijieqin.github.io/2017/11/27/centos6-8%E8%B0%83%E6%95%B4swap%E7%A9%BA%E9%97%B4/"/>
<id>https://shijieqin.github.io/2017/11/27/centos6-8调整swap空间/</id>
<published>2017-11-27T08:20:49.000Z</published>
<updated>2017-11-27T08:20:49.000Z</updated>
<content type="html"><![CDATA[<h3 id="起因"><a href="#起因" class="headerlink" title="起因"></a>起因</h3><p>安装数据库时,要求swap空间至少为8G大小,由于操作系统已经安装完成,因此需要用如下方式调整swap空间</p><a id="more"></a><h3 id="创建的swap文件"><a href="#创建的swap文件" class="headerlink" title="创建的swap文件"></a>创建的swap文件</h3><p>这里启用的swap会与默认的swap空间叠加使用,默认的是4G大小,因此这里只需要再创建4Gswap即可</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">fallocate -l 4g /var/swapfile</div><div class="line">chmod 600 /var/swapfile </div><div class="line">mkswap /var/swapfile</div></pre></td></tr></table></figure><h3 id="启用创建的swap文件"><a href="#启用创建的swap文件" class="headerlink" title="启用创建的swap文件"></a>启用创建的swap文件</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">swapon /var/swapfile</div></pre></td></tr></table></figure><h3 id="添加至fstab文件"><a href="#添加至fstab文件" class="headerlink" title="添加至fstab文件"></a>添加至fstab文件</h3><p>编辑/etc/fstab文件,添加如下内容</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">/var/swapfile swap swap defaults 0 0</div></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h3 id="起因"><a href="#起因" class="headerlink" title="起因"></a>起因</h3><p>安装数据库时,要求swap空间至少为8G大小,由于操作系统已经安装完成,因此需要用如下方式调整swap空间</p>
</summary>
<category term="LINUX" scheme="https://shijieqin.github.io/categories/LINUX/"/>
<category term="swap" scheme="https://shijieqin.github.io/categories/LINUX/swap/"/>
<category term="LINUX" scheme="https://shijieqin.github.io/tags/LINUX/"/>
<category term="swap" scheme="https://shijieqin.github.io/tags/swap/"/>
</entry>
<entry>
<title>hwcloud上的Oracle RAC 12cR2安装手册(2)--grid的安装</title>
<link href="https://shijieqin.github.io/2017/11/27/hwcloud%E4%B8%8A%E7%9A%84Oracle-RAC-12cR2%E5%AE%89%E8%A3%85%E6%89%8B%E5%86%8C-2-grid%E7%9A%84%E5%AE%89%E8%A3%85/"/>
<id>https://shijieqin.github.io/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/</id>
<published>2017-11-27T08:02:02.000Z</published>
<updated>2017-11-27T08:02:02.000Z</updated>
<content type="html"><![CDATA[<h3 id="安装CVU"><a href="#安装CVU" class="headerlink" title="安装CVU"></a>安装CVU</h3><p>node01上,root用户</p><p>执行如下命令:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cd /u01/app/12.2.0/grid/cv/rpm/</div><div class="line">rpm -ivh cvuqdisk-1.0.10-1.rpm</div></pre></td></tr></table></figure><a id="more"></a><p>node01上,grid用户</p><p>执行如下命令:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cd /u01/app/12.2.0/grid/</div><div class="line">./runcluvfy.sh stage -pre crsinst -n node01,node02 -fixup -verbose</div></pre></td></tr></table></figure><p>返回结果如下,则表示配置正确</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">Pre-check for cluster services setup was successful.</div><div class="line">CVU operation performed: stage -pre crsinst</div><div class="line">Date: Nov 27, 2017 6:26:58 PM</div><div class="line">CVU home: /u01/app/12.2.0/grid/</div><div class="line">User: grid</div></pre></td></tr></table></figure><p>如果有报错,则按照提示修复错误即可</p><h3 id="安装网格基础设施-grid"><a href="#安装网格基础设施-grid" class="headerlink" title="安装网格基础设施(grid)"></a>安装网格基础设施(grid)</h3><p><strong><em>注:</em></strong></p><ul><li><strong><em>安装前需保证node02上ORACLE_BASE和ORACLE_HOME目录为空,如果报错,可以手动清理掉</em></strong></li><li><strong><em>安装前保证node01上的ORACLE_BASE的目录为空,如果报错,可以手动清理掉</em></strong></li></ul><p>node01上,grid用户</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cd /u01/app/12.2.0/grid/</div><div class="line">./gridSetup.sh</div></pre></td></tr></table></figure><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step1.png" alt="选择第一项,为新集群配置Grid" title="选择第一项,为新集群配置Grid"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step2.png" alt="配置一个独立的集群" title="配置一个独立的集群"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step3.png" alt="输入集群名称、SCAN名称(需要与hosts配置的一致)和SCAN端口(默认1521)" title="输入集群名称、SCAN名称(需要与hosts配置的一致)和SCAN端口(默认1521)"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step4.png" alt="选择添加新节点" title="选择添加新节点"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step4-3.png" alt="添加节点,格式按照node01的格式" title="添加节点,格式按照node01的格式"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step4-2.png" alt="添加完成,下一步" title="添加完成,下一步"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step5.png" alt="指定网卡用途" title="指定网卡用途"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step6.png" alt="选择使用块设备配置ASM" title="选择使用块设备配置ASM"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step7.png" alt="不为GIMR配置单独的ASM磁盘组" title="不为GIMR配置单独的ASM磁盘组"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step8.png" alt="命名磁盘组为OCR_VOT_GIMR,选择外部冗余,修改探索目录" title="命名磁盘组为OCR_VOT_GIMR,选择外部冗余,修改探索目录"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step8-2.png" alt="选择OCR_VOT_GIMR" title="选择OCR_VOT_GIMR"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step9.png" alt="使用统一密码" title="使用统一密码"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step10.png" alt="不用IPMI" title="不用IPMI"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step11.png" alt="不注册EM" title="不注册EM"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step12.png" alt="默认" title="默认"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step13.png" alt="默认" title="默认"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step14.png" alt="默认" title="默认"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step15.png" alt="输入root密码,自动配置脚本" title="输入root密码,自动配置脚本"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step16.png" alt="检查" title="检查"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step16-3.png" alt="忽略全部,下一步" title="忽略全部,下一步"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step16-4.png" alt="确认" title="确认"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step17.png" alt="安装" title="安装"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step18.png" alt="开始安装,安装过程中需要确认使用root执行脚本" title="开始安装,安装过程中需要确认使用root执行脚本"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step18-2.png" alt="集群校验失败,确认即可" title="集群校验失败,确认即可"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Step18-3.png" alt="确认继续" title="确认继续"><p>安装完成后,点击close关闭即可。</p><h3 id="验证"><a href="#验证" class="headerlink" title="验证"></a>验证</h3><p>使用grid用户分别在node01和node02上执行<code>crs_stat -v -t</code>查看服务运行状态,如下:</p><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Node01-1.png" alt="node01" title="node01"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/Node02-1.png" alt="node02" title="node02"><h3 id="创建其他磁盘组"><a href="#创建其他磁盘组" class="headerlink" title="创建其他磁盘组"></a>创建其他磁盘组</h3><p>node01上,grid用户</p><p>执行<code>asmca</code>,结果如下:</p><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/asmca1.png" alt="欢迎界面" title="欢迎界面"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/asmca2.png" alt="选择创建磁盘组" title="选择创建磁盘组"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/asmca3.png" alt="创建DATA磁盘,选择外部冗余,选择DATA磁盘" title="创建DATA磁盘,选择外部冗余,选择DATA磁盘"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/asmca4.png" alt="创建中" title="创建中"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/asmca5.png" alt="创建完成,退出" title="创建完成,退出"><img src="/2017/11/27/hwcloud上的Oracle-RAC-12cR2安装手册-2-grid的安装/asmca6.png" alt="确认退出" title="确认退出"><p>至此,完成Grid安装</p><p>接着看<a href="/2017/11/29/hwcloud上的Oracle-RAC-12cR2安装手册-3-oracle软件的安装/" title="hwcloud上的Oracle RAC 12cR2安装手册(3)—oracle软件的安装">hwcloud上的Oracle RAC 12cR2安装手册(3)—oracle软件的安装</a></p>]]></content>
<summary type="html">
<h3 id="安装CVU"><a href="#安装CVU" class="headerlink" title="安装CVU"></a>安装CVU</h3><p>node01上,root用户</p>
<p>执行如下命令:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cd /u01/app/12.2.0/grid/cv/rpm/</div><div class="line">rpm -ivh cvuqdisk-1.0.10-1.rpm</div></pre></td></tr></table></figure>
</summary>
<category term="oracle" scheme="https://shijieqin.github.io/categories/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/categories/oracle/rac/"/>
<category term="oracle" scheme="https://shijieqin.github.io/tags/oracle/"/>
<category term="rac" scheme="https://shijieqin.github.io/tags/rac/"/>
</entry>
</feed>