溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

Oracle怎么修改數(shù)據(jù)庫(kù)名稱(chēng)

發(fā)布時(shí)間:2021-08-31 18:34:48 來(lái)源:億速云 閱讀:148 作者:chen 欄目:關(guān)系型數(shù)據(jù)庫(kù)

這篇文章主要講解了“Oracle怎么修改數(shù)據(jù)庫(kù)名稱(chēng)”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“Oracle怎么修改數(shù)據(jù)庫(kù)名稱(chēng)”吧!

1.關(guān)閉監(jiān)聽(tīng),正常關(guān)閉Oracle

 [oracle@node3 ~]$ lsnrctl stop

 LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-FEB-2019 09:35:04

 Copyright (c) 1991, 2013, Oracle.  All rights reserved.

 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

 The command completed successfully

 

 SQL> shutdown immediate

 Database closed.

 Database dismounted.

 ORACLE instance shut down.

2.重啟數(shù)據(jù)庫(kù)到mount狀態(tài)

 SQL> startup mount force

 ORACLE instance started.

 

 Total System Global Area 2.1379E+10 bytes

 Fixed Size                  2262656 bytes

 Variable Size            2.0401E+10 bytes

 Database Buffers          939524096 bytes

 Redo Buffers               36073472 bytes

 Database mounted.

3.nid修改數(shù)據(jù)庫(kù)名稱(chēng)

 nid target=sys/xxx dbname=BDDEV1 logfile=nid_0219.log

 

 查看日志文件:

 [oracle@node3 ~]$ more nid_0219.log 

 

 DBNEWID: Release 11.2.0.4.0 - Production on Tue Feb 19 09:33:15 2019

 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 Connected to database BDDEV2 (DBID=2430401913)

 Connected to server version 11.2.0

 Control Files in database:

     /opt/app/oracle/oradata/BDDEV1/control01.ctl

     /opt/app/oracle/fast_recovery_area/BDDEV1/control02.ctl

 Changing database ID from 2430401913 to 2391707803

 Changing database name from BDDEV2 to BDDEV1

     Control File /opt/app/oracle/oradata/BDDEV1/control01.ctl - modified

     Control File /opt/app/oracle/fast_recovery_area/BDDEV1/control02.ctl - modified

     Datafile /opt/app/oracle/oradata/BDDEV1/system01.db - dbid changed, wrote new name

     Datafile /opt/app/oracle/oradata/BDDEV1/sysaux01.db - dbid changed, wrote new name

     Datafile /opt/app/oracle/oradata/BDDEV1/undotbs01.db - dbid changed, wrote new name

     Datafile /opt/app/oracle/oradata/BDDEV1/users01.db - dbid changed, wrote new name

     Datafile /opt/app/oracle/oradata/BDDEV1/tbs_soe.db - dbid changed, wrote new name

     Datafile /opt/app/oracle/oradata/BDDEV1/temp01.db - dbid changed, wrote new name

     Control File /opt/app/oracle/oradata/BDDEV1/control01.ctl - dbid changed, wrote new name

     Control File /opt/app/oracle/fast_recovery_area/BDDEV1/control02.ctl - dbid changed, wrote new name

     Instance shut down

 Database name changed to BDDEV1.

 Modify parameter file and generate a new password file before restarting.

 Database ID for database BDDEV1 changed to 2391707803.

 All previous backups and archived redo logs for this database are unusable.

 Database is not aware of previous backups and archived logs in Recovery Area.

 Database has been shutdown, open database with RESETLOGS option.

 Succesfully changed database name and ID.

 DBNEWID - Completed succesfully.

 如果日志文件中有報(bào)錯(cuò)信息,比如:NID-00135: There are 1 active threads,則可能是因?yàn)闆](méi)有正常關(guān)閉數(shù)據(jù)庫(kù)導(dǎo)致的。

4.修改參數(shù)文件中db_name后,啟動(dòng)Oracle

 SQL> startup nomount

 ORACLE instance started.

 Total System Global Area 1185853440 bytes

 Fixed Size                  2252664 bytes

 Variable Size             436207752 bytes

 Database Buffers          738197504 bytes

 Redo Buffers                9195520 bytes

 SQL> alter system set db_name=BDDEV1 scope=spfile;

 System altered.

 SQL> shutdown immediate

 ORA-01507: database not mounted

 ORACLE instance shut down.

 SQL> startup mount

 ORACLE instance started.

 

 Total System Global Area 1185853440 bytes

 Fixed Size                  2252664 bytes

 Variable Size             436207752 bytes

 Database Buffers          738197504 bytes

 Redo Buffers                9195520 bytes

 Database mounted.

 resetlogs方式打開(kāi)數(shù)據(jù)庫(kù):

 SQL> alter database open resetlogs;

 Database altered.

5.打開(kāi)監(jiān)聽(tīng)

 lsnrctl start

感謝各位的閱讀,以上就是“Oracle怎么修改數(shù)據(jù)庫(kù)名稱(chēng)”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)Oracle怎么修改數(shù)據(jù)庫(kù)名稱(chēng)這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI