Rename db_name for Oracle
DBNEWID Utility
Prior to the introduction of the DBNEWID utility alteration of the internal DBID of an instance was impossible and alteration of the DBNAME required the creation of a new controlfile. The DBNEWID utility allows the DBID to be altered for the first time and makes changing the DBNAME simpler. Changing the DBID is necessary when you want to use an RMAN catalog to backup a cloned instance. RMAN identifies instances using the DBID, preventing the original and cloned instance being managed by the same catalog. Alteration of the BID in the cloned instance removes this restriction.
[@more@]DBID And DBNAME
- Backup the database.
- Mount the database after a clean shutdown:
SHUTDOWN IMMEDIATE STARTUP MOUNT
- Invoke the DBNEWID utility (nid) specifying the new DBNAME from the command line using a user with SYSDBA privilege:
Assuming the validation is successful the utility prompts for confirmation before performing the actions. Typical output may look something like:nid TARGET=sys/password@TSH1 DBNAME=TSH2
C:oracle920bin>nid TARGET=sys/password@TSH1 DBNAME=TSH2 DBNEWID: Release 9.2.0.3.0 - Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. Connected to database TSH1 (DBID=1024166118) Control Files in database: C:ORACLEORADATATSH1CONTROL01.CTL C:ORACLEORADATATSH1CONTROL02.CTL C:ORACLEORADATATSH1CONTROL03.CTL Change database ID and database name TSH1 to TSH2? (Y/[N]) => Y Proceeding with operation Changing database ID from 1024166118 to 1317278975 Changing database name from TSH1 to TSH2 Control File C:ORACLEORADATATSH1CONTROL01.CTL - modified Control File C:ORACLEORADATATSH1CONTROL02.CTL - modified Control File C:ORACLEORADATATSH1CONTROL03.CTL - modified Datafile C:ORACLEORADATATSH1SYSTEM01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1UNDOTBS01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1CWMLITE01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1DRSYS01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1EXAMPLE01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1INDX01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1ODM01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1TOOLS01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1USERS01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1XDB01.DBF - dbid changed, wrote new name Datafile C:ORACLEORADATATSH1TEMP01.DBF - dbid changed, wrote new name Control File C:ORACLEORADATATSH1CONTROL01.CTL - dbid changed, wrote new name Control File C:ORACLEORADATATSH1CONTROL02.CTL - dbid changed, wrote new name Control File C:ORACLEORADATATSH1CONTROL03.CTL - dbid changed, wrote new name Database name changed to TSH2. Modify parameter file and generate a new password file before restarting. Database ID for database TSH2 changed to 1317278975. 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.
- Shutdown the database:
SHUTDOWN IMMEDIATE
- Modify the DB_NAME parameter in the initialization parameter file. The startup will result in an error but proceed anyway.
- Create a new password file:
orapwd file=c:oracle920databasepwdTSH2.ora password=password entries=10
- Rename the SPFILE to match the new DBNAME.
- If you are using Windows you must recreate the service so the correct name and parameter file are used:
If you are using UNIX/Linux simply reset the ORACLE_SID environment variable:oradim -delete -sid TSH1 oradim -new -sid TSH2 -intpwd password -startmode a -pfile c:oracle920databasespfileTSH2.ora
ORACLE_SID=TSH2; export ORACLE_SID
- Alter the listener.ora and tnsnames.ora setting to match the new database name and restart the listener:
lsnrctl reload
- Open the database with RESETLOGS:
STARTUP MOUNT ALTER DATABASE OPEN RESETLOGS;
- Backup the database.
STARTUP MOUNT ALTER SYSTEM SET DB_NAME=TSH2 SCOPE=SPFILE; SHUTDOWN IMMEDIATE
DBNAME Only
Repeat the process as before except use the following command to start the DBNEWID utility:The SETNAME parameter tells the DBNEWID utility to only alter the database name.nid TARGET=sys/password@TSH2 DBNAME=TSH3 SETNAME=YES
When opening the database the RESETLOGS option is not needed so the database can be started using the
STARTUP
command.DBID Only
- Backup the database.
- Mount the database after a clean shutdown:
SHUTDOWN IMMEDIATE STARTUP MOUNT
- Invoke the DBNEWID utility (nid) from the command line using a user with SYSDBA privilege. Do not specify a new DBNAME:
nid TARGET=sys/password@TSH3
- Shutdown and open the database with RESETLOGS:
SHUTDOWN IMMEDIATE STARTUP MOUNT ALTER DATABASE OPEN RESETLOGS;
- Backup the database.
轉自:
參考:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/789833/viewspace-1043757/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 線上rename資料檔案Oracle
- Rename or Move a datafile In Oracle 19c RAC-20220117Oracle
- Oracle修改instance_name、db_name、db_unique_name、service_namesOracle
- MySQL rename table方法大全MySql
- 2.6.2.1 初始化引數DB_NAME
- os.walk、os.rename
- ERROR: failed to establish dependency between database db_name and diskgroupErrorAIDatabase
- Linux rename命令批量修改檔名Linux
- Linux常用基本命令(rename,basename,dirname)Linux
- [20231025]跟蹤rename操作2.txt
- Redis原始碼系列之rename講解Redis原始碼
- HFR:在RBF上實現跨NameSpace Renamenamespace
- CREATE CONTROLFILE修改DB_NAME一定不能使用REUSE
- A Better Finder Rename 11 Mac(批次重新命名工具)Mac
- 19c環境bbed安裝及db_name檢視
- The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'DatabaseAST
- 叢集修改OCR中記錄的db_unique_name以及db_name
- [20231020]rename IDL_UB1$後使用bbed的恢復.txt
- 批次重新命名軟體:A Better Finder Rename mac中文版Mac
- 重新命名工具 Bulk Rename Utility v4.0.0.0 中文版
- A Better Finder Rename 12 for Mac(蘋果電腦批次重新命名工具)Mac蘋果
- [20231019]rename IDL_UB1$的恢復測試前準備.txt
- 批次重新命名工具 A Better Finder Rename 12啟用碼最新版
- A Better Finder Rename 蘋果電腦 最強大的批次重新命名工具蘋果
- 03-Java框架FTPClient 使用rename()移動檔案和檔案重新命名Java框架FTPclient
- [20231103]rename IDL_UB1$後使用bbed的恢復的後遺症.txt
- 強大的批次重新命名工具:A Better Finder Rename 12 for Mac v12.02啟用版Mac
- A Better Finder Rename 11 for Mac(強大的批次重新命名工具) v11.27中文直裝版Mac
- ORACLE基礎之oracle鎖(oracle lock mode)詳解Oracle
- [Oracle]Oracle良性SQL建議OracleSQL
- cx_Oracle 連線 OracleOracle
- 【Oracle】Oracle logminer功能介紹Oracle
- OracleOracle
- Oracle案例12——NBU Oracle恢復Oracle
- Oracle vs PostgreSQL DBA(21)- Oracle VPDOracleSQL
- 「Oracle」Oracle 資料庫安裝Oracle資料庫
- [Oracle] -- 配置Oracle環境變數Oracle變數
- Oracle案例13—— OGG-01163 Oracle GoldenGate Delivery for Oracle, reprpt01.prmOracleGo
- 4.1.6 Oracle Restart 與 Oracle Data Guard 整合OracleREST