This article briefly introduces how to register A database instance on one machine to another machine, for example, registering A database instance on machine A to machine B.
1. Check the status of listener of machine B before machine A registers with machine B, as shown below:
C: \ Documents ents and Settings \ Administrator> lsnrctl status
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0-Production on 16-JAN-2012 17:10:39
Copyright (c) 1991,200 5, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 147.151.240.89) (PORT = 1521 )))
STATUS of the LISTENER
------------------------
Services Summary...
Service "ORCL" has 2 instance (s ).
Instance "ORCL", status UNKNOWN, has 1 handler (s) for this service...
Instance "orcl", status READY, has 1 handler (s) for this service...
Service "PLSExtProc" has 1 instance (s ).
Instance "PLSExtProc", status UNKNOWN, has 1 handler (s) for this service...
Service "orclXDB" has 1 instance (s ).
Instance "orcl", status READY, has 1 handler (s) for this service...
Service "orcl_XPT" has 1 instance (s ).
Instance "orcl", status READY, has 1 handler (s) for this service...
The command completed successfully
There is no registration information for machine.
2. Add the following to tnsnames. ora of machine:
LISTENE_R =
(ADDRESS = (PROTOCOL = TCP) (HOST = 147.151.240.89) (PORT = 1521 ))
3. Modify the remote_listener of machine A to the LISTENE_R configured in step 1.
SQL> alter system set remote_listener = LISTENE_R;
System altered.
4. Check the listener status of machine B as follows:
C: \ Documents ents and Settings \ Administrator> lsnrctl status
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0-Production on 16-JAN-2012 17:27:35
Copyright (c) 1991,200 5, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 147.151.240.89) (PORT = 1521 )))
STATUS of the LISTENER
------------------------
Services Summary...
Service "ORCL" has 3 instance (s ).
Instance "ORCL", status UNKNOWN, has 1 handler (s) for this service...
Instance "orcl", status READY, has 1 handler (s) for this service...
Instance "orcl", status READY, has 1 handler (s) for this service...
Service "ORCLTEST" has 1 instance (s ).
Instance "orcl", status READY, has 1 handler (s) for this service...
Service "PLSExtProc" has 1 instance (s ).
Instance "PLSExtProc", status UNKNOWN, has 1 handler (s) for this service...
Service "orclXDB" has 2 instance (s ).
Instance "orcl", status READY, has 1 handler (s) for this service...
Instance "orcl", status READY, has 1 handler (s) for this service...
Service "orcl_XPT" has 2 instance (s ).
Instance "orcl", status READY, has 1 handler (s) for this service...
Instance "orcl", status READY, has 1 handler (s) for this service...
The command completed successfully
You can see that the database instance of machine A is registered to the listener of machine B. The db_name and service_name of machine A are registered to the listener of machine B.
The following information is displayed on machine:
SQL> show parameter db_name
NAME TYPE VALUE
-------------------------------------------------------------
Db_name string orcl
SQL> show parameter service_names;
NAME TYPE VALUE
-------------------------------------------------------------
Service_names string ORCLTEST
5. Add the following to tnsnames. ora of machine B:
TESTDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = orcltest)
)
)
Orcltest is A service registered from machine A to machine B.
Connect to the database instance of machine A through sqlplus on machine B
C: \ Documents ents and Settings \ Administrator> sqlplus yorker/yorker @ testdb
SQL * Plus: Release 10.2.0.1.0-Production on Mon Jan 16 17:45:24 2012
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from test;
ID TYPE
--------------------
1 1
You can successfully access the table on machine.
In practice, there are few such applications. RAC requires instances to register with each other to listen to each other. Here we just simulate registering the database instance of one machine to another.
Author kkdelta