利用DBNEWID工具來修改DBNAME
利用DBNEWID工具來修改dbid和dbname,也可以只修改dbname
我們先看下dbnewid的幫助
C:\Documents and Settings\paulyi>nid help=y
DBNEWID: Release 9.2.0.8.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. 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
實驗一:修改dbid和dbname
以下是操作步驟 首先資料庫要處於mount狀態,下面將資料庫名TEST9I改為TEST,並且dbid也同時修改
C:\Documents and Settings\paulyi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.8.0 - Production on 星期五 4月 24 09:40:02 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
連線到:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select dbid,name from v$database;
DBID NAME
---------- ---------
2422073917 TEST9I
SQL> select global_name from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
TEST9I.HNISI.COM.CN
SQL> shutdown immediate;
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup mount
ORACLE 例程已經啟動。
Total System Global Area 135339604 bytes
Fixed Size 454228 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
資料庫裝載完畢。
SQL> host
Microsoft Windows XP [版本 5.1.2600]
(C) 版權所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\paulyi>nid target=/ dbname=test
DBNEWID: Release 9.2.0.8.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
Connected to database TEST9I (DBID=2422073917)
Control Files in database:
D:\ORACLE\ORADATA\TEST\CONTROL01.CTL
D:\ORACLE\ORADATA\TEST\CONTROL02.CTL
D:\ORACLE\ORADATA\TEST\CONTROL03.CTL
Change database ID and database name TEST9I to TEST? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 2422073917 to 1983160527
Changing database name from TEST9I to TEST
Control File D:\ORACLE\ORADATA\TEST\CONTROL01.CTL - modified
Control File D:\ORACLE\ORADATA\TEST\CONTROL02.CTL - modified
Control File D:\ORACLE\ORADATA\TEST\CONTROL03.CTL - modified
Datafile D:\ORACLE\ORADATA\TEST\SYSTEM01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\TEST\UNDOTBS01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\TEST\EXAMPLE01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\TEST\INDX01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\TEST\TOOLS01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\TEST\USERS01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\TEST\TEMP01.DBF - dbid changed, wrote new name
Control File D:\ORACLE\ORADATA\TEST\CONTROL01.CTL - dbid changed, wrote new
name
Control File D:\ORACLE\ORADATA\TEST\CONTROL02.CTL - dbid changed, wrote new
name
Control File D:\ORACLE\ORADATA\TEST\CONTROL03.CTL - dbid changed, wrote new
name
Database name changed to TEST.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST changed to 1983160527.
All previous backups and archived redo logs for this database are unusable.
Shut down database and open with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
修改db_name引數需要把資料庫關閉再啟動到nomount才可以修改
C:\Documents and Settings\paulyi>exit
SQL> alter system set db_name='test' scope=spfile;
alter system set db_name='test' scope=spfile
*
ERROR 位於第 1 行:
ORA-32017: failure in updating SPFILE
ORA-32016: parameter "db_name" cannot be updated in SPFILE
SQL> exit
從Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production中斷開
要重新建立密碼檔案,要不然會報ORA-01991錯誤 --注意這個密碼檔案是按SID來命名的
C:\Documents and Settings\paulyi>orapwd file=d:\oracle\ora92\database\PWDtest9i.OR
A password=abcdefg entries=10
C:\Documents and Settings\paulyi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.8.0 - Production on 星期五 4月 24 09:43:32 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
連線到:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> shutdown immediate
ORA-01109: 資料庫未開啟
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup nomount
ORACLE 例程已經啟動。
Total System Global Area 135339604 bytes
Fixed Size 454228 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
SQL> alter system set db_name='test' scope=spfile;
系統已更改。
SQL> shutdown immediate;
ORA-01507: ??????
ORACLE 例程已經關閉。
SQL> startup mount;
ORACLE 例程已經啟動。
Total System Global Area 135339604 bytes
Fixed Size 454228 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
資料庫裝載完畢。
用open resetlogs 選項開啟資料庫
SQL> alter database open resetlogs;
資料庫已更改。
下面看到dbid和dbname已經更改成功
SQL> select dbid,name from v$database;
DBID NAME
---------- ---------
1983160527 TEST
SQL> alter database rename global_name to TEST.HNISI.COM.CN
2 ;
資料庫已更改。
SQL>
SQL> select global_name from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
TEST.HNISI.COM.CN
實驗二:只修改dbname 將TEST9I改為TEST,不需要用open resetlogs方式開啟,因為沒有修改dbid
以下是操作步驟 首先資料庫要處於mount狀態,下面將資料庫名TEST9I改為TEST,並且dbid不修改
C:\Documents and Settings\paulyi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.8.0 - Production on 星期五 4月 24 10:10:42 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
連線到:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> select dbid,name from v$database;
DBID NAME
---------- ---------
1983160527 TEST9I
SQL> shutdown immediate;
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup mount
ORACLE 例程已經啟動。
Total System Global Area 135339604 bytes
Fixed Size 454228 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
資料庫裝載完畢。
SQL> host
Microsoft Windows XP [版本 5.1.2600]
(C) 版權所有 1985-2001 Microsoft Corp.
nid引數加上setname=y 選項
C:\Documents and Settings\paulyi>nid target=/ dbname=test setname=y
DBNEWID: Release 9.2.0.8.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
Connected to database TEST9I (DBID=1983160527)
Control Files in database:
D:\ORACLE\ORADATA\TEST\CONTROL01.CTL
D:\ORACLE\ORADATA\TEST\CONTROL02.CTL
D:\ORACLE\ORADATA\TEST\CONTROL03.CTL
Change database name of database TEST9I to TEST? (Y/[N]) => Y
Proceeding with operation
Changing database name from TEST9I to TEST
Control File D:\ORACLE\ORADATA\TEST\CONTROL01.CTL - modified
Control File D:\ORACLE\ORADATA\TEST\CONTROL02.CTL - modified
Control File D:\ORACLE\ORADATA\TEST\CONTROL03.CTL - modified
Datafile D:\ORACLE\ORADATA\TEST\SYSTEM01.DBF - wrote new name
Datafile D:\ORACLE\ORADATA\TEST\UNDOTBS01.DBF - wrote new name
Datafile D:\ORACLE\ORADATA\TEST\EXAMPLE01.DBF - wrote new name
Datafile D:\ORACLE\ORADATA\TEST\INDX01.DBF - wrote new name
Datafile D:\ORACLE\ORADATA\TEST\TOOLS01.DBF - wrote new name
Datafile D:\ORACLE\ORADATA\TEST\USERS01.DBF - wrote new name
Datafile D:\ORACLE\ORADATA\TEST\TEMP01.DBF - wrote new name
Control File D:\ORACLE\ORADATA\TEST\CONTROL01.CTL - wrote new name
Control File D:\ORACLE\ORADATA\TEST\CONTROL02.CTL - wrote new name
Control File D:\ORACLE\ORADATA\TEST\CONTROL03.CTL - wrote new name
Database name changed to TEST.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
C:\Documents and Settings\paulyi>orapwd file=D:\oracle\ora92\DATABASE\PWDtest.OR
A password=abcdefg entries=10
C:\Documents and Settings\paulyi>exit
SQL> shutdown immediate;
ORA-01109: 資料庫未開啟
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup nomount
ORACLE 例程已經啟動。
Total System Global Area 135339604 bytes
Fixed Size 454228 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
SQL> alter system set db_name='test' scope=spfile;
系統已更改。
SQL> shutdown immediate
ORA-01507: ??????
ORACLE 例程已經關閉。
SQL> startup;
ORACLE 例程已經啟動。
Total System Global Area 135339604 bytes
Fixed Size 454228 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
資料庫裝載完畢。
資料庫已經開啟。
修改成功,只修改dbname,沒修改dbid
SQL> select dbid,name from v$database;
DBID NAME
---------- ---------
1983160527 TEST
SQL> show parameter db_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string test
SQL> alter database rename global_name to TEST.HNISI.COM.CN;
資料庫已更改。
SQL> select global_name from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
TEST.HNISI.COM.CN
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-591684/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DBNEWID工具使用二:更改DBNAME
- oracle nid修改dbnameOracle
- Oracle工具——DBNEWIDOracle
- oracle 修改dbid和dbnameOracle
- 11g DBNEWID工具修改DBID碰到的問題
- dbnewid修改dbid和庫名
- 手工修改Oracle資料庫DBNAME-轉載Oracle資料庫
- 10G DBNEWID工具的增強
- DBNEWID Utility
- 利用nid工具修改db_name時hang住
- DBNEWID 筆記筆記
- Oracle rac使用nid和dbms_backup_restore包修改dbid和dbnameOracleREST
- 如何利用現代工具來管理多專案
- 利用nid工具修改db_name和instance_name
- 記一次通過DBNEWID工具修改DBID時的NID-00135: There are 1 active threads錯誤thread
- DBNEWID的用法----NID命令
- oracle 11g 更改sid和dbnameOracle
- 11g Oracle DBNEWID的改進Oracle
- 利用 xrandr 命令修改螢幕解析度
- 利用 ant 指令碼修改專案包名指令碼
- 利用 alter 語句修改欄位屬性
- Google Chrome 開發者工具漏洞利用GoChrome
- 漏洞利用查詢工具sandi
- 【譯】利用.LESS來提高CSSCSS
- Selenium RemoteWebDriver 利用CDP修改User-AgentREMWeb
- 利用DNS Zone Transfers漏洞工具dnswalkDNS
- 修改BeEF工具預設密碼密碼
- 利用Python快速批量修改資料集檔名Python
- Metasploit profiling工具的利用
- 利用fiddler工具,mock介面資料Mock
- 利用yum工具下載RPM包
- 利用HFS工具進行檔案共享
- 網路資料修改工具netsed
- xrandr: 命令列修改解析度工具命令列
- 使用者組修改工具samusrgrp
- 利用 Sequelize 來運算元據庫
- 利用static來實現單例模式單例模式
- 利用 iCloud Drive 來同步 Xcode 配置CloudXCode