一、更改ORACLE SID名稱
更改ORACLE SID名稱
1、切換到ORACLE使用者,登陸到ORACLE資料庫:
[root@ora10g ~]# su - oracle
[oracle@ora10g ~]$ sqlplus / as sysdba
[root@ora10g ~]# su - oracle
[oracle@ora10g ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 6 23:52:04 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
2、檢視當前的例項名
SQL> col host_name format a20
SQL> select host_name,instance_name,status from v$instance;
SQL> col host_name format a20
SQL> select host_name,instance_name,status from v$instance;
HOST_NAME INSTANCE_NAME STATUS
-------------------- ---------------- ------------
ora10g.localdomain wwl OPEN
-------------------- ---------------- ------------
ora10g.localdomain wwl OPEN
3、建立引數檔案
SQL> create pfile from spfile;
SQL> create pfile from spfile;
File created.
4、關閉例項
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
5、停止監聽
[oracle@ora10g ~]$ lsnrctl stop
[oracle@ora10g ~]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 06-DEC-2011 23:54:53
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora10g.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
6、檢查是否有資料庫相關的程式,這裡檢視到ORACLE的程式都沒有啟動
[oracle@ora10g ~]$ ps -ef|grep ora
root 1907 1885 0 23:49 ? 00:00:00 hald-addon-storage: polling /dev/hdc
avahi 2086 1 0 23:49 ? 00:00:00 avahi-daemon: running [ora10g.local]
root 2455 2259 0 23:51 pts/1 00:00:00 su - oracle
oracle 2456 2455 0 23:51 pts/1 00:00:00 -bash
oracle 2501 2456 0 23:55 pts/1 00:00:00 ps -ef
oracle 2502 2456 0 23:55 pts/1 00:00:00 grep ora
[oracle@ora10g ~]$ ps -ef|grep list
68 1893 1885 0 23:49 ? 00:00:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
68 1897 1885 0 23:49 ? 00:00:00 hald-addon-keyboard: listening on /dev/input/event0
root 2297 2292 0 23:49 tty7 00:00:00 /usr/bin/Xorg :0 -br -audit 0 -auth /var/gdm/:0.Xauth -nolisten tcp vt7
oracle 2504 2456 0 23:55 pts/1 00:00:00 grep list
[oracle@ora10g ~]$ ps -ef|grep tns
oracle 2506 2456 0 23:55 pts/1 00:00:00 grep tns
[oracle@ora10g ~]$ ps -ef|grep ora
root 1907 1885 0 23:49 ? 00:00:00 hald-addon-storage: polling /dev/hdc
avahi 2086 1 0 23:49 ? 00:00:00 avahi-daemon: running [ora10g.local]
root 2455 2259 0 23:51 pts/1 00:00:00 su - oracle
oracle 2456 2455 0 23:51 pts/1 00:00:00 -bash
oracle 2501 2456 0 23:55 pts/1 00:00:00 ps -ef
oracle 2502 2456 0 23:55 pts/1 00:00:00 grep ora
[oracle@ora10g ~]$ ps -ef|grep list
68 1893 1885 0 23:49 ? 00:00:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
68 1897 1885 0 23:49 ? 00:00:00 hald-addon-keyboard: listening on /dev/input/event0
root 2297 2292 0 23:49 tty7 00:00:00 /usr/bin/Xorg :0 -br -audit 0 -auth /var/gdm/:0.Xauth -nolisten tcp vt7
oracle 2504 2456 0 23:55 pts/1 00:00:00 grep list
[oracle@ora10g ~]$ ps -ef|grep tns
oracle 2506 2456 0 23:55 pts/1 00:00:00 grep tns
7、修改剛才建立的pfile引數檔案,主要新增和修改instance_name和service_names的值為新值:
[oracle@ora10g ~]$ cd $ORACLE_HOME/dbs
[oracle@ora10g ~]$ cd $ORACLE_HOME/dbs
[oracle@ora10g dbs]$ ls -rtl
總計 68
-rw-r----- 1 oracle oinstall 8385 1998-09-11 init.ora
-rw-r----- 1 oracle oinstall 12920 2001-05-03 initdw.ora
-rw-rw---- 1 oracle oinstall 1544 11-17 15:39 hc_wwl.dat
-rw-r----- 1 oracle oinstall 1536 11-17 15:41 orapwwwl
-rw-r----- 1 oracle oinstall 2048 11-19 02:47 orawwl02
-rw-rw---- 1 oracle oinstall 24 11-19 03:12 lkWWL
-rw-rw---- 1 oracle oinstall 1544 11-19 03:17 hc_wwl02.dat
-rw-r----- 1 oracle oinstall 667 11-19 03:18 initwwl02.ora
-rw-rw---- 1 oracle oinstall 24 11-19 03:19 lkWWL02
-rw-r----- 1 oracle oinstall 2560 11-19 04:22 spfilewwl02.ora
-rw-r----- 1 oracle oinstall 3584 12-06 23:51 spfilewwl.ora
-rw-r--r-- 1 oracle oinstall 1038 12-06 23:54 initwwl.ora
總計 68
-rw-r----- 1 oracle oinstall 8385 1998-09-11 init.ora
-rw-r----- 1 oracle oinstall 12920 2001-05-03 initdw.ora
-rw-rw---- 1 oracle oinstall 1544 11-17 15:39 hc_wwl.dat
-rw-r----- 1 oracle oinstall 1536 11-17 15:41 orapwwwl
-rw-r----- 1 oracle oinstall 2048 11-19 02:47 orawwl02
-rw-rw---- 1 oracle oinstall 24 11-19 03:12 lkWWL
-rw-rw---- 1 oracle oinstall 1544 11-19 03:17 hc_wwl02.dat
-rw-r----- 1 oracle oinstall 667 11-19 03:18 initwwl02.ora
-rw-rw---- 1 oracle oinstall 24 11-19 03:19 lkWWL02
-rw-r----- 1 oracle oinstall 2560 11-19 04:22 spfilewwl02.ora
-rw-r----- 1 oracle oinstall 3584 12-06 23:51 spfilewwl.ora
-rw-r--r-- 1 oracle oinstall 1038 12-06 23:54 initwwl.ora
[oracle@ora10g dbs]$ vi initwwl.ora
*.__db_cache_size=218103808
*.__java_pool_size=4194304
*.__large_pool_size=4194304
*.__shared_pool_size=54525952
*.__streams_pool_size=0
*.audit_file_dest='/orasoft//admin/wwl/adump'
*.background_dump_dest='/orasoft//admin/wwl/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/oradata/wwl/control01.ctl','/oradata/wwl/control02.ctl','/oradata/wwl/control03.ctl'
*.core_dump_dest='/orasoft//admin/wwl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_recovery_file_dest='/oradata/flash_back'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=wwlXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=/oradata/archive'
*.log_archive_format='%t_%s_%r.dbf'
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=285212672
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/orasoft//admin/wwl/udump'
*.__db_cache_size=218103808
*.__java_pool_size=4194304
*.__large_pool_size=4194304
*.__shared_pool_size=54525952
*.__streams_pool_size=0
*.audit_file_dest='/orasoft//admin/wwl/adump'
*.background_dump_dest='/orasoft//admin/wwl/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/oradata/wwl/control01.ctl','/oradata/wwl/control02.ctl','/oradata/wwl/control03.ctl'
*.core_dump_dest='/orasoft//admin/wwl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_recovery_file_dest='/oradata/flash_back'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=wwlXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=/oradata/archive'
*.log_archive_format='%t_%s_%r.dbf'
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=285212672
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/orasoft//admin/wwl/udump'
--新增如下內容
*.db_name='wwl'
*.instance_name = wwl01
*.service_names = wwl01
*.db_name='wwl'
*.instance_name = wwl01
*.service_names = wwl01
~
~
8、檢查剛才新增的引數檔案,是否已新增進來。
[oracle@ora10g dbs]$ cat initwwl.ora
*.__db_cache_size=218103808
*.__java_pool_size=4194304
*.__large_pool_size=4194304
*.__shared_pool_size=54525952
*.__streams_pool_size=0
*.audit_file_dest='/orasoft//admin/wwl/adump'
*.background_dump_dest='/orasoft//admin/wwl/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/oradata/wwl/control01.ctl','/oradata/wwl/control02.ctl','/oradata/wwl/control03.ctl'
*.core_dump_dest='/orasoft//admin/wwl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='wwl'
*.db_recovery_file_dest='/oradata/flash_back'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=wwlXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=/oradata/archive'
*.log_archive_format='%t_%s_%r.dbf'
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=285212672
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/orasoft//admin/wwl/udump'
*.instance_name = wwl01
*.service_names = wwl01
~
9、並且建立新的密碼檔案
[oracle@ora10g dbs]$ orapwd file=orapwwwl01.ora password=oracle;
[oracle@ora10g dbs]$ cd /orasoft/product/10.2.0/db_1/network/admin/
[oracle@ora10g admin]$ ls
listener11113011AM1905.bak listener.ora samples shrept.lst tnsnames11113011AM1905.bak tnsnames.ora
~
8、檢查剛才新增的引數檔案,是否已新增進來。
[oracle@ora10g dbs]$ cat initwwl.ora
*.__db_cache_size=218103808
*.__java_pool_size=4194304
*.__large_pool_size=4194304
*.__shared_pool_size=54525952
*.__streams_pool_size=0
*.audit_file_dest='/orasoft//admin/wwl/adump'
*.background_dump_dest='/orasoft//admin/wwl/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/oradata/wwl/control01.ctl','/oradata/wwl/control02.ctl','/oradata/wwl/control03.ctl'
*.core_dump_dest='/orasoft//admin/wwl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='wwl'
*.db_recovery_file_dest='/oradata/flash_back'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=wwlXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=/oradata/archive'
*.log_archive_format='%t_%s_%r.dbf'
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=285212672
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/orasoft//admin/wwl/udump'
*.instance_name = wwl01
*.service_names = wwl01
~
9、並且建立新的密碼檔案
[oracle@ora10g dbs]$ orapwd file=orapwwwl01.ora password=oracle;
[oracle@ora10g dbs]$ cd /orasoft/product/10.2.0/db_1/network/admin/
[oracle@ora10g admin]$ ls
listener11113011AM1905.bak listener.ora samples shrept.lst tnsnames11113011AM1905.bak tnsnames.ora
10、檢查監聽檔案,如果有SID_NAME這個引數,將其修改為新的SID即可,我這裡沒有,就不修改了
[oracle@ora10g admin]$ vi listener.ora
# listener.ora Network Configuration File: /orasoft//product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
[oracle@ora10g admin]$ vi listener.ora
# listener.ora Network Configuration File: /orasoft//product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(PROGRAM = extproc)
)
)
(SID_LIST =
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
(DESCRIPTION_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
"tnsnames.ora" 24L, 527C 已寫入
10、使用剛才修改後的spfile引數啟動資料庫:
[oracle@ora10g dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 7 00:04:50 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup pfile='/orasoft/product/10.2.0/db_1/dbs/initwwl.ora';
ORACLE instance started.
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.
Database opened.
Fixed Size 1218992 bytes
Variable Size 62916176 bytes
Database Buffers 218103808 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
11、將剛才建立的pfile引數建立為spfile,以後啟動預設使用該spfile引數啟動資料庫
SQL> create spfile from pfile;
SQL> create spfile from pfile;
File created.
12、檢查修改後的SID的名稱,我們看到確實是已經修改過來了,但是例項名和DATABASE名稱是不會修改的
SQL> show parameter instance_name
SQL> show parameter instance_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string wwl01
SQL> show parameter service_names
------------------------------------ ----------- ------------------------------
instance_name string wwl01
SQL> show parameter service_names
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string wwl01
------------------------------------ ----------- ------------------------------
service_names string wwl01
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
wwl
----------------
wwl
SQL> select name from v$database;
NAME
---------
WWL
---------
WWL
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20674423/viewspace-713739/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle - 資料庫名、例項名、服務名、ORACLE_SID 的說明和區別Oracle資料庫
- CentOS 6.X怎麼更改網路卡名稱?CentOS 6.X更改網路卡名稱的方法CentOS
- 更改Linux系統的網路卡名稱Linux
- 在蘋果Mac上如何更改AirDrop名稱?蘋果MacAI
- oracle中的某一個使用者名稱修改Oracle
- windows10系統更改賬戶名稱的方法Windows
- win10系統更改管理員名稱的方法Win10
- 更改 RHEL7 或者 CentOS 7 的網路卡名稱CentOS
- win10更換賬戶名稱的方法_w10怎麼更改賬戶名稱Win10
- WordPress使用者名稱能改幾次?附更改使用者名稱4種方法
- PbootCMS提示:URL名稱與模型URL名稱衝突,請換一個名稱!boot模型
- Win10系統下如何修改電腦名稱?windows10更改電腦名稱的方法Win10Windows
- win10怎麼改使用者名稱_win10如何更改使用者名稱Win10
- win10 如何更改賬戶id_win10怎麼更改賬戶名稱Win10
- Mac 入門教程:如何更改你的 Mac 裝置名稱Mac
- 修改了github使用者名稱後,部落格的更改Github
- win10 1909如何更改管理員名稱_win10 1909怎麼修改管理員賬戶名稱Win10
- 如何在Mac 上更改電腦的名稱或本地區域網主機名Mac
- Postgresql10資料庫之更改資料庫的名稱SQL資料庫
- windows10系統怎麼更改我的文件名稱Windows
- 更改wordpress的預設登入頁面名稱wp-login
- oracle改了表名後,不需要去更改授權Oracle
- win10電腦使用者名稱怎麼改_windows10怎麼更改使用者名稱Win10Windows
- oracle11g修改使用者名稱Oracle
- win10 如何更改系統盤c d e命名 win10更改碟符名稱方法Win10
- win10電腦使用者名稱怎麼改_win10更改電腦使用者名稱步驟Win10
- win10電腦怎麼改開機使用者名稱 win10開機賬戶名稱更改方法Win10
- win10家庭版更改使用者名稱怎麼改_如何修改win10使用者名稱Win10
- oracle 透過pid 找到sid 再找出執行sqlOracleSQL
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid不同UXDatabaseOracle
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid相同UXDatabaseOracle
- win10系統怎麼更改user使用者名稱中文為英文Win10
- win10系統下無法更改賬戶名稱的解決方法Win10
- win10怎麼更改使用者名稱資料夾_win10如何修改suers使用者名稱資料夾Win10
- win10電腦怎麼改開機使用者名稱 win10電腦開機使用者名稱更改方法Win10
- 為何不能在Oracle表名稱中使用特殊字元?RFOracle字元
- dataguard 搭建 oracle_sid相同 2節點 primary+standbyOracle
- dataguard 搭建 oracle_sid不同 2節點 primary+standbyOracle
- win10怎麼改賬戶名稱 如何更改windows10賬戶名字Win10Windows