SHUTDOWN IMMEDIATE STARTUP MOUNT
SYSDBA権限を持つ有効なユーザー(TARGET)を指定してDBNEWIDユーティリティを起動します(パスワードの入力を求められます)。 % nid TARGET=SYS
DBIDの他にデータベース名を変更するには、コマンドラインでDBNAMEパラメータも指定します(パスワードの入力を求められます)。次の例は、データベース名をtest_dbに変更します。
% nid TARGET=SYS DBNAME=test_db
DBNEWIDユーティリティは、ファイルへの入出力を試行する前に、データ・ファイルと制御ファイルのヘッダーで妥当性チェックを実行します。妥当性チェックが正常に行われると、DBNEWIDでは、操作の確認を求め(ログ・ファイルを指定した場合は確認が求められません)、オフラインの通常のデータ・ファイルおよび読取り専用データ・ファイルを含む各データ・ファイルのDBIDを変更し(この例で示すように、DBNAMEが指定された場合は、DBNAMEも変更し)、データベースを停止し、その後、終了します。次に、この出力例を示します。
.
.
.
Connected to database PROD (DBID=86997811)
.
.
.
Control Files in database:
/oracle/TEST_DB/data/cf1.dbf
/oracle/TEST_DB/data/cf2.dbf
The following datafiles are offline clean:
/oracle/TEST_DB/data/tbs_61.dbf (23)
/oracle/TEST_DB/data/tbs_62.dbf (24)
/oracle/TEST_DB/data/temp3.dbf (3)
These files must be writable by this utility.
The following datafiles are read-only:
/oracle/TEST_DB/data/tbs_51.dbf (15)
/oracle/TEST_DB/data/tbs_52.dbf (16)
/oracle/TEST_DB/data/tbs_53.dbf (22)
These files must be writable by this utility.
Changing database ID from 86997811 to 1250654267
Changing database name from PROD to TEST_DB
Control File /oracle/TEST_DB/data/cf1.dbf - modified
Control File /oracle/TEST_DB/data/cf2.dbf - modified
Datafile /oracle/TEST_DB/data/tbs_01.dbf - dbid changed, wrote new name
Datafile /oracle/TEST_DB/data/tbs_ax1.dbf - dbid changed, wrote new name
Datafile /oracle/TEST_DB/data/tbs_02.dbf - dbid changed, wrote new name
Datafile /oracle/TEST_DB/data/tbs_11.dbf - dbid changed, wrote new name
Datafile /oracle/TEST_DB/data/tbs_12.dbf - dbid changed, wrote new name
Datafile /oracle/TEST_DB/data/temp1.dbf - dbid changed, wrote new name
Control File /oracle/TEST_DB/data/cf1.dbf - dbid changed, wrote new name
Control File /oracle/TEST_DB/data/cf2.dbf - dbid changed, wrote new name
Instance shut down
Database name changed to TEST_DB.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST_DB changed to 1250654267.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Successfully changed database name and ID.
DBNEWID - Completed successfully.
妥当性チェックが正常に行われなかった場合、次に示す出力例のようにDBNEWIDユーティリティが終了し、ターゲット・データベースは変更されません。データベースをオープンし、エラーを修正した後で、DBNEWIDユーティリティの操作を再開するか、またはDBIDを変更せずに継続してデータベースを使用することができます。
.
.
.
Connected to database PROD (DBID=86997811)
.
.
.
Control Files in database:
/oracle/TEST_DB/data/cf1.dbf
/oracle/TEST_DB/data/cf2.dbf
The following datafiles are offline clean:
/oracle/TEST_DB/data/tbs_61.dbf (23)
/oracle/TEST_DB/data/tbs_62.dbf (24)
/oracle/TEST_DB/data/temp3.dbf (3)
These files must be writable by this utility.
The following datafiles are read-only:
/oracle/TEST_DB/data/tbs_51.dbf (15)
/oracle/TEST_DB/data/tbs_52.dbf (16)
/oracle/TEST_DB/data/tbs_53.dbf (22)
These files must be writable by this utility.
The following datafiles are offline immediate:
/oracle/TEST_DB/data/tbs_71.dbf (25)
/oracle/TEST_DB/data/tbs_72.dbf (26)
NID-00122: Database should have no offline immediate datafiles
Change of database name failed during validation - database is intact.
DBNEWID - Completed with validation errors.
STARTUP MOUNT
RESETLOGSモードでデータベースをオープンし、通常の使用を再開します。次に例を示します。ALTER DATABASE OPEN RESETLOGS;
データベースの新しいバックアップを取ります。オンラインREDOログをリセットしたため、現行のデータベースでは古いバックアップとアーカイブ・ログは使用できません。



