1

我只是克隆了一个托管 Oracle 的服务器,以便制作一个 linux 测试机。但是 sqlplus user/password@alias 连接在克隆的服务器上不起作用。我找不到要更改的内容。先感谢您

以下是源服务器的配置文件:

主机名 :

[root@server1]# cat /etc/hosts

192.168.0.11 server1.domain.com server1

全局名称:

从 global_name 中选择 * ;

my_sid1.server1.domain.com

listner.ora:

LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = REGISTER)) )

sid_list_listener=(sid_list= (sid_desc= (global_name=server1) (sid_name=my_sid1) (oracle_home=/u01/app/oracle/product/12r1) )

tnsnames.ora:

serv1.my_sid1=(description= (address= (protocol=ipc) (key=my_sid1)) (address= (protocol=tcp) (host=server1) (port=1521)) (connect_data=(service_name=my_sid1.server1. domain.com)(服务器=专用)))

在克隆的服务器上,使用以下配置,我收到错误消息“ORA-12154:TNS:无法解析指定的连接标识”

主机名 :

[root@server2]# cat /etc/hosts

192.168.0.12 server2.domain.com server2

监听器.ora:

LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = server2)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = REGISTER)) )

sid_list_listener=(sid_list= (sid_desc= (global_name=server2) (sid_name=my_sid2) (oracle_home=/u01/app/oracle/product/12r1) )

tnsnames.ora

server2.my_sid2=(description= (address= (protocol=ipc) (key=my_sid2)) (address= (protocol=tcp) (host=server2) (port=1521)) (connect_data=(service_name=my_sid1.server1. domain.com)(服务器=专用)))

我正在尝试按如下方式使用 sqlplus 命令,但它不起作用:

sqlplus 用户/密码@my_sid2

认为

4

1 回答 1

0

克隆主机时,实例名称没有改变。tnsnames.ora listener.ora在不更改实例名称的情况下更改文件 中的地址的最简单方法。监听器.ora

    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = server2)(PORT = 1521))
          (ADDRESS = (PROTOCOL = IPC)(KEY = REGISTER))
        )
      )

    sid_list_listener=(sid_list=
                            (sid_desc=
                                    (global_name=server1)
                                    (sid_name=my_sid1)
                                    (oracle_home=/u01/app/oracle/product/12r1)
                            )
                      )

tnsnames.ora

server2.my_sid2=(description=
             (address=
                 (protocol=ipc)
                  (key=my_sid1))
             (address=
                 (protocol=tcp)
                 (host=server2)
                 (port=1521))
(connect_data=(service_name=my_sid1.server1.domain.com)(server=DEDICATED)))

编辑后listener.ora,您必须以 oracle 用户身份重新启动侦听器进程。

lsnrctl stop
lsnrctl start

尝试sqlplus user/password@server2.my_sid2

如果您需要更改实例名称,则需要按照更改数据库名称的说明进行操作。 更改 DBID 和数据库名称

于 2019-10-17T16:13:13.847 回答