Oracle 11g 修改数据库名字和实例名字,分两个阶段描述,第一阶段改sid,第二阶段改dbname
下面描述详细步骤
第一阶段:改sid
1、登录数据库查看先前的sid,总共三步,
[oracle@localhost ~]$ sqlplus /as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Oct 1 16:51:35 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance
SQL> startup
ORACLE instance started.
Total System Global Area 539848704 bytes
Fixed Size 1337748 bytes
Variable Size 360711788 bytes
Database Buffers 171966464 bytes
Redo Buffers 5832704 bytes
Database mounted.
Database opened.
SQL> select instance from v$thread ;
INSTANCE
--------------------------------------------------------------------------------
orcl
2、关闭数据库
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
3、编辑/etc/oratab文件,把所有orcl换成test,大部分情况其实就一条。----这几步不需要管的。
[oracle@localhost ~]$ vim /etc/oratab
4、更改oracle用户的 .bash_profile文件,把orcl改成test
[oracle@localhost ~]$ vim .bash_profile
5、使改好的.bash_profile文件生效
[oracle@localhost ~]$ . .bash_profile
7、查看系统环境变量
[oracle@localhost ~]$ env | grep ORACLE
ORACLE_UNQNAME=test
ORACLE_SID=test
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
效果已经生成。
8、进入$ORACLE_HOME/dbs查看目录,看那些有orcl,改成test
[oracle@localhost ~]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ ll
总计 24
-rw-rw---- 1 oracle oinstall 1544 10-01 16:55 hc_orcl.dat
-rw-r--r-- 1 oracle oinstall 2851 2009-05-15 init.ora
-rw-r----- 1 oracle oinstall 24 09-28 20:57 lkORCL
-rw-r----- 1 oracle oinstall 1536 09-29 09:42 orapworcl
drwx------ 2 oracle oinstall 4096 09-28 20:55 peshm_orcl_0
-rw-r----- 1 oracle oinstall 2560 10-01 16:53 spfileorcl.ora
9、更改文件名orcr>> test,ORCL>>test,命令如下:
[oracle@localhost dbs]$ mv hc_orcl.dat hc_test.dat
[oracle@localhost dbs]$ mv orapworcl orapwtest
[oracle@localhost dbs]$ mv lkORCL lkTEST
[oracle@localhost dbs]$ mv peshm_orcl_0/ peshm_test_0/
[oracle@localhost dbs]$ mv spfi