Oracle 修改執行個體名 SID,oracle修改執行個體sid

來源:互聯網
上載者:User

Oracle 修改執行個體名 SID,oracle修改執行個體sid

修改ORACLE執行個體名

系統內容:CentOS 6.5
ORACLE版本:10.2

1、檢查原來的資料庫執行個體名
$ echo $ORACLE_SID
orcl

$ sqlplus / as sysdba
> select instance from v$thread;
INSTANCE
--------------------------------------------------------------------------------
orcl


2、關閉資料庫
> shutdown immediate;
> exit;


3、修改oracle使用者的ORACLE_SID環境變數,如由orcl修改為doiido
$ vi /home/oracle/.bash_profile
export ORACLE_SID=doiido
$ source /home/oracle/.bash_profile


4、修改/etc/oratab檔案,將sid名由orcl修改為doiido
$ vi /etc/oratab
doiido:/u01/app/oracle/11.2/db_1:Y


5、進入到$ORACLE_HOME/dbs目錄
將所有檔案名稱中包含原來的sid的修改為對應的新sid的
$ cd $ORACLE_HOME/dbs
$ mv hc_zf.dat hc_doiido.dat 
$ mv lkZF lkDOIIDO
$ mv orapwzf orapwdoiido
$ mv spfilezf.ora spfiledoiido.ora 


6、重建口令檔案
因為口令檔案改名後不能在新執行個體中使用,所以重建
$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=123456 entries=5 force=y 


7、啟動資料庫
$ sqlplus / as sysdba 
> startup



8、檢查資料庫執行個體名
通過如下語句檢查資料庫執行個體名,發現執行個體名已經由orcl變成doiido
> select instance from v$thread; 
INSTANCE
--------------------------------------------------------------------------------
doiido


這個時候雖然執行個體名字已經改成doiido,但是資料庫名(dbname)仍然為orcl,因此在用戶端仍舊無法串連,如需要串連,則需修改dbname



相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.