oracle更改实例名
------------------
--环境情况
SQL> select * from v$version;
--环境情况
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for Solaris: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for Solaris: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
MED
----------------
MED
SQL> select name from v$database;
NAME
---------
MED
---------
MED
--关闭数据块
SQL> SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
--修改环境变量ORACLE_SID
vi .bash_profile
将ORACLE_SID=MED改为ORACLE_SID=KONG
--修改口令文件和参数文件
oracle@V480-2 /opt/oracle/product/9.2.0$cd dbs/
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$ls
init.ora initMED.ora initdw.ora lkMED orapwMED snapcf_MED.f spfileMED.ora
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$mv orapwMED orapwKONG
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$mv spfileMED.ora spfileKONG.ora
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$mv initMED.ora initKONG.ora
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$ls
init.ora initKONG.ora initdw.ora lkMED orapwKONG snapcf_MED.f spfileKONG.ora
oracle@V480-2 /opt/oracle/product/9.2.0$cd dbs/
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$ls
init.ora initMED.ora initdw.ora lkMED orapwMED snapcf_MED.f spfileMED.ora
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$mv orapwMED orapwKONG
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$mv spfileMED.ora spfileKONG.ora
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$mv initMED.ora initKONG.ora
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$ls
init.ora initKONG.ora initdw.ora lkMED orapwKONG snapcf_MED.f spfileKONG.ora
--重新登录oracle用户使环境变量生效
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$exit
logout
root@V480-2 ~#su - oracle
oracle@V480-2 /opt/oracle/product/9.2.0/dbs$exit
logout
root@V480-2 ~#su - oracle
--启动数据块
SQL> startup
ORACLE instance started.
SQL> startup
ORACLE instance started.
Total System Global Area 2585237200 bytes
Fixed Size 734928 bytes
Variable Size 436207616 bytes
Database Buffers 2147483648 bytes
Redo Buffers 811008 bytes
Database mounted.
Database opened.
Fixed Size 734928 bytes
Variable Size 436207616 bytes
Database Buffers 2147483648 bytes
Redo Buffers 811008 bytes
Database mounted.
Database opened.
--验证
SQL> select instance_name from v$instance;
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
KONG
----------------
KONG
SQL> select name from v$database;
NAME
---------
MED
---------
MED
----------------------
--结论
通过修改环境变量中ORACLE_SID以及对应的参数文件名和口令文件名就可以重新命名实例
dump文件对应的目录如果也要改的话需要先更改参数文件中dump的路径
即使修改了实例名数据块名也不会发生变化
通过修改环境变量中ORACLE_SID以及对应的参数文件名和口令文件名就可以重新命名实例
dump文件对应的目录如果也要改的话需要先更改参数文件中dump的路径
即使修改了实例名数据块名也不会发生变化
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13177610/viewspace-692775/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13177610/viewspace-692775/