oracle 数据库更改 SID 详细解释 操作步骤 oracle更改SID详解

1、关闭数据库

SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.


2、退出SQLPLUS

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、更改环境变量

[oracle@localhost ~]$ export ORACLE_SID=nihao [oracle@localhost ~]$ export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH

4、修改配置文件(修改/etc/oratab文件,将sid名由旧的修改为新的,如从orcl修改为nihao)

[oracle@localhost ~]$ more /etc/oratab # This file is used by ORACLE utilities. It is created by root.sh # and updated by the Database Configuration Assistant when creating # a database. # A colon, ':', is used as the field terminator. A new line termina tes # the entry. Lines beginning with a pound sign, '#', are comments. # # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:<N|Y>: # # The first and second fields are the system identifier and home # directory of the database respectively. The third filed indicates # to the dbstart utility that the database should , "Y", or should n ot, # "N", be brought up at system boot time. # # Multiple entries with the same $ORACLE_SID are not allowed. # # orcl:/oracle/app/oracle/product/11.2.0/dbhome_1:Y


把最后一行的orcl字样改成nihao;

更改后的样子是:

[oracle@localhost ~]$ more /etc/oratab # This file is used by ORACLE utilities. It is created by root.sh # and updated by the Database Configuration Assistant when creating # a database. # A colon, ':', is used as the field terminator. A new line termina tes # the entry. Lines beginning with a pound sign, '#', are comments. # # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:<N|Y>: # # The first and second fields are the system identifier and home # directory of the database respectively. The third filed indicates # to the dbstart utility that the database should , "Y", or should n ot, # "N", be brought up at system boot time. # # Multiple entries with the same $ORACLE_SID are not allowed. # # nihao:/oracle/app/oracle/product/11.2.0/dbhome_1:Y


5、更改数据库系统文件,进入到$ORACLE_HOME/dbs目录将所有文件名中包含原来的sid的地方修改为对应的新sid的(这里有orcl改为nihao)
如我对如下文件修改为其后对应的文件和文件夹。

(1)进入$ORACLE_HOME/dbs目录

[oracle@localhost ~]$ cd $ORACLE_HOME/dbs [oracle@localhost dbs]$


(2)查看该目录下有什么内容

[oracle@localhost dbs]$ ll 总计 72 -rw-rw---- 1 oracle oinstall 1544 09-14 11:27 hc_DBUA0.dat -rw-rw---- 1 oracle dba 1544 09-21 17:02 hc_orcl.dat -rw-r--r-- 1 oracle dba 2851 2009-05-15 init.ora -rw-r----- 1 oracle dba 24 08-28 12:25 lkORCL -rw-r----- 1 oracle dba 1536 09-21 10:30 orapworcl drwx------ 2 oracle oinstall 4096 08-31 07:57 peshm_DBUA0_0 drwx------ 2 oracle dba 4096 08-28 12:22 peshm_orcl_0 -rw-r----- 1 oracle dba 2560 09-21 10:30 spfileorcl.ora


(3)

总共5个含有orcl或者ORCL的地方,够要改。

[oracle@localhost dbs]$ mv hc_orcl.dat hc_nihao.dat [oracle@localhost dbs]$ mv lkORCL lkNIHAO [oracle@localhost dbs]$ mv orapworcl orapwnihao [oracle@localhost dbs]$ mv peshm_orcl_0/ peshm_nihao/ [oracle@localhost dbs]$ mv spfileorcl.ora spfilenihao.ora


(4)查看更改以后的结果

[oracle@localhost dbs]$ ll 总计 80 -rw-rw---- 1 oracle oinstall 1544 09-14 11:27 hc_DBUA0.dat -rw-rw---- 1 oracle dba 1544 09-21 18:14 hc_nihao.dat -rw-r--r-- 1 oracle dba 2851 2009-05-15 init.ora -rw-r----- 1 oracle dba 24 08-28 12:25 lkNIHAO -rw-r----- 1 oracle dba 1536 09-21 10:30 orapwnihao drwx------ 2 oracle oinstall 4096 08-31 07:57 peshm_DBUA0_0 drwx------ 2 oracle dba 4096 08-28 12:22 peshm_nihao -rw-r----- 1 oracle dba 3584 09-21 18:37 spfilenihao.ora

如果有问题,要回过头来检查这里,个人备注。

6、启动数据库

[oracle@localhost ~]$ sqlplus "/as sysdba" SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 21 18:11:47 2011 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 443592704 bytes Fixed Size 1337100 bytes Variable Size 272632052 bytes Database Buffers 163577856 bytes Redo Buffers 6045696 bytes Database mounted. Database opened.


7、查看实例名

SQL> select instance from v$thread; INSTANCE -------------------------------------------------------------------------------- nihao


8、退出sqlplus

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


9、查看系统环境变量

[oracle@localhost ~]$ env | grep ORACLE ORACLE_SID=nihao ORACLE_BASE=/oracle/app/oracle ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1 [oracle@localhost ~]$


其中第二行,很明白的告诉大家,启动成功,更改生效。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值