Oracle database connection problem after cloning the server

886 views Asked by At

I just clone a server that hosts Oracle in order to make a linux test machine. But the sqlplus user/password@alias connection does not work on the cloned server. I do not find what to change. Thank you in advance

here are the configuration files of the source server:

Hostname :

[root@server1]# cat /etc/hosts

192.168.0.11 server1.domain.com server1

Global name :

select * from 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)(server=DEDICATED)))

on the cloned server, with the configuration below, I have the error message "ORA-12154: TNS: Could not resolve the connect identify specified"

Hostname :

[root@server2]# cat /etc/hosts

192.168.0.12 server2.domain.com server2

listener.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)(server=DEDICATED)))

I am trying to use the sqlplus command as follows but it does not work:

sqlplus user/password@my_sid2

Thinks

1

There are 1 answers

1
Dmitry Demin On

When cloning a host, the instance name did not change. The easiest way to change addresses in tnsnames.ora listener.ora files without changing the instance name. listener.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)))

After editing the listener.ora, you must restart the listener process as an oracle user.

lsnrctl stop
lsnrctl start

try sqlplus user/[email protected]_sid2

If you need to change the instance name, then you need to follow the instructions for changing the database name. Changing the DBID and Database Name