在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 NID工具修改資料庫DBID和資料庫名稱Oracle資料庫
- NID修改資料庫名稱時候碰到NID-00137資料庫
- 使用NID修改Oracle資料庫名Oracle資料庫
- 修改資料庫名稱資料庫
- 如何修改MySQL資料庫名稱MySql資料庫
- [轉] 使用NID 修改資料庫名(Oracle9或以上)資料庫Oracle
- 二、修改資料庫全域性名稱資料庫
- nid 改變資料庫名,DBID資料庫
- Oracle 11g修改資料庫使用者名稱Oracle資料庫
- RAC資料庫中用opatch應用補丁資料庫
- Oracle 11g支援修改資料庫使用者名稱Oracle資料庫
- 關於修改資料庫名稱和ID的方法總結資料庫
- C#取資料庫名稱與資料庫中表名的方法C#資料庫
- SQL Server還原資料庫,修改還原後的物理檔名稱SQLServer資料庫
- 如何修改資料庫例項及資料庫名資料庫
- ORACLE資料庫修改資料庫名db_nameOracle資料庫
- 修改git遠端倉庫分支名稱Git
- Postgresql10資料庫之更改資料庫的名稱SQL資料庫
- 在本地修改預設啟動的資料庫例項名資料庫
- 【RAC】如何修改SCAN IP的IP地址、名稱、埠等資訊
- Git修改檔名稱Git
- 2.6.2 確定全域性資料庫名稱資料庫
- oracle nid修改dbnameOracle
- 修改Xcode工程名稱XCode
- 修改wifi名稱與地址WiFi
- 查詢當前資料庫名、使用者名稱、資料庫伺服器IP、埠、資料庫版本資訊。資料庫伺服器
- Python中修改資料夾名稱的方法是什麼?Python
- Fedora網路介面名稱如何修改?Fedora修改網路介面名稱的方法
- 在Linux中使用mmv命令批量修改檔名稱Linux
- 關於資料庫登陸名和資料庫使用者名稱的一點點心得資料庫
- win10修改使用者名稱資料夾方法 win10怎麼改使用者資料夾名稱Win10
- 將rac資料庫改為單機資料庫需要修改的引數資料庫
- 在.net中用資料工廠實現多資料庫的操作方案資料庫
- 請問有在Jive中用oracle作資料庫的嗎?Oracle資料庫
- 請教。在ejb中用DataSource連線資料庫,報錯!資料庫