环境:
oracle10.2.0.4
linux rhel4.4
1.检查原来的数据库实例名(sid)
[oracle@rhel133 ~]$ ps -ef | grep orcl
oracle 21879 1 0 03:22 ? 00:00:00 ora_pmon_orcl
oracle 21881 1 0 03:22 ? 00:00:00 ora_psp0_orcl
oracle 21883 1 0 03:22 ? 00:00:00 ora_mman_orcl
oracle 21885 1 0 03:22 ? 00:00:00 ora_dbw0_orcl
oracle 21887 1 0 03:22 ? 00:00:00 ora_lgwr_orcl
oracle 21889 1 0 03:22 ? 00:00:00 ora_ckpt_orcl
oracle 21891 1 1 03:22 ? 00:00:00 ora_smon_orcl
oracle 21893 1 0 03:22 ? 00:00:00 ora_reco_orcl
oracle 21895 1 2 03:22 ? 00:00:00 ora_cjq0_orcl
oracle 21897 1 1 03:22 ? 00:00:00 ora_mmon_orcl
oracle 21899 1 0 03:22 ? 00:00:00 ora_mmnl_orcl
oracle 21901 1 0 03:22 ? 00:00:00 ora_d000_orcl
oracle 21903 1 0 03:22 ? 00:00:00 ora_s000_orcl
oracle 21907 1 0 03:22 ? 00:00:00 ora_arc0_orcl
oracle 21909 1 0 03:22 ? 00:00:00 ora_arc1_orcl
oracle 21911 1 0 03:22 ? 00:00:00 ora_qmnc_orcl
oracle 21917 1 0 03:22 ? 00:00:00 ora_j000_orcl
oracle 21919 1 0 03:22 ? 00:00:00 ora_j001_orcl
oracle 21921 1 0 03:23 ? 00:00:00 ora_q000_orcl
oracle 21925 21844 0 03:23 pts/3 00:00:00 grep orcl
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
orcl
2.关闭数据库
注意不能用shutdown abort,只能是shutdown immediate或shutdown normal
SQL> shutdown immediate;
3.修改oracle用户的ORACLE_SID环境变量,由orcl修改为test64
[oracle@rhel133 ~]$ vi .bash_profile
4.修改/etc/oratab文件,将sid名由旧的修改为新的,从orcl修改为test64
5.进入到$ORACLE_HOME/dbs目录,将所有文件名中包含原来的sid的修改为对应的新sid的
改完之后如下:
[oracle@rhel133 dbs]$ ls -lth
total 6.8M
-rw-r----- 1 oracle oinstall 6.8M Apr 9 17:02 snapcf_test64.f
-rw-r--r-- 1 oracle oinstall 930 Apr 9 17:01 inittest64.ora
-rw-rw---- 1 oracle oinstall 24 Apr 9 15:08 lkTEST64
-rw-rw---- 1 oracle oinstall 1.6K Apr 9 14:55 hc_test64
-rw-r----- 1 oracle oinstall 1.5K Apr 9 14:51 orapwtest64
最好重新生成一个pwd文件
[oracle@rhel133 dbs]$ orapwd file=orapwtest64 password='oracle' entries=5 force=y
6.使新修改的ORACLE_SID环境变量生效
[oracle@rhel133 ~]$ . ~/.bash_profile
[oracle@rhel133 ~]$ echo $ORACLE_SID
test64
7.启动数据库
[oracle@rhel133 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Apr 10 03:44:36 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1325400064 bytes
Fixed Size 1267236 bytes
Variable Size 1256196572 bytes
Database Buffers 52428800 bytes
Redo Buffers 15507456 bytes
Database mounted.
Database opened.
SQL> select instance from v$thread;
INSTANCE
--------------------------------------------------------------------------------
test64
[oracle@rhel133 ~]$ ps -ef | grep test64
oracle 21985 1 0 03:44 ? 00:00:00 ora_pmon_test64
oracle 21987 1 0 03:44 ? 00:00:00 ora_psp0_test64
oracle 21989 1 0 03:44 ? 00:00:00 ora_mman_test64
oracle 21991 1 0 03:44 ? 00:00:00 ora_dbw0_test64
oracle 21993 1 0 03:44 ? 00:00:00 ora_lgwr_test64
oracle 21995 1 0 03:44 ? 00:00:00 ora_ckpt_test64
oracle 21997 1 0 03:44 ? 00:00:00 ora_smon_test64
oracle 21999 1 0 03:44 ? 00:00:00 ora_reco_test64
oracle 22001 1 1 03:44 ? 00:00:00 ora_cjq0_test64
oracle 22003 1 0 03:44 ? 00:00:00 ora_mmon_test64
oracle 22005 1 0 03:44 ? 00:00:00 ora_mmnl_test64
oracle 22007 1 0 03:44 ? 00:00:00 ora_d000_test64
oracle 22009 1 0 03:44 ? 00:00:00 ora_s000_test64
oracle 22013 1 0 03:44 ? 00:00:00 ora_arc0_test64
oracle 22015 1 0 03:44 ? 00:00:00 ora_arc1_test64
oracle 22017 1 0 03:44 ? 00:00:00 ora_qmnc_test64
oracle 22023 1 0 03:44 ? 00:00:00 ora_j000_test64
oracle 22025 1 0 03:44 ? 00:00:00 ora_j001_test64
oracle 22027 1 0 03:44 ? 00:00:00 ora_q000_test64
oracle 22029 1 0 03:44 ? 00:00:00 ora_q001_test64
oracle 22031 21844 0 03:45 pts/3 00:00:00 grep test64