在RAC中用NID修改資料庫名稱
在rac中修改db_name的步驟與單例項步驟差不多,主要是要修改一些與cluster相關的引數。
停止所有例項,然後把其中一個例項啟動到mount狀態下:
SQL> startup mount
ORACLE instance started.
Total System Global Area 1476395008 bytes
Fixed Size 2030200 bytes
Variable Size 268436872 bytes
Database Buffers 1191182336 bytes
Redo Buffers 14745600 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
嘗試用NID修改資料庫名稱:
bash-3.00$ nid target=sys/testrac dbname=pretrade logfile=~/nid1.log
檢視日誌:
bash-3.00$ more nid1.log
DBNEWID: Release 10.2.0.3.0 - Production on 星期四 9月 27 23:00:44 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database TRADEDB (DBID=4181457554)
NID-00120: Database should be mounted exclusively
Change of database name failed during validation - database is intact.
DBNEWID - Completed with validation errors.
發現有報錯,這個因為當前資料庫是rac,需要修改cluster_database=false,這也就是用nid修改rac資料庫名稱與修改單例項資料庫名稱的一個主要區別。
接著修改引數繼續嘗試:
bash-3.00$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期四 9月 27 23:01:09 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> alter system set cluster_database=false scope=spfile;
System altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1476395008 bytes
Fixed Size 2030200 bytes
Variable Size 268436872 bytes
Database Buffers 1191182336 bytes
Redo Buffers 14745600 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
bash-3.00$ nid target=sys/testrac dbname=pretrade logfile=~/nid2.log
bash-3.00$ vi nid2.log
DBNEWID: Release 10.2.0.3.0 - Production on 320307306332313304 9324302 27 23:03:24 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database TRADEDB (DBID=4181457554)
Connected to server version 10.2.0
Control Files in database:
+DATA/controlfile/control1
+DATA/controlfile/control2
+DATA/controlfile/control3
Changing database ID from 4181457554 to 3201410814
Changing database name from TRADEDB to PRETRADE
Control File +DATA/controlfile/control1 - modified
Control File +DATA/controlfile/control2 - modified
Control File +DATA/controlfile/control3 - modified
Datafile +DATA/datafile/system1.ora - dbid changed, wrote new name
Datafile +DATA/datafile/undotbs11.ora - dbid changed, wrote new name
......
Datafile +DATA/datafile/sysaux2.ora - dbid changed, wrote new name
Datafile +DATA/datafile/gpo1.ora - dbid changed, wrote new name
Datafile +DATA/datafile/gpo2.ora - dbid changed, wrote new name
Datafile +DATA/datafile/temp01.ora - dbid changed, wrote new name
Control File +DATA/controlfile/control1 - dbid changed, wrote new name
Control File +DATA/controlfile/control2 - dbid changed, wrote new name
Control File +DATA/controlfile/control3 - dbid changed, wrote new name
Instance shut down
Database name changed to PRETRADE.
Modify parameter file and generate a new password file before restarting.
Database ID for database PRETRADE changed to 3201410814.
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.
從日誌可以看到,資料庫名稱修改成功。
重新把cluster_database設定為true,並把db_name引數修改為新的名稱:
bash-3.00$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期四 9月 27 23:04:19 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1476395008 bytes
Fixed Size 2030200 bytes
Variable Size 268436872 bytes
Database Buffers 1191182336 bytes
Redo Buffers 14745600 bytes
ORA-01103: database name 'PRETRADE' in control file is not 'TRADEDB'
SQL> alter system set db_name=pretrade scope=spfile;
System altered.
SQL> alter system set cluster_database=true scope=spfile;
System altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1476395008 bytes
Fixed Size 2030200 bytes
Variable Size 268436872 bytes
Database Buffers 1191182336 bytes
Redo Buffers 14745600 bytes
Database mounted.
最後在開啟的時候open resetlogs即可。
SQL> alter database open resetlogs;
把rac環境的其他節點也啟動,至此,dbname修改完成。
如果nid修改時報錯:
ID-00135: There are 1 active threads
則表示有活動程式,可能原因是:
1、上次資料庫不是乾淨關閉的
2、有其他人在操作這個資料庫
最簡單的辦法是停止監聽,然後把資料庫乾淨關閉再做操作。
停止所有例項,然後把其中一個例項啟動到mount狀態下:
SQL> startup mount
ORACLE instance started.
Total System Global Area 1476395008 bytes
Fixed Size 2030200 bytes
Variable Size 268436872 bytes
Database Buffers 1191182336 bytes
Redo Buffers 14745600 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
嘗試用NID修改資料庫名稱:
bash-3.00$ nid target=sys/testrac dbname=pretrade logfile=~/nid1.log
檢視日誌:
bash-3.00$ more nid1.log
DBNEWID: Release 10.2.0.3.0 - Production on 星期四 9月 27 23:00:44 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database TRADEDB (DBID=4181457554)
NID-00120: Database should be mounted exclusively
Change of database name failed during validation - database is intact.
DBNEWID - Completed with validation errors.
發現有報錯,這個因為當前資料庫是rac,需要修改cluster_database=false,這也就是用nid修改rac資料庫名稱與修改單例項資料庫名稱的一個主要區別。
接著修改引數繼續嘗試:
bash-3.00$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期四 9月 27 23:01:09 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> alter system set cluster_database=false scope=spfile;
System altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1476395008 bytes
Fixed Size 2030200 bytes
Variable Size 268436872 bytes
Database Buffers 1191182336 bytes
Redo Buffers 14745600 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
bash-3.00$ nid target=sys/testrac dbname=pretrade logfile=~/nid2.log
bash-3.00$ vi nid2.log
DBNEWID: Release 10.2.0.3.0 - Production on 320307306332313304 9324302 27 23:03:24 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database TRADEDB (DBID=4181457554)
Connected to server version 10.2.0
Control Files in database:
+DATA/controlfile/control1
+DATA/controlfile/control2
+DATA/controlfile/control3
Changing database ID from 4181457554 to 3201410814
Changing database name from TRADEDB to PRETRADE
Control File +DATA/controlfile/control1 - modified
Control File +DATA/controlfile/control2 - modified
Control File +DATA/controlfile/control3 - modified
Datafile +DATA/datafile/system1.ora - dbid changed, wrote new name
Datafile +DATA/datafile/undotbs11.ora - dbid changed, wrote new name
......
Datafile +DATA/datafile/sysaux2.ora - dbid changed, wrote new name
Datafile +DATA/datafile/gpo1.ora - dbid changed, wrote new name
Datafile +DATA/datafile/gpo2.ora - dbid changed, wrote new name
Datafile +DATA/datafile/temp01.ora - dbid changed, wrote new name
Control File +DATA/controlfile/control1 - dbid changed, wrote new name
Control File +DATA/controlfile/control2 - dbid changed, wrote new name
Control File +DATA/controlfile/control3 - dbid changed, wrote new name
Instance shut down
Database name changed to PRETRADE.
Modify parameter file and generate a new password file before restarting.
Database ID for database PRETRADE changed to 3201410814.
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.
從日誌可以看到,資料庫名稱修改成功。
重新把cluster_database設定為true,並把db_name引數修改為新的名稱:
bash-3.00$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期四 9月 27 23:04:19 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1476395008 bytes
Fixed Size 2030200 bytes
Variable Size 268436872 bytes
Database Buffers 1191182336 bytes
Redo Buffers 14745600 bytes
ORA-01103: database name 'PRETRADE' in control file is not 'TRADEDB'
SQL> alter system set db_name=pretrade scope=spfile;
System altered.
SQL> alter system set cluster_database=true scope=spfile;
System altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1476395008 bytes
Fixed Size 2030200 bytes
Variable Size 268436872 bytes
Database Buffers 1191182336 bytes
Redo Buffers 14745600 bytes
Database mounted.
最後在開啟的時候open resetlogs即可。
SQL> alter database open resetlogs;
把rac環境的其他節點也啟動,至此,dbname修改完成。
如果nid修改時報錯:
ID-00135: There are 1 active threads
則表示有活動程式,可能原因是:
1、上次資料庫不是乾淨關閉的
2、有其他人在操作這個資料庫
最簡單的辦法是停止監聽,然後把資料庫乾淨關閉再做操作。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/231499/viewspace-63860/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- nid修改資料庫名稱資料庫
- 用NID修改資料庫名稱資料庫
- 使用NID修改Oracle資料庫名Oracle資料庫
- 如何修改MySQL資料庫名稱MySql資料庫
- ***批次修改資料夾名稱
- 【RAC】如何修改SCAN IP的IP地址、名稱、埠等資訊
- 修改git遠端倉庫分支名稱Git
- Oracle rac使用nid和dbms_backup_restore包修改dbid和dbnameOracleREST
- oracle nid修改dbnameOracle
- Postgresql10資料庫之更改資料庫的名稱SQL資料庫
- 資料庫 校驗名稱唯一性,用於新增和修改功能資料庫
- [20201112]nid改變資料庫名字.txt資料庫
- 2.6.2 確定全域性資料庫名稱資料庫
- Git修改檔名稱Git
- Python中修改資料夾名稱的方法是什麼?Python
- 在Linux中使用mmv命令批量修改檔名稱Linux
- sqlserver修改例項名稱SQLServer
- ubuntu修改主機名稱Ubuntu
- 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資料庫密碼
- 網站上怎麼修改公司名稱?網站
- 網站上修改公司名稱的方法網站
- 帝國cms網站名稱修改不成功,如何在帝國CMS中成功修改網站名稱網站