oracle 11g更新SID步驟

1.進入SQLPLUS確認SID

[root@localhost oracle]# sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 10 13:51:11 2013

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

Enter password:    ==>這裡KEY入密碼

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance from v$thread;

INSTANCE
--------------------------------------------------------------------------------
orcl       ==>舊的名稱

SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[root@localhost oracle]# service oracle stop
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://localhost:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
 ...  Stopped.
Processing Database instance "orcl": log file /opt/oracle/product/OraHome/shutdown.log
[root@localhost oracle]#


2.編輯/etc/oratab檔案,把所有orcl改成hank01。

[root@localhost oracle]# vi /etc/oratab



3.更改oracle用户的 .bash_profile檔案
[root@localhost oracle]# vi .bash_profile





4、將改好的.bash_profile檔案生效
 [root@localhost oracle]# . .bash_profile

5、查看系統環境變數

[root@localhost oracle]#  env |grep ORACLE 
ORACLE_OWNER=oracle
ORACLE_SID=hank01
ORACLE_BASE=/opt/oracle
ORACLE_TERM=vt100
ORACLE_HOME=/opt/oracle/product/OraHome

6.進入$ORACLE_HOME/dbs查看目录,看那些有orcl

[root@localhost oracle]# cd $ORACLE_HOME/dbs 
[root@localhost dbs]# ll
總計 20
-rw-rw----. 1 oracle oinstall 1544 2013-01-10 13:52 hc_orcl.dat
-rw-r--r--. 1 oracle oinstall 2851 2009-05-15 13:35 init.ora
-rw-r-----. 1 oracle oinstall   24 2013-01-07 20:15 lkORCL
-rw-r-----. 1 oracle oinstall 1536 2013-01-07 20:22 orapworcl
-rw-r-----. 1 oracle oinstall 2560 2013-01-10 13:49 spfileorcl.ora

7、更改檔案名稱把有orcl字串的檔名改成新的hank01(orcl=>hank01,ORCL=>HANK01),命令如下:

[root@localhost dbs]# mv hc_orcl.dat hc_hank01.dat
[root@localhost dbs]# mv orapworcl orapwhank01 
[root@localhost dbs]# mv lkORCL lkHANK01
[root@localhost dbs]# mv spfileorcl.ora spfilehank01.ora

    8、重行產生密碼檔(筆者產生時有錯誤產生,但不影響作業)

     [oracle@localhost dbs]$ orapwd file=$ORACLE_HOME/dbs

    Enter password for SYS:

    OPW-00005: File with same name exists - please delete or rename   ==>出現錯誤


    9. 進入SQLPUS,startup資料庫並查詢INSTANCE是否已經更改(SID已由orcl變成hank01了)

    [oracle@localhost dbs]$ sqlplus sys as sysdba

    SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 10 18:34:55 2013

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

    Enter password:
    Connected to an idle instance.

    SQL> startup
    ORACLE instance started.

    Total System Global Area  839282688 bytes
    Fixed Size            2217992 bytes
    Variable Size          494929912 bytes
    Database Buffers      335544320 bytes
    Redo Buffers            6590464 bytes
    Database mounted.
    Database opened.
    SQL> select instance from v$thread;

    INSTANCE
    --------------------------------------------------------------------------------
    hank01      ==>已經改成新的SID了

    SQL>











    留言

    這個網誌中的熱門文章

    java 數字轉字串 字串轉數字

    MS sqlServer資料庫移轉至MySQL-->利用MySQL WorkBench

    sql server 15023 error [SQL SERVER問題: 使用者、組或角色 '*****' 在當前資料庫中已存在]