三、更改INSTANCE_NAME

三、更改INSTANCE_NAME

1、检查当前的instance_name 是wwl

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
wwl

2、创建pfile参数文件
SQL> create pfile from spfile;
                             
File created.

3、关闭数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> host

4、切换到操作系统命令行,修改用户环境下的.bash_profile参数文件,将ORACLE_SID的值由原来的wwl改为wwl01
[oracle@ora10g ~]$ cd
[oracle@ora10g ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

export ORACLE_SID=wwl01
export ORACLE_BASE=/orasoft/
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBARY_PATH=$ORACLE_HOME/lib
export LANG="zh_CN.GB18030";
export PATH
umask 022


".bash_profile" 22L, 410C written

5、让刚才修改的ORACLE_SID的值立即生效                                                        
[oracle@ora10g ~]$ source .bash_profile

6、检查下系统的环境变量中的ORACLE_SID的值是否已经更改为我们理想中的wwl01
[oracle@ora10g ~]$ echo $ORACLE_SID
wwl01

7、进入$ORACLE_HOME/dbs目录,也就是pfile存放的路径,将initwwl.ora参数文件改名为initwwl01.ora
[oracle@ora10g ~]$ cd $ORACLE_HOME/dbs
[oracle@ora10g dbs]$ ls
hc_wwl.dat  initdw.ora  init.ora  initwwl.ora  lkWWL  lkWWL01  spfilewwl.ora
[oracle@ora10g dbs]$ mv initwwl.ora initwwl01.ora
[oracle@ora10g dbs]$ pwd
/orasoft/product/10.2.0/db_1/dbs

8、进入数据库用刚才复制的参数文件启动数据库
[oracle@ora10g dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 22 00:37:33 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount pfile='/orasoft/product/10.2.0/db_1/dbs/initwwl01.ora';
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              62916176 bytes
Database Buffers          218103808 bytes
Redo Buffers                2973696 bytes
Database mounted.

9、检查数据库的当前instance_name是否已经修改为wwl01了,我们看到已经成功了。
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
wwl01

10、将数据库OPEN,数据库已经能够正常运行了。
SQL> alter database open;

Database altered.

SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
wwl01            OPEN

SQL>

 

你可能感兴趣的:(oracle,sql,数据库,database,System,Path)