SUSE 11 + Oracle 11g ADG修改主库IP全流程

前端之家收集整理的这篇文章主要介绍了SUSE 11 + Oracle 11g ADG修改主库IP全流程前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. 一、描述
  2. 数据库版本11g,单实例ADG.
  3. 操作系统版本为SUSE 11 SP3.
  4. 主库IP192.168.1.11
  5. 备库IP192.168.1.12
  6.  
  7. 二、需求
  8. 主库需要修改IP地址,保证ADG环境正常运行。
  9. 主库IP 改为:192.168.1.10,备库IP不变。
  10.  
  11. 三、操作步骤
  12.  
  13. 1、检查主备库当前是否正常运行
  14. oracle@mmpt-SRJ:~> dgmgrl /
  15. DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production
  16.  
  17. Copyright (c) 2000,2009,Oracle. All rights reserved.
  18.  
  19. Welcome to DGMGRL,type "help" for information.
  20. Connected.
  21. DGMGRL> show configuration;
  22.  
  23. Configuration - dg_broker
  24.  
  25. Protection Mode: MaxPerformance
  26. Databases:
  27. mmpt - Primary database
  28. mmptdg - Physical standby database
  29.  
  30. Fast-Start Failover: DISABLED
  31.  
  32. Configuration Status:
  33. SUCCESS
  34.  
  35. DGMGRL>
  36.  
  37. 2关闭主、备库
  38. lsnrctl stop listener
  39. shutdown immediate;
  40.  
  41. 3修改操作系统IP地址
  42. mmpt-SRJ:/etc/sysconfig/network # ls
  43. config dhcp if-down.d if-up.d ifcfg-eth0 ifcfg-lo ifcfg.template ifroute-lo providers scripts
  44. mmpt-SRJ:/etc/sysconfig/network # vi ifcfg-eth0
  45. BOOTPROTO='static'
  46. BROADCAST=''
  47. ETHTOOL_OPTIONS=''
  48. IPADDR='192.168.1.10/24'
  49. MTU=''
  50. NAME='82540EM Gigabit Ethernet Controller'
  51. NETWORK=''
  52. REMOTE_IPADDR=''
  53. STARTMODE='auto'
  54. USERCONTROL='no'
  55. ~
  56. ~
  57. "ifcfg-eth0" 10L,188C written
  58.  
  59. mmpt-SRJ:/etc/sysconfig/network # /etc/init.d/network restart
  60. Shutting down network interfaces:
  61. eth0 device: Intel Corporation 82540EM Gigabit Ethernet Co done
  62. .............重新使用新IP地址连接...................
  63.  
  64. 4、主库修改监听文件listener.ora
  65. oracle@mmpt-SRJ:/fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin> vi listener.ora
  66. SID_LIST_LISTENER =
  67. (SID_LIST =
  68. (SID_DESC =
  69. (GLOBAL_DBNAME = mmpt)
  70. (ORACLE_HOME = /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1)
  71. (SID_NAME = mmpt)
  72. )
  73. )
  74.  
  75. LISTENER =
  76. (DESCRIPTION =
  77. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
  78.  
  79. 4、主库修改监听文件tnsnames.ora
  80. oracle@mmpt-SRJ:/fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin> vi tnsnames.ora
  81. # tnsnames.ora Network Configuration File: /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
  82. # Generated by Oracle configuration tools.
  83.  
  84. MMPT =
  85. (DESCRIPTION =
  86. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
  87. (CONNECT_DATA =
  88. (SERVER = DEDICATED)
  89. (SERVICE_NAME = mmpt)
  90. )
  91. )
  92.  
  93. mmptdg =
  94. (DESCRIPTION =
  95. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521))
  96. (CONNECT_DATA =
  97. (SERVER = DEDICATED)
  98. (SERVICE_NAME = mmptdg)
  99. )
  100. )
  101.  
  102. 4、主库修改hosts文件
  103. mmpt-SRJ:~ # vi /etc/hosts
  104. #
  105. # hosts This file describes a number of hostname-to-address
  106. # mappings for the TCP/IP subsystem. It is mostly
  107. # used at boot time,when no name servers are running.
  108. # On small systems,this file can be used instead of a
  109. # "named" name server.
  110. # Syntax:
  111. #
  112. # IP-Address Full-Qualified-Hostname Short-Hostname
  113. #
  114.  
  115. 127.0.0.1 localhost
  116.  
  117. # special IPv6 addresses
  118. ::1 localhost ipv6-localhost ipv6-loopback
  119.  
  120. fe00::0 ipv6-localnet
  121.  
  122. ff00::0 ipv6-mcastprefix
  123. ff02::1 ipv6-allnodes
  124. ff02::2 ipv6-allrouters
  125. ff02::3 ipv6-allhosts
  126. #192.168.1.11 suse11.site suse11
  127. 192.168.1.10 mmpt-SRJ mmpt-SRJ
  128. 192.168.1.12 mmpt-SRJ-dg mmpt-SRJ-dg
  129.  
  130. 5、备库不需要修改listener.ora
  131. oracle@mmpt-SRJ-dg:/fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin> cat listener.ora
  132. SID_LIST_LISTENER =
  133. (SID_LIST =
  134. (SID_DESC =
  135. (GLOBAL_DBNAME = mmptdg)
  136. (ORACLE_HOME = /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1)
  137. (SID_NAME = mmptdg)
  138. )
  139. )
  140.  
  141. LISTENER =
  142. (DESCRIPTION =
  143. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521))
  144. )
  145.  
  146. 6、备库修改监听文件tnsnames.ora
  147. oracle@mmpt-SRJ-dg:/fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin> vi tnsnames.ora
  148. # tnsnames.ora Network Configuration File: /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
  149. # Generated by Oracle configuration tools.
  150.  
  151. MMPT =
  152. (DESCRIPTION =
  153. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
  154. (CONNECT_DATA =
  155. (SERVER = DEDICATED)
  156. (SERVICE_NAME = mmpt)
  157. )
  158. )
  159.  
  160. mmptdg =
  161. (DESCRIPTION =
  162. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521))
  163. (CONNECT_DATA =
  164. (SERVER = DEDICATED)
  165. (SERVICE_NAME = mmpt-SRJ-dg)
  166. )
  167. )
  168.  
  169. "tnsnames.ora" 21L,529C written
  170.  
  171. 7、备库修改hosts文件
  172. mmpt-SRJ-dg:~ # vi /etc/hosts
  173. #
  174. # hosts This file describes a number of hostname-to-address
  175. # mappings for the TCP/IP subsystem. It is mostly
  176. # used at boot time,this file can be used instead of a
  177. # "named" name server.
  178. # Syntax:
  179. #
  180. # IP-Address Full-Qualified-Hostname Short-Hostname
  181. #
  182.  
  183. 127.0.0.1 localhost
  184.  
  185. # special IPv6 addresses
  186. ::1 localhost ipv6-localhost ipv6-loopback
  187.  
  188. fe00::0 ipv6-localnet
  189.  
  190. ff00::0 ipv6-mcastprefix
  191. ff02::1 ipv6-allnodes
  192. ff02::2 ipv6-allrouters
  193. ff02::3 ipv6-allhosts
  194. 192.168.1.12 mmpt-SRJ-dg mmpt-SRJ-dg
  195. 192.168.1.10 mmpt-SRJ mmpt-SRJ
  196. ~
  197. "/etc/hosts" 24L,721C written
  198.  
  199. 8、启动主备库监听,测试
  200. lsnrctl start listener
  201. tnsping mmpt
  202. tnsping mmpt-dg
  203.  
  204. 输出如下:
  205.  
  206. oracle@mmpt-SRJ:~> lsnrctl start
  207.  
  208. LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 17-MAY-2018 16:31:16
  209.  
  210. Copyright (c) 1991,Oracle. All rights reserved.
  211.  
  212. Starting /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
  213.  
  214. TNSLSNR for Linux: Version 11.2.0.1.0 - Production
  215. System parameter file is /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
  216. Log messages written to /fantlam/oracle/app/oracle/diag/tnslsnr/mmpt-SRJ/listener/alert/log.xml
  217. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1521)))
  218.  
  219. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.10)(PORT=1521)))
  220. STATUS of the LISTENER
  221. ------------------------
  222. Alias LISTENER
  223. Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
  224. Start Date 17-MAY-2018 16:31:16
  225. Uptime 0 days 0 hr. 0 min. 0 sec
  226. Trace Level off
  227. Security ON: Local OS Authentication
  228. SNMP OFF
  229. Listener Parameter File /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
  230. Listener Log File /fantlam/oracle/app/oracle/diag/tnslsnr/mmpt-SRJ/listener/alert/log.xml
  231. Listening Endpoints Summary...
  232. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1521)))
  233. Services Summary...
  234. Service "mmpt" has 1 instance(s).
  235. Instance "mmpt",status UNKNOWN,has 1 handler(s) for this service...
  236. The command completed successfully
  237. oracle@mmpt-SRJ:~> tnsping mmpt
  238.  
  239. TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 17-MAY-2018 16:31:26
  240.  
  241. Copyright (c) 1997,Oracle. All rights reserved.
  242.  
  243. Used parameter files:
  244.  
  245. Used TNSNAMES adapter to resolve the alias
  246. Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mmpt)))
  247. OK (0 msec)
  248. oracle@mmpt-SRJ:~> tnsping mmptdg
  249.  
  250. TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 17-MAY-2018 16:31:31
  251.  
  252. Copyright (c) 1997,Oracle. All rights reserved.
  253.  
  254. Used parameter files:
  255.  
  256. Used TNSNAMES adapter to resolve the alias
  257. Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mmptdg)))
  258. OK (0 msec)
  259. oracle@mmpt-SRJ:~>
  260.  
  261. 8、启动主备库
  262. 先启动备库,再启动主库
  263. oracle@mmpt-SRJ-dg:~> sqlplus / as sysdba
  264.  
  265. sql*Plus: Release 11.2.0.1.0 Production on Thu May 17 16:32:42 2018
  266.  
  267. Copyright (c) 1982,Oracle. All rights reserved.
  268.  
  269. Connected to an idle instance.
  270.  
  271. sql> startup
  272. ORACLE instance started.
  273.  
  274. Total System Global Area 784998400 bytes
  275. Fixed Size 2217464 bytes
  276. Variable Size 473958920 bytes
  277. Database Buffers 306184192 bytes
  278. Redo Buffers 2637824 bytes
  279. Database mounted.
  280. Database opened.
  281. sql>
  282.  
  283. 9、验证ADG
  284. mmpt-SRJ-dg:~ # su - oracle
  285. oracle@mmpt-SRJ-dg:~> dgmgrl /
  286. DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production
  287.  
  288. Copyright (c) 2000,type "help" for information.
  289. Connected.
  290. DGMGRL> show configuration;
  291.  
  292. Configuration - dg_broker
  293.  
  294. Protection Mode: MaxPerformance
  295. Databases:
  296. mmpt - Primary database
  297. mmptdg - Physical standby database
  298.  
  299. Fast-Start Failover: DISABLED
  300.  
  301. Configuration Status:
  302. SUCCESS
  303.  
  304. DGMGRL>
  305.  
  306. 10、原主库修改
  307. edit database mmpt set property StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=mmpt)(INSTANCE_NAME=mmpt)(SERVER=DEDICATED)))';
  308.  
  309. 11、切换测试
  310. oracle@mmpt-SRJ-dg:~> dgmgrl /
  311. DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production
  312.  
  313. Copyright (c) 2000,type "help" for information.
  314. Connected.
  315. DGMGRL> show configuration;
  316.  
  317. Configuration - dg_broker
  318.  
  319. Protection Mode: MaxPerformance
  320. Databases:
  321. mmptdg - Primary database
  322. mmpt - Physical standby database
  323.  
  324. Fast-Start Failover: DISABLED
  325.  
  326. Configuration Status:
  327. SUCCESS
  328.  
  329. DGMGRL> connect sys/oracle@mmpt
  330. Connected.
  331. DGMGRL> switchover to mmpt;
  332. Performing switchover NOW,please wait...
  333. New primary database "mmpt" is opening...
  334. Operation requires shutdown of instance "mmptdg" on database "mmptdg"
  335. Shutting down instance "mmptdg"...
  336. ORA-01109: database not open
  337.  
  338. Database dismounted.
  339. ORACLE instance shut down.
  340. Operation requires startup of instance "mmptdg" on database "mmptdg"
  341. Starting instance "mmptdg"...
  342. ORACLE instance started.
  343. Database mounted.
  344. Database opened.
  345. Switchover succeeded,new primary is "mmpt"
  346. DGMGRL>

猜你在找的Oracle相关文章