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


一、描述
数据库版本11g,单实例ADG.
操作系统版本为SUSE 11 SP3.
主库IP:192.168.1.11
备库IP:192.168.1.12

二、需求
主库需要修改IP地址,保证ADG环境正常运行。
主库IP 改为:192.168.1.10,备库IP不变。

三、操作步骤

1、检查主备库当前是否正常运行
[email protected]:~> dgmgrl /
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration;

Configuration - dg_broker

Protection Mode: MaxPerformance
Databases:
mmpt - Primary database
mmptdg - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL>

2、关闭主、备库
lsnrctl stop listener
shutdown immediate;

3、修改操作系统IP地址
mmpt-SRJ:/etc/sysconfig/network # ls
config dhcp if-down.d if-up.d ifcfg-eth0 ifcfg-lo ifcfg.template ifroute-lo providers scripts
mmpt-SRJ:/etc/sysconfig/network # vi ifcfg-eth0
BOOTPROTO=‘static‘
BROADCAST=‘‘
ETHTOOL_OPTIONS=‘‘
IPADDR=‘192.168.1.10/24‘
MTU=‘‘
NAME=‘82540EM Gigabit Ethernet Controller‘
NETWORK=‘‘
REMOTE_IPADDR=‘‘
STARTMODE=‘auto‘
USERCONTROL=‘no‘
~
~
"ifcfg-eth0" 10L, 188C written

mmpt-SRJ:/etc/sysconfig/network # /etc/init.d/network restart
Shutting down network interfaces:
eth0 device: Intel Corporation 82540EM Gigabit Ethernet Co done
.............重新使用新IP地址连接...................

4、主库修改监听文件listener.ora
[email protected]:/fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin> vi listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = mmpt)
(ORACLE_HOME = /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = mmpt)
)
)

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))

4、主库修改监听文件tnsnames.ora
[email protected]:/fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin> vi tnsnames.ora
# tnsnames.ora Network Configuration File: /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

MMPT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mmpt)
)
)

mmptdg =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mmptdg)
)
)

4、主库修改hosts文件
mmpt-SRJ:~ # vi /etc/hosts
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
#

127.0.0.1 localhost

# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback

fe00::0 ipv6-localnet

ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
#192.168.1.11 suse11.site suse11
192.168.1.10 mmpt-SRJ mmpt-SRJ
192.168.1.12 mmpt-SRJ-dg mmpt-SRJ-dg

5、备库不需要修改listener.ora
[email protected]:/fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin> cat listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = mmptdg)
(ORACLE_HOME = /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = mmptdg)
)
)

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521))
)

6、备库修改监听文件tnsnames.ora
[email protected]:/fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin> vi tnsnames.ora
# tnsnames.ora Network Configuration File: /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

MMPT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mmpt)
)
)

mmptdg =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mmpt-SRJ-dg)
)
)

"tnsnames.ora" 21L, 529C written

7、备库修改hosts文件
mmpt-SRJ-dg:~ # vi /etc/hosts
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
#

127.0.0.1 localhost

# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback

fe00::0 ipv6-localnet

ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
192.168.1.12 mmpt-SRJ-dg mmpt-SRJ-dg
192.168.1.10 mmpt-SRJ mmpt-SRJ
~
"/etc/hosts" 24L, 721C written

8、启动主备库监听,测试
lsnrctl start listener
tnsping mmpt
tnsping mmpt-dg

输出如下:

[email protected]:~> lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 17-MAY-2018 16:31:16

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Starting /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /fantlam/oracle/app/oracle/diag/tnslsnr/mmpt-SRJ/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.10)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 17-MAY-2018 16:31:16
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /fantlam/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /fantlam/oracle/app/oracle/diag/tnslsnr/mmpt-SRJ/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1521)))
Services Summary...
Service "mmpt" has 1 instance(s).
Instance "mmpt", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[email protected]:~> tnsping mmpt

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 17-MAY-2018 16:31:26

Copyright (c) 1997, 2009, Oracle. All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mmpt)))
OK (0 msec)
[email protected]:~> tnsping mmptdg

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 17-MAY-2018 16:31:31

Copyright (c) 1997, 2009, Oracle. All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mmptdg)))
OK (0 msec)
[email protected]:~>

8、启动主备库
先启动备库,再启动主库
[email protected]:~> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu May 17 16:32:42 2018

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 473958920 bytes
Database Buffers 306184192 bytes
Redo Buffers 2637824 bytes
Database mounted.
Database opened.
SQL>

9、验证ADG
mmpt-SRJ-dg:~ # su - oracle
[email protected]:~> dgmgrl /
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration;

Configuration - dg_broker

Protection Mode: MaxPerformance
Databases:
mmpt - Primary database
mmptdg - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL>

10、原主库修改
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)))‘;

11、切换测试
[email protected]:~> dgmgrl /
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration;

Configuration - dg_broker

