一.背景
1.IP分配 主库:192.168.12.5 node1 备库:192.168.12.6 node2 2.环境 主库已安装数据库软件,已建库,并有业务数据 备库已安装数据库软件,未建库
二、配置主备库网络
1.主库监听: LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.5)(PORT = 1521)) ) ) ADR_BASE_LISTENER = /u01/app/oracle 2.主库网络服务: ORADB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.5)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradb) ) ) ORADBSTD = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.6)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradbstd) ) ) 3.备库监听: LISTENER= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.12.6)(PORT=1521)) ) ) 4.备库网络服务: ORADB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.5)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradb) ) ) ORADBSTD = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.6)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradbstd) ) ) 5.测试主备网络: 主库: [oracle@node1 admin]$ tnsping oradb TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 25-JUL-2020 00:08:29 copyright (c) 1997, 2013, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.5)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradb))) OK (0 msec) [oracle@node1 admin]$ tnsping oradbstd TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 25-JUL-2020 00:08:31 copyright (c) 1997, 2013, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.6)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradbstd))) OK (0 msec) 备库: [oracle@node2 admin]$ tnsping oradb TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 25-JUL-2020 00:12:22 copyright (c) 1997, 2013, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.5)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradb))) OK (0 msec) [oracle@node2 admin]$ tnsping oradbstd TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 25-JUL-2020 00:12:28 copyright (c) 1997, 2013, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.6)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradbstd))) OK (0 msec) 全部都为OK,主备网络配置完成。
三、主库开启归档模式,开启force logging
sql> alter database archivelog; Database altered. sql> alter database force logging; Database altered. sql> alter database open; Database altered.
四、主库添加