old: ecp.priv
new: aei.com
DB: epchrs LINUX SERVER: sandrock
First login as root in the server.
[root@sandrock etc]# hostnamectl set-hostname sandrock.aei.com
[root@sandrock etc]# cat hostname
sandrock.aei.com
[root@sandrock etc]# vi hosts
[root@sandrock etc]# cat hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.131.128.39 serpentcustom.ecp.priv serpentcustom
[root@sandrock etc]# vi hosts -- here add the new hosts
[root@sandrock etc]# hostname
sandrock.aei.com
You have new mail in /var/spool/mail/root
[root@sandrock etc]# service network restart
Restarting network (via systemctl): [ OK ]
[root@sandrock etc]# hostname
sandrock.aei.com
Next
update the
$TNSADMIN/listener.ora
$TNSADMIN/tnsnames.ora
[oracle@sandrock admin]$ sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Wed May 26 19:11:18 2021
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 18c Standard Edition 2 Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
SQL> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
EPCHRS.ECP.PRIV
SQL> show parameters db_domain
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_domain string ecp.priv
SQL> alter system set db_domain='aei.com' scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 4731170856 bytes
Fixed Size 8667176 bytes
Variable Size 989855744 bytes
Database Buffers 3724541952 bytes
Redo Buffers 8105984 bytes
Database mounted.
Database opened.
SQL> show parameters db_domain
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_domain string aei.com
SQL> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
EPCHRS.ECP.PRIV
SQL> ALTER DATABASE RENAME GLOBAL_NAME TO EPCHRS.AEI.COM;
Database altered.
SQL> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
EPCHRS.AEI.COM
SQL>
FINALLY UPDATE CLIENT tnsnames.ora
Based on my observations the db_domain and global_name are not required to be changed when changing the domain of the server.
I tried to connect to the db by only updating the host in the tnsnames.ora to aei and left the the service_name=ecpchris.ecp.priv.
It was still working!!
C:\Users\DexterVelasco>tnsping hkepwind2
TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0 - Production on 26-MAY-2021 19:54:11
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = sandrock.aei.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = wind.ecp.priv)))
OK (140 msec)
C:\Users\DexterVelasco>sqlplus dav4635@hkepwind2
SQL*Plus: Release 12.2.0.1.0 Production on Wed May 26 19:54:36 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter password:
Last Successful login time: Wed May 26 2021 19:37:12 +08:00
Connected to:
Oracle Database 18c Standard Edition 2 Release 18.0.0.0.0 - Production
SQL> select * from tab;
TNAME
--------------------------------------------------------------------------------
TABTYPE CLUSTERID
------------- ----------
IRONWIND
TABLE
SQL>
No comments:
Post a Comment