用NID修改資料庫名稱
NID是9iR2開始推出的一個命令列工具,它用來修改DB_NAME,DBID。你可以用此工具只修改DB_NAME或者DBID,也可以同時修改這兩個東西。
NID的語法如下:
[oracle@standby admin]$ nid -help
DBNEWID: Release 10.2.0.3.0 - Production on Sat Jun 16 01:04:56 2007
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 --Y表示同時修改DB_NAME和DBID,N表示只修改DB_NAME,預設是N
APPEND Append to output log NO
HELP Displays these messages NO
下面以一個例子來說明其用法:
1、首先把資料庫啟動到mount狀態下
[oracle@standby oradata]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on Sat Jun 16 00:22:27 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1207959552 bytes
Fixed Size 2072320 bytes
Variable Size 352321792 bytes
Database Buffers 838860800 bytes
Redo Buffers 14704640 bytes
Database mounted.
SQL>
2、使用nid命令修改db_name
[oracle@standby oradata]$ nid target=sys/systembak dbname=uplot logfile=~/nid.log
修改日誌如下:
[oracle@standby oradata]$ more ~/nid.log
DBNEWID: Release 10.2.0.3.0 - Production on Sat Jun 16 00:28:50 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database ID5 (DBID=836265559)
Connected to server version 10.2.0
Control Files in database:
/opt/oracle/oradata/id5/control01.ctl
/opt/oracle/oradata/id5/control02.ctl
/opt/oracle/oradata/id5/control03.ctl
Changing database ID from 836265559 to 2052204354
Changing database name from ID5 to UPLOT
Control File /opt/oracle/oradata/id5/control01.ctl - modified
Control File /opt/oracle/oradata/id5/control02.ctl - modified
Control File /opt/oracle/oradata/id5/control03.ctl - modified
Datafile /opt/oracle/oradata/id5/system01.dbf - dbid changed, wrote new name
Datafile /opt/oracle/oradata/id5/undotbs01.dbf - dbid changed, wrote new name
Datafile /opt/oracle/oradata/id5/sysaux01.dbf - dbid changed, wrote new name
Datafile /opt/oracle/oradata/id5/users01.dbf - dbid changed, wrote new name
Datafile /opt/oracle/oradata/id5/temp01.dbf - dbid changed, wrote new name
Control File /opt/oracle/oradata/id5/control01.ctl - dbid changed, wrote new name
Control File /opt/oracle/oradata/id5/control02.ctl - dbid changed, wrote new name
Control File /opt/oracle/oradata/id5/control03.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to UPLOT.
Modify parameter file and generate a new password file before restarting.
Database ID for database UPLOT changed to 2052204354.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
3、重建密碼檔案
[oracle@standby oradata]$ orapwd file=/opt/oracle/product/10g/dbs/orapwduplot password=systembak entries=10
4、修改引數檔案的db_name為新資料庫名稱,並用新引數檔案啟動
[oracle@standby oradata]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on Sat Jun 16 00:34:37 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup pfile='/opt/oracle/product/10g/dbs/inituplot.ora'
ORACLE instance started.
Total System Global Area 1207959552 bytes
Fixed Size 2072320 bytes
Variable Size 352321792 bytes
Database Buffers 838860800 bytes
Redo Buffers 14704640 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
--修改DBID必須要resetlogs
SQL> alter database open resetlogs;
Database altered.
--檢查修改成果
SQL> select dbid, name, open_mode, activation#, created from v$database;
DBID NAME OPEN_MODE ACTIVATION# CREATED
---------- ------------------ -------------------- ----------- ------------
2052204354 UPLOT READ WRITE 2052221623 14-JUN-07
--重建spfile
SQL> create spfile from pfile='/opt/oracle/product/10g/dbs/inituplot.ora';
File created.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1207959552 bytes
Fixed Size 2072320 bytes
Variable Size 352321792 bytes
Database Buffers 838860800 bytes
Redo Buffers 14704640 bytes
Database mounted.
Database opened.
此時,大功告成。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/231499/viewspace-63818/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- nid修改資料庫名稱資料庫
- 在RAC中用NID修改資料庫名稱資料庫
- 使用NID修改Oracle資料庫名Oracle資料庫
- 如何修改MySQL資料庫名稱MySql資料庫
- ***批次修改資料夾名稱
- 資料庫 校驗名稱唯一性,用於新增和修改功能資料庫
- 修改git遠端倉庫分支名稱Git
- oracle nid修改dbnameOracle
- Postgresql10資料庫之更改資料庫的名稱SQL資料庫
- [20201112]nid改變資料庫名字.txt資料庫
- 2.6.2 確定全域性資料庫名稱資料庫
- Git修改檔名稱Git
- Python中修改資料夾名稱的方法是什麼?Python
- sqlserver修改例項名稱SQLServer
- ubuntu修改主機名稱Ubuntu
- Android動態修改應用圖示和名稱Android
- Fedora網路介面名稱如何修改?Fedora修改網路介面名稱的方法
- win10修改使用者名稱資料夾方法 win10怎麼改使用者資料夾名稱Win10
- git修改檔案的名稱Git
- WPS 修改新建office 檔名稱
- CentOS 8 修改網路卡名稱CentOS
- win10怎麼更改使用者名稱資料夾_win10如何修改suers使用者名稱資料夾Win10
- [20200407]nid修改DBID還原.txt
- 安全快速修改Mysql資料庫名的5種方法MySql資料庫
- 實驗課程名稱:資料庫系統概論資料庫
- 如何檢視字型詳細資訊,修改字型名稱?
- react-native 修改專案名稱React
- github修改使用者名稱Github
- VS2017修改專案名稱
- kvm 修改虛擬機器名稱虛擬機
- 修改zabbix的web平臺名稱Web
- 使用mmv命令批次修改檔名稱
- mongodb對資料庫建立使用者名稱和密碼MongoDB資料庫密碼
- 實用!一鍵生成資料庫文件,堪稱資料庫界的Swagger資料庫Swagger
- 網站上怎麼修改公司名稱?網站
- 網站上修改公司名稱的方法網站
- 帝國cms網站名稱修改不成功,如何在帝國CMS中成功修改網站名稱網站
- 修改 Ubuntu 系統使用者名稱和登入名Ubuntu