ORACLE修改service_name服务名

ORACLE修改service_name服务名

1.备份相关参数文件

#备份spfile
create pfile='/tmp/pfile' from spfile;

#备份tnsnames.ora
cd $ORACLE_HOME/network/admin/
cp tnsnames.ora tnsnames.bak

2.修改service_name

#查看当前服务名
show parameter service_names;

#修改服务名
ALTER SYSTEM SET service_names=’new_service_name’ SCOPE=SPFILE;

#修改tnsnames.ora文件
SERVICE_NAME =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = port))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = new_service_name)
    )
  )

#关机重启
shutdown immediate;
startup;

3.验证是否修改成功

#sys用户登录查看服务名是否被修改
show parameter service_names;

#普通用户登录验证是否修改成功
sqlplus username/password@new_service_name

你可能感兴趣的:(ORACLE,oracle,数据库)