Protection Mode: MaxPerformance
Databases:
mmptdg - Primary database
mmpt - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> connect sys/[email protected]
Connected.
DGMGRL> switchover to mmpt;
Performing switchover NOW, please wait...
New primary database "mmpt" is opening...
Operation requires shutdown of instance "mmptdg" on database "mmptdg"
Shutting down instance "mmptdg"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "mmptdg" on database "mmptdg"
Starting instance "mmptdg"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "mmpt"
DGMGRL>

原文地址:http://blog.51cto.com/roidba/2117581

时间: 2024-10-29 15:00:43

SUSE 11 + Oracle 11g ADG修改主库IP全流程的相关文章

ORACLE 11G 如何修改 awr 的保留期限小于8天

 ORACLE 11G 如何修改 awr 的保留期限小于8天 Oracle Database 11g 默认具备一个系统定义的Moving Window Baseline,该基线对应于 AWR 保留期中的所有 AWR 数据. 仅可存在一个Moving Window Baseline. 系统定义的Moving Window Baseline认大小为当前的AWR保留期,即默认为八天. 如果要增大Moving Window Baseline,首先需要相应增大AWR保留期. AWR保留期和系统定义的M

oracle 10g rac 修改public ip、vip和private ip

oracle 10g rac 修改public ip.vip和private ip [TOC] 1.IP地址规划 Hostname 当前IP 修改后IP Public IP node1 192.168.56.20 192.168.100.20 Public IP node2 192.168.56.21 192.168.100.21 VIP node1-vip 192.168.56.98 192.168.100.98 VIP node2-vip 192.168.56.99 192.168.100.

配置ORACLE 11G ADG

以前装过10g的,没有做笔记,昨天使用duplicate方法装了个11g ADG,过程艰辛,记录下: 一.环境配置 主库 IP地址:192.168.233.128/24 操作系统版本:rhel5.8 64bit 数据库版本:11.2.0.1 64bit 数据库sid名:orcl 数据库名:orcl 数据库db_unique_name:orcl1 主机名:pr 物理备库 IP地址:192.168.233.129/24 操作系统版本:rhel5.8 64bit 数据库版本:11.2.0.1 64bi

oracle 11g ADG实施手册(亲测,已成功部署多次)

一:实验环境介绍 虚拟机系统:    RHEL Linux 6.4(64位) 数据库版本:    Oracle 11gR2 11.2.0.4 (64位) IP地址规划: 主数据库 192.168.11.120 SID:pri db_name:pri db_unique_name:pri 备份数据库 192.168.11.121 SID:std db_name:pri db_unique_name:std 安装完成后可以通过以下命令查询: select dbid,name,open_mode,db

ORACLE 11G R2 修改"用户名"

SQL> create pfile from spfile; 修改pfile文件,添加隐含参数 *._enable_rename_user='TRUE',将数据库以restrict方式启动 1.[[email protected] ~]$ cd /u01/app/oracle/product/11.2.0/db1/dbs/ 2.[[email protected] dbs]$ lshc_yoon.dat init.ora inityoon.ora lkYOON orapwyoon snapcf_

Oracle 11g中修改默认密码过期天数和锁定次数

密码过期的原因一般有两种可能: 一.由于Oracle中默认在default概要文件中设置了"PASSWORD_LIFE_TIME=180天"所导致. 二.由于Oracle中默认在default概要文件中设置了"FAILED_LOGIN_ATTEMPTS=10次",当输入密码错误次数达到设置值将导致此问题. 第一种情况解决方法如下: 1.查看用户用的哪种profile策略,一般是default: SQL> select username,profile from

oracle 11g数据库修改字符集

NLS_CHARACTERSET我安装数据库的时候设置为ZHS16GBK,而开发需要的UTF8 据开发反应 向数据库表中插入一条数据的时候,中文就都变了类似于"?(是反问号)"的乱码, 为了能顺利插入成功,故做了此次修改; 查询字符集参数 可以查询以下数据字典或视图查看字符集设置情况 nls_database_parameters.props$.v$nls_parameters 查询结果中NLS_CHARACTERSET表示字符集,NLS_NCHAR_CHARACTERSET表示国家字

Oracle 11g 字符集修改

服务端字符集修改 1.确认服务端字符集 1 select userenv('language') from dual; 2.修改服务端字符集 首先以 DBA 身份登录 Oracle.Windows 系统下直接在命令行下运行命令 sqlplus /as sysdba 或在 SQL PLUS 下运行命令 /as sysdba. 然后依次运行命令: shutdown immediate; (把database停了) startup mount; (把database重开去可更改情況) alter sy

ORACLE 11G ADG的STATSPACK性能报表配置方法

在主库上执行 创建正常STATSPACK报表用户 sqlplus / as sysdba sql>@?/rdbms/admin/spcreate.sqlsql> --注意取消掉$ORACLE_HOME/sqlplus/glogin.sql 某些设置sql> --一些正常的话 会出现要求输入密码和表空间和临时文件 perfstat 235619 --创建SB用户 sql>@?/rdbms/admin/sbcreate.sql输入密码 表空间 临时表空间. 接着问是否要配置网络(y/n