-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
356 lines (356 loc) · 18.5 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>修改dbname常见的一个错误NID-00135及解决…</title>
<meta name="author" content="陈子">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le styles -->
<link href="/assets/themes/twitter/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="/assets/themes/twitter/css/style.css?body=1" rel="stylesheet" type="text/css" media="all">
<link href="/assets/themes/twitter/css/pygments/default.css" rel="stylesheet" type="text/css">
<!-- Le fav and touch icons -->
<!-- Update these with your own images
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
-->
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/">三斗室</a>
<ul class="nav">
<li><a href="/archive.html">归档</a></li>
<li><a href="/categories.html">分类</a></li>
<li><a href="/elk-errata.html">《ELK stack权威指南》勘误</a></li>
<li><a href="/errata.html">《网站运维技术与实践》勘误</a></li>
<li><a href="/pages.html">Pages</a></li>
<li><a href="/projects.html">学习记录</a></li>
<li><a href="/tags.html">标签</a></li>
<li><a href="http://chenlinux.com/poetry/index.html" />诗文集</a></li>
<li><link title="RSS 2.0" type="application/rss+xml" href="http://chenlinux.com/feed.xml" rel="alternate" /><a href="http://chenlinux.com/feed.xml" target="_blank">RSS订阅</a></li>
</ul>
<ul class="nav pull-right"><li><a href="/about.html">有关我</a></li></ul>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span7">
<div class="row">
<div class="page-header">
<h1>修改dbname常见的一个错误NID-00135及解决… <small></small></h1>
<div class="date"><span>03 November 2009</span></div>
<ul class="tag_box pull-right">
<li><a href="/tags.html#oracle-ref">oracle <span>1</span></a></li>
</ul>
</div>
<div style='background-color: #FFF;'>
<p>oracle自带有nid用以修改dbname。查看其命令语法如下表所示:</p>
<pre><code>DBNEWID: Release 10.2.0.4.0 - Production on Wed Jun 24 20:06:08 2009
Copyright (c) 1982, 2007,
Oracle. All
rights reserved.
Keyword
Description (Default)
----------------------------------------------------
TARGET Username/Password (NONE)
DBNAME New
database name (NONE)
LOGFILE
Output Log
(NONE)
REVERT Revert
failed
change
NO
SETNAME
Set a new database name
only
NO
APPEND Append
to output log
NO
HELP Displays
these
messages NO 其动作描述用“=”表示。
</code></pre>
<p>假设某oracle数据库sys密码为123456,欲更名dbname为aaa,则其修改dbname的命令应如下行所示:</p>
<p>nid target=sys/123456 dbname=aaa</p>
<p>网上关于修改dbname的博客文章和论坛问答,基本都是在windows平台上的操作。其提示要点,在于运行nid系统命令之前,必须将数据库置于mount状态下。以此类推,在linux下的操作步骤,应该如下:</p>
<div class="highlight"><pre><code class="language-sql" data-lang="sql"><span class="k">sql</span> <span class="o">></span> <span class="n">shutdown</span>
<span class="k">immediate</span><span class="p">;</span>
<span class="k">sql</span> <span class="o">></span> <span class="n">startup</span> <span class="n">mount</span><span class="p">;</span>
<span class="k">sql</span> <span class="o">></span> <span class="k">host</span> <span class="n">nid</span> <span class="n">target</span><span class="o">=</span><span class="n">sys</span><span class="o">/</span><span class="mi">123456</span> <span class="n">dbname</span><span class="o">=</span><span class="n">aaa</span></code></pre></div>
<p>但我按此步骤进行之后,却提示如下字段:
NID-00135: There are 1 active threads
Change of database name failed during validation - database is
intact.
DBNEWID - Completed with validation errors.
经过多机试验,发现这个错误并非偶然出现一两次而已,至于windows平台下,为何无人提起,就有待日后研究了。
关于这个错误,关键是检查两个地方。
第一是表空间与数据文件的状态:
SQL> select
file#,status,name from
v$datafile;
FILE#
STATUS NAME
———- ——-
——————————————————————————–
1
SYSTEM /u01/app/oracle/oradata/db1/system01.dbf
2
ONLINE /u01/app/oracle/oradata/db1/undotbs01.dbf
3
ONLINE /u01/app/oracle/oradata/db1/sysaux01.dbf
4
ONLINE /u01/app/oracle/oradata/db1/usertbs.dbf
5
ONLINE /u01/app/oracle/oradata/db1/raocl.dbf
正常情况下,其状态应该是online或者offline。但如果因为历史操作的原因,导致某数据文件的状态变成了recovery,那么就会出问题了。
解决方法也简单,drop掉出错的数据文件就行了。
第二是归档文件的设置:
SQL> archive log
list
Database log
mode Archive
Mode
Automatic
archival
Enabled
Archive
destination /u01/app/oracle/product/10.2.0/db1/dbs/arch
Oldest online log
sequence
31
Next log sequence to
archive
33
Current log
sequence
33
SQL> host ls $ORACLE_HOME/dbs
alert_db1.log
arch1_29_689269707.dbf control01.ctl
initdw.ora spfiledb1.ora.bak
arch1_25_689269707.dbf arch1_30_689269707.dbf control02.ctl
init.ora
arch1_26_689269707.dbf arch1_31_689269707.dbf db1_ora_4704.trc lkAAA
arch1_27_689269707.dbf arch1_32_689269707.dbf hc_db1.dat lkDB1
arch1_28_689269707.dbf cntrldb1.dbf initdb1.ora
orapwdb1
如果没有设置归档文件路径或者没有归档文件存在,nid也会出错。
设置归档文件模式、路径并手工归档的命令分别如下:
SQL> alter database archivelog;
SQL> alter system
set log_archive_dest_1=’location=/u01/app/oracle/oradata/db1/arch’;
SQL> alter system
archive log current;
注意:归档文件模式也要在mount下设置。
确认完成这两步以后,在重新运行nid系统命令,出现如下字段,即可成功更改dbname了。
Control Files in database:
/u01/app/oracle/product/10.2.0/db1/dbs/control01.ctl
/u01/app/oracle/product/10.2.0/db1/dbs/control02.ctl
Change database ID and database
name DB1 to AAA? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1283133323 to
1845742016
Changing database name from DB1
to AAA
Control
File
/u01/app/oracle/product/10.2.0/db1/dbs/control01.ctl -
modified
Control
File
/u01/app/oracle/product/10.2.0/db1/dbs/control02.ctl -
modified
Datafile
/u01/app/oracle/oradata/db1/system01.dbf - dbid changed, wrote new
name
Datafile
/u01/app/oracle/oradata/db1/undotbs01.dbf - dbid changed, wrote new
name
Datafile
/u01/app/oracle/oradata/db1/sysaux01.dbf - dbid changed, wrote new
name
Datafile
/u01/app/oracle/oradata/db1/usertbs.dbf - dbid changed, wrote new
name
Datafile
/u01/app/oracle/oradata/db1/raocl.dbf - dbid changed, wrote new
name
Datafile
/u01/app/oracle/oradata/db1/temp01.dbf - dbid changed, wrote new
name
Control
File
/u01/app/oracle/product/10.2.0/db1/dbs/control01.ctl - dbid
changed, wrote new name
Control
File
/u01/app/oracle/product/10.2.0/db1/dbs/control02.ctl - dbid
changed, wrote new name
Instance
shut down
Database name changed to
AAA.
Modify parameter file and generate a new password file before restarting.
Database ID for database AAA
changed to 1845742016.
All previous backups and archived redo logs for this database are
unusable.
Database has been shutdown, open
database with RESETLOGS option.
Succesfully changed database
name and
ID.
DBNEWID - Completed succesfully.
至于引起这个错误的深层次原因,从之前有过的其他操作猜测,会不会是scn不一致的原因??如果是这个原因,那或许只要很简单的CKPT就可以了。找时间试验一下。</p>
<hr>
<div class="pagination">
<ul>
<li class="prev"><a href="/2009/11/03/learning-sed" title="sed使用">← Previous</a></li>
<li><a href="/archive.html">Archive</a></li>
<li class="next"><a href="/2009/11/03/priority-of-squid-domain-resolve" title="squid问题-域名解析">Next →</a></li>
</ul>
</div>
<hr>
<!-- JiaThis Button BEGIN -->
<div class="jiathis_style">
<span class="jiathis_txt">分享到:</span>
<a class="jiathis_button_tsina">新浪微博</a>
<a class="jiathis_button_weixin">微信</a>
<a class="jiathis_button_renren">人人网</a>
<a class="jiathis_button_ydnote">有道云笔记</a>
<a class="jiathis_button_gmail">Gmail邮箱</a>
<a class="jiathis_button_twitter">Twitter</a>
<a class="jiathis_button_googleplus">Google+</a>
<a class="jiathis_button_hi">百度空间</a>
<a class="jiathis_button_fb">Facebook</a>
<a class="jiathis_button_douban">豆瓣</a>
<a href="http://www.jiathis.com/share?uid=1589850" class="jiathis jiathis_txt jiathis_separator jtico jtico_jiathis" target="_blank">更多</a>
<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" >
var jiathis_config={
data_track_clickback:true,
summary:"",
ralateuid:{
"tsina":"1035836154"
},
shortUrl:false,
hideMore:false
}
</script>
<script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=1589850" charset="utf-8"></script>
<!-- JiaThis Button END -->
<!-- UY BEGIN -->
<div id="uyan_frame"></div>
<script type="text/javascript" id="UYScript" src="http://v1.uyan.cc/js/iframe.js?UYUserId=1589850" async=""></script>
<!-- UY END -->
</div>
</div>
</div>
<div class="span4">
<div class="well sidebar-nav">
<ul id="relate_blog" class="nav nav-list">
<li class="nav-header">最近文章</li>
<li><a href="/2015/10/25/escc">ESCC 参会笔记</a></li>
<li><a href="/2015/10/20/escc">ESCC 参会笔记</a></li>
<li><a href="/2015/09/24/condition-in-rsyslog">rsyslog 中 if 条件判断的限制</a></li>
<li><a href="/2015/08/25/kibana-custom-field-formatters">【翻译】Kibana 字段的自定义展示格式开发</a></li>
<li><a href="/2015/04/03/types-mapping-conflict-in-one-index">Elasticsearch 同一索引不同类型下同名字段的映射冲突实例</a></li>
<li><a href="/2015/03/14/spark-streaming-kafka">spark streaming 接收 kafka 数据示例</a></li>
<li><a href="/2015/03/14/kibana3-source-code-analysis">Kibana 3 源码解析</a></li>
<li><a href="/2015/03/06/kibana4-for-slowlog">用 Kibana4 实现 PHP 慢日志函数堆栈分析</a></li>
<li><a href="/2015/02/25/kibana-aggregation-execution-order-and-you">【翻译】kibana 的聚合执行次序</a></li>
</ul>
</div>
<div class="well sidebar-nav">
<iframe width="100%" height="550" class="share_self" frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=550&fansRow=1&ptype=1&speed=0&skin=2&isTitle=1&noborder=1&isWeibo=1&isFans=1&uid=1035836154&verifier=a26926d5&dpc=1"></iframe>
</div>
<div class="well sidebar-nav">
<div id="uyan_list_time_frame"></div>
<script type="text/javascript" id="UYScriptTime" src="http://v1.uyan.cc/js/iframe_time_list.js?UYUserId=1589850&rankType=time" async=""></script>
</div>
<div class="well sidebar-nav">
<ul id="linklists" class="nav nav-list">
<li class="nav-header">友情链接(英文)</li>
<li><a href="http://codeascraft.com/" title="Etsy 运维团队博客">Code as Craft</a></li>
<li><a href="http://devopsanywhere.blogspot.jp/" title="">devopsanywhere</a></li>
<li><a href="http://www.jedi.be/blog/" title="">Jong En Dynamische Informatica</a></li>
<li><a href="http://www.planetdevops.net/" title="">planetdevops</a></li>
<li><a href="http://www.kitchensoap.com/" title="《网站运维》作者,Etsy 运维">Kitchen Soap</a></li>
<li><a href="http://blog.johngoulah.com" title="Musings of linux, open source, cloud computing and systems">John Goulah</a></li>
<li><a href="http://serverfault.com/" title="stackexchange下属的系统工程师问答网站">serverfault</a></li>
<li><a href="http://www.thegeekstuff.com/" title="各种超酷Linux命令用法">TheGeekStuff</a></li>
<li><a href="http://neilb.org/" title="The good,the bad,and the beautiful">neilb</a></li>
<li><a href="http://www.reddit.com/r/perl/" title="">reddit perl 频道</a></li>
<li><a href="http://jpetazzo.github.io/" title="">~jpetazzo</a></li>
<li><a href="http://www.perfplanet.com/" title="News and views from the web performance blogosphere">Performance Planet</a></li>
<li><a href="http://cuddletech.com/blog/" title="Use UNIX or die">Cuddle Tech</a></li>
<li><a href="http://showmetheco.de/" title="Viacheslav Tykhanovskyi(PocketIO/Text::Haml)">No time to wait</a></li>
<li><a href="http://blog.dataloop.io/" title="A new SaaS monitoring tool for DevOps & Operations">Dataloop.IO</a></li>
<li><a href="http://www.ducea.com/" title="">MDLog:/sysadmin</a></li>
<li><a href="http://planeteria.org/perl6/" title="Perl6 文集">Planet Perl 6</a></li>
<li><a href="http://www.metaforsoftware.com/blog/" title="">metafor</a></li>
<li><a href="http://blog.kablamo.org/" title="Eric Johnson,一个游走在伦敦和北京的 Perler">kablamo</a></li>
<li><a href="http://aphyr.com/posts" title="call me maybe 吐槽系列">Aphyr</a></li>
</ul>
</div>
<div class="well sidebar-nav">
<ul id="linklists" class="nav nav-list">
<li class="nav-header">友情链接(中文)</li>
<li><a href="http://www.nginxs.com/" title="">eric</a></li>
<li><a href="http://www.hellodb.net/" title="Ali DBA 张瑞">Hello DBA</a></li>
<li><a href="http://blog.nosqlfan.com/" title="not only sql信息集散地">NoSQLfan</a></li>
<li><a href="http://ourmysql.com/" title="">OurMySQL</a></li>
<li><a href="http://timo.piqiu.me/" title="TIMO IS MY OASIS">Timo</a></li>
<li><a href="http://www.liurongxing.com/" title="">刘荣星</a></li>
<li><a href="http://www.cnadn.net/" title="F5工程师">应用交付学习之路</a></li>
<li><a href="http://scmbob.org/" title="杭州NSN工程师,shell高人~">扛一肩记忆</a></li>
<li><a href="http://www.php-oa.com/" title="音悦台技术经理">扶凯</a></li>
<li><a href="http://www.lark.net.cn/" title="王剑">lark's cloud</a></li>
<li><a href="http://log.heartoutside.com/" title="HeartOutSide">HeartOutside</a></li>
<li><a href="http://blog.liulantao.com/" title="刘兰涛">Lax</a></li>
<li><a href="http://niubie.me/" title="莫言">莫言</a></li>
<li><a href="http://noops.me/" title="小米运维部">NoOps</a></li>
<li><a href="http://www.searchtech.pro/" title="">云端分布式搜索技术</a></li>
<li><a href="http://www.usefulshare.com" title="当当网安全运维">UsefulShare</a></li>
<li><a href="http://junqili.com/" title="深入研究puppet">纸飞机</a></li>
<li><a href="http://www.chinaxing.org/" title="">ChinaXing</a></li>
<li><a href="http://bubbyroom.com/" title="守住每一天">Liuyu's blog</a></li>
<li><a href="http://blog.aka-cool.net/" title="">Aka.Why</a></li>
<li><a href="http://blog.l8ii.com/" title="刘侨">LairdNote</a></li>
<li><a href="http://flw.tools/" title="">flw的工具箱</a></li>
<li><a href="http://blog.mcshell.org/" title="">mcshell</a></li>
<li><a href="http://novoland.github.io/" title="">克鲁斯卡尔的博客</a></li>
</ul>
</div>
<div class="well sidebar-nav">
<ul id="booklists" class="nav nav-list">
<li class="nav-header">我写的技术书籍</li>
<li><a href='http://product.china-pub.com/3769604'><img src='http://images.china-pub.com/ebook3765001-3770000/3769604/shupi.jpg' border='0' alt='网站运维技术与实践'/></a></li>
<li><a href='http://product.china-pub.com/64005'><img src='http://images.china-pub.com/ebook60001-65000/64005/shupi.jpg' border='0' alt='ELK Stack权威指南'/></a></li>
<li class="nav-header">我参与翻译的技术书籍</li>
<li><a href='http://product.china-pub.com/4582714'><img src='http://images.china-pub.com/ebook4580001-4585000/4582714/shupi.jpg' border='0' alt='Puppet 实战手册'/></a></li>
</div>
</div>
</div> <!-- row -->
<footer>
<p>© 陈子 2015
with help from <a href="http://jekyllbootstrap.com" target="_blank" title="The Definitive Jekyll Blogging Framework">Jekyll Bootstrap</a>
and <a href="http://twitter.github.com/bootstrap/" target="_blank">Twitter Bootstrap</a>
</p>
</footer>
</div> <!-- /container -->
</body>
</html>