C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 10月 22 11:56:33 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
串連到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
1. 查看更改前的相應名稱
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string orcl
db_unique_name string orcl
global_names boolean FALSE
instance_name string orcl
lock_name_space string
log_file_name_convert string
service_names string orcl
2. --先shutdown資料庫
SQL> shutdown immediate
資料庫已經關閉。
已經卸載資料庫。
ORACLE 常式已經關閉。
3. --nid需要在mount狀態下才能做。因為要更改控制檔案的資訊
SQL> startup mount
ORACLE 常式已經啟動。
Total System Global Area 612368384 bytes
Fixed Size 1250428 bytes
Variable Size 180358020 bytes
Database Buffers 423624704 bytes
Redo Buffers 7135232 bytes
資料庫裝載完畢。
nid是作業系統的命令,所以要用host
SQL> host nid -help
DBNEWID: Release 10.2.0.1.0 - Production on Fri Oct 23 13:40:54 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Keyword Description (Default)
----------------------------------------------------
TARGET Username/Password (NONE)
DBNAME New database name (NONE)
LOGFILE Output Log (NONE)
REVERT Revert failed change NO
SETNAME Set a new database name only NO
APPEND Append to output log NO
HELP Displays these messages NO
以上是nid命令的文法
4。 --運行nid命令
SQL> host nid target=sys/aibo dbname=dborcl
DBNEWID: Release 10.2.0.1.0 - Production on 星期四 10月 22 11:58:27 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
已串連資料庫 ORCL (DBID=1224293825)
已串連伺服器版本 10.2.0
資料庫中的控制檔案數:
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CTL
是否將資料庫 ID 和資料庫名 ORCL 更改為 DBORCL? (Y/[N]) => y
操作繼續進行
將資料庫 ID 從 1224293825 更改為 3277448932
將資料庫名從 ORCL 更改為 DBORCL
控制檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL - 已修改
控制檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL - 已修改
控制檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CTL - 已修改
資料檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF - dbid 已更改,
已寫入新名稱
資料檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF - dbid 已更改,
已寫入新名稱
資料檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF - dbid 已更改,
已寫入新名稱
資料檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF - dbid 已更改, 已
寫入新名稱
資料檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF - dbid 已更改,
已寫入新名稱
資料檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP01.DBF - dbid 已更改, 已
寫入新名稱
控制檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL - dbid 已更改,
已寫入新名稱
控制檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL - dbid 已更改,
已寫入新名稱
控制檔案 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CTL - dbid 已更改,
已寫入新名稱
執行個體關閉
資料庫名已更改為 DBORCL。
修改參數檔案並在重新啟動前產生新的口令檔案。
資料庫 DBORCL 的資料庫 ID 已更改為 3277448932。
此資料庫的所有以前的備份和歸檔重做日誌均不可用。
資料庫無法識別恢複區中以前的備份和歸檔日誌。
資料庫已關閉, 用 RESETLOGS 選項開啟資料庫。
已成功更改資料庫名和 ID。
DBNEWID - 已成功完成。
5. ---shutdown資料庫
SQL> shutdown immediate
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
SQL> startup nomount
ORACLE 常式已經啟動。
Total System Global Area 612368384 bytes
Fixed Size 1250428 bytes
Variable Size 180358020 bytes
Database Buffers 423624704 bytes
Redo Buffers 7135232 bytes
C:\Documents and Settings\Administrator>set oracle_sid=dborcl
C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 10月 22 13:41:12 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
串連到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> quit
從 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 斷開
13.檢查服務名
C:\Documents and Settings\Administrator>lsnrctl reload
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 22-10月-2009 13:4
3:13
Copyright (c) 1991, 2005, Oracle. All rights reserved.
正在串連到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.56)(PORT=1521)))
命令執行成功
C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 10月 22 13:43:21 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
串連到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select open_mode from v$database;
OPEN_MODE
----------
READ WRITE
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
dborcl
SQL> show parameter name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string dborcl
db_unique_name string dborcl
global_names boolean FALSE
instance_name string dborcl
lock_name_space string
log_file_name_convert string
service_names string dborcl
SQL> quit
從 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 斷開
檢查service是否被更改
C:\Documents and Settings\Administrator>tnsping dborcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 22-10月-
2009 13:50:00
Copyright (c) 1997, 2005, Oracle. All rights reserved.
已使用的參數檔案:
D:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
已使用 EZCONNECT 適配器來解析別名
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=dborcl.gdgg.local
))(ADDRESS=(PROTOCOL=TCP)(HOST=202.106.195.30)(PORT=1521)))
^C
--重啟監聽
C:\Documents and Settings\Administrator>lsnrctl reload
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 22-10月-2009 13:5
0:46
Copyright (c) 1991, 2005, Oracle. All rights reserved.
正在串連到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.56)(PORT=1521)))
命令執行成功
---在測試
C:\Documents and Settings\Administrator>tnsping dborcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 22-10月-
2009 13:52:18
Copyright (c) 1997, 2005, Oracle. All rights reserved.
已使用的參數檔案:
D:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora