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. 查看更改前的相應(yīng)名稱 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數(shù)據(jù)庫 SQL> shutdown immediate 數(shù)據(jù)庫已經(jīng)關(guān)閉。 已經(jīng)卸載數(shù)據(jù)庫。 ORACLE 例程已經(jīng)關(guān)閉。 3. --nid需要在mount狀態(tài)下才能做。因為要更改控制文件的信息 SQL> startup mount ORACLE 例程已經(jīng)啟動。 Total System Global Area 612368384 bytes Fixed Size 1250428 bytes Variable Size 180358020 bytes Database Buffers 423624704 bytes Redo Buffers 7135232 bytes 數(shù)據(jù)庫裝載完畢。
nid是操作系統(tǒng)的命令,所以要用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. 已連接數(shù)據(jù)庫 ORCL (DBID=1224293825) 已連接服務(wù)器版本 10.2.0 數(shù)據(jù)庫中的控制文件數(shù): 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 是否將數(shù)據(jù)庫 ID 和數(shù)據(jù)庫名 ORCL 更改為 DBORCL? (Y/[N]) => y 操作繼續(xù)進行 將數(shù)據(jù)庫 ID 從 1224293825 更改為 3277448932 將數(shù)據(jù)庫名從 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 - 已修改 數(shù)據(jù)文件 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF - dbid 已更改, 已寫入新名稱 數(shù)據(jù)文件 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF - dbid 已更改, 已寫入新名稱 數(shù)據(jù)文件 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF - dbid 已更改, 已寫入新名稱 數(shù)據(jù)文件 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF - dbid 已更改, 已 寫入新名稱 數(shù)據(jù)文件 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF - dbid 已更改, 已寫入新名稱 數(shù)據(jù)文件 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 已更改, 已寫入新名稱 實例關(guān)閉 數(shù)據(jù)庫名已更改為 DBORCL。 修改參數(shù)文件并在重新啟動前生成新的口令文件。 數(shù)據(jù)庫 DBORCL 的數(shù)據(jù)庫 ID 已更改為 3277448932。 此數(shù)據(jù)庫的所有以前的備份和歸檔重做日志均不可用。 數(shù)據(jù)庫無法識別恢復(fù)區(qū)中以前的備份和歸檔日志。 數(shù)據(jù)庫已關(guān)閉, 用 RESETLOGS 選項打開數(shù)據(jù)庫。 已成功更改數(shù)據(jù)庫名和 ID。 DBNEWID - 已成功完成。 5. ---shutdown數(shù)據(jù)庫 SQL> shutdown immediate ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist
SQL> startup nomount ORACLE 例程已經(jīng)啟動。 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.檢查服務(wù)名 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))) 命令執(zhí)行成功 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. 已使用的參數(shù)文件: 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
--重啟監(jiān)聽 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))) 命令執(zhí)行成功
---在測試 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. 已使用的參數(shù)文件: D:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora