Oracle Databaseユーティリティ 11g リリース1(11.1) E05768-02 |
|
DBNEWIDユーティリティは、オペレーショナル・データベースのDBIDおよびDBNAMEを変更できるデータベース・ユーティリティです。
この章の内容は、次のとおりです。
DBNEWIDユーティリティの導入以前は、データベースのコピーを手動で作成し、制御ファイルを再作成してデータベースに新しいデータベース名(DBNAME)を指定することができました。ただし、データベースに新しい識別子(DBID)を指定することはできません。DBIDは、データベース用の内部的な一意の識別子です。Recovery ManagerではDBIDによってデータベースが区別されるため、シード・データベースおよび手動でコピーされたデータベースは、同じRecovery Managerリポジトリに登録できません。DBNEWIDユーティリティを使用すると、次のいずれかを変更することによって、この問題を解決できます。
データベースのDBIDの変更は、重要な処理です。データベースのDBIDを変更すると、そのデータベースのすべての古いバックアップおよびアーカイブ・ログが使用できなくなります。これは、データがすでにデータ・ファイルに存在する以外は、データベースの作成と同様です。DBIDを変更すると、変更前に作成されたバックアップおよびアーカイブ・ログは使用できません。これは、バックアップやアーカイブ・ログにまだ元のDBIDがあるためです。元のDBIDは最新のDBIDとは一致しません。RESETLOGS
オプションを指定してデータベースをオープンする必要があります。これによって、オンラインREDOログが再作成され、この順序番号が1にリセットされます(詳細は、『Oracle Database管理者ガイド』を参照)。このため、DBIDの変更直後に、データベース全体のバックアップを取る必要があります。
DBIDを変更せずにDBNAMEを変更する場合は、RESETLOGS
オプションを指定してデータベースをオープンする必要がないため、データベースのバックアップおよびアーカイブ・ログは無効になりません。ただし、DBNAMEを変更すると、これらが無効になります。データベース名の変更後、新しい名前を反映させるにはDB_NAME
初期化パラメータを変更する必要があります。また、Oracleパスワード・ファイルの再作成が必要な場合もあります。制御ファイルの古い(データベース名を変更する前の)バックアップをリストアする場合、データベース名を変更する前の初期化パラメータ・ファイルおよびパスワード・ファイルを使用する必要があります。
分散データベース・システム内のデータベースを使用している場合、各データベースには一意のグローバル・データベース名が必要です。DBNEWIDユーティリティは、グローバル・データベース名を変更しません。グローバル・データベース名の変更は、SQLのALTER
DATABASE
文を使用してのみ行えます。構文は次のとおりです。
ALTER DATABASE RENAME GLOBAL_NAME TO newname.domain;
グローバル・データベース名は、データベース名およびドメインで構成されます。これらはデータベースが最初に作成されたときにDB_NAME
およびDB_DOMAIN
初期化パラメータによって指定されます。
次の例では、ドメインus
.oracle
.com
のデータベース名をsales
に変更します。
ALTER DATABASE RENAME GLOBAL_NAME TO sales.us.oracle.com
これは、DBNEWIDを使用してデータベース名の変更を完了した後に行います。
この項の内容は、次のとおりです。
この項では、データベースのDBIDを変更する方法について説明します。オプションで、データベース名も変更できます。
SHUTDOWN IMMEDIATE STARTUP MOUNT
SYSDBA
権限を持つ有効なユーザーを指定します。パスワードを入力するように要求されます。次に例を示します。
% nid TARGET=SYS DBNEWID: Release 11.1.0.6.0 - Production on Tue Aug 21 05:25:22 2007 Copyright (c) 1982, 2007, Oracle. All rights reserved. Password: password
DBIDに加えてデータベース名も変更するには、コマンドラインでDBNAME
パラメータも指定します。パスワードを入力するように要求されます。この例では、データベース名をtest_db
に変更します。
% nid TARGET=SYS DBNAME=test_db DBNEWID: Release 11.1.0.6.0 - Production on Tue Aug 21 05:35:18 2007 Copyright (c) 1982, 2007, Oracle. All rights reserved. Password: password
DBNEWIDユーティリティを使用して、データ・ファイルおよび制御ファイルへの入出力を試行する前に、これらのファイルのヘッダーで妥当性チェックを実行します。妥当性チェックが正常に行われると、操作の確認が求められ(ログ・ファイルを指定した場合、確認は求められません)、NORMALモードでオフラインにされたデータ・ファイルおよび読取り専用データ・ファイルを含む各データ・ファイルのDBIDが変更されます。この例のように指定した場合は、DBNAMEも変更されます。これらの処理の完了後、データベースが停止され、DBNEWIDユーティリティが終了します。次に、この出力例を示します。
. . . Connected to database PROD (DBID=86997811) . . . Control Files in database: /oracle/TEST_DB/data/cf1.f /oracle/TEST_DB/data/cf2.f The following datafiles are offline clean: /oracle/TEST_DB/data/tbs_61.f (23) /oracle/TEST_DB/data/tbs_62.f (24) /oracle/TEST_DB/data/temp3.f (3) These files must be writable by this utility. The following datafiles are read-only: /oracle/TEST_DB/data/tbs_51.f (15) /oracle/TEST_DB/data/tbs_52.f (16) /oracle/TEST_DB/data/tbs_53.f (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.f - modified Control File /oracle/TEST_DB/data/cf2.f - modified Datafile /oracle/TEST_DB/data/tbs_01.f - dbid changed, wrote new name Datafile /oracle/TEST_DB/data/tbs_ax1.f - dbid changed, wrote new name Datafile /oracle/TEST_DB/data/tbs_02.f - dbid changed, wrote new name Datafile /oracle/TEST_DB/data/tbs_11.f - dbid changed, wrote new name Datafile /oracle/TEST_DB/data/tbs_12.f - dbid changed, wrote new name Datafile /oracle/TEST_DB/data/temp1.f - dbid changed, wrote new name Control File /oracle/TEST_DB/data/cf1.f - dbid changed, wrote new name Control File /oracle/TEST_DB/data/cf2.f - 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.f /oracle/TEST_DB/data/cf2.f The following datafiles are offline clean: /oracle/TEST_DB/data/tbs_61.f (23) /oracle/TEST_DB/data/tbs_62.f (24) /oracle/TEST_DB/data/temp3.f (3) These files must be writable by this utility. The following datafiles are read-only: /oracle/TEST_DB/data/tbs_51.f (15) /oracle/TEST_DB/data/tbs_52.f (16) /oracle/TEST_DB/data/tbs_53.f (22) These files must be writable by this utility. The following datafiles are offline immediate: /oracle/TEST_DB/data/tbs_71.f (25) /oracle/TEST_DB/data/tbs_72.f (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ログをリセットしたため、現行のデータベースでは古いバックアップとアーカイブ・ログは使用できません。
データベース名を変更せずに、データベースIDを変更するには、「DBIDおよびデータベース名の変更」の手順に従ってください。ただし、手順3では、オプションのデータベース名(DBNAME)を指定しません。次に、データベースIDのみを変更した場合に生成される出力例を示します。
. . . Connected to database PROD (DBID=86997811) . . . Control Files in database: /oracle/TEST_DB/data/cf1.f /oracle/TEST_DB/data/cf2.f The following datafiles are offline clean: /oracle/TEST_DB/data/tbs_61.f (23) /oracle/TEST_DB/data/tbs_62.f (24) /oracle/TEST_DB/data/temp3.f (3) These files must be writable by this utility. The following datafiles are read-only: /oracle/TEST_DB/data/tbs_51.f (15) /oracle/TEST_DB/data/tbs_52.f (16) /oracle/TEST_DB/data/tbs_53.f (22) These files must be writable by this utility. Changing database ID from 86997811 to 4004383693 Control File /oracle/TEST_DB/data/cf1.f - modified Control File /oracle/TEST_DB/data/cf2.f - modified Datafile /oracle/TEST_DB/data/tbs_01.f - dbid changed Datafile /oracle/TEST_DB/data/tbs_ax1.f - dbid changed Datafile /oracle/TEST_DB/data/tbs_02.f - dbid changed Datafile /oracle/TEST_DB/data/tbs_11.f - dbid changed Datafile /oracle/TEST_DB/data/tbs_12.f - dbid changed Datafile /oracle/TEST_DB/data/temp1.f - dbid changed Control File /oracle/TEST_DB/data/cf1.f - dbid changed Control File /oracle/TEST_DB/data/cf2.f - dbid changed Instance shut down Database ID for database TEST_DB changed to 4004383693. All previous backups and archived redo logs for this database are unusable. Database has been shutdown, open database with RESETLOGS option. Succesfully changed database ID. DBNEWID - Completed succesfully.
この項では、DBIDを変更せずにデータベース名を変更する方法について説明します。
SHUTDOWN IMMEDIATE STARTUP MOUNT
SYSDBA
権限を持つ有効なユーザーを指定します(パスワードを入力するように要求されます)。DBNAME
パラメータとSETNAME
パラメータの両方を指定する必要があります。この例では、データベース名をtest_db
に変更します。
% nid TARGET=SYS DBNAME=test_db SETNAME=YES DBNEWID: Release 11.1.0.6.0 - Production on Tue Aug 21 05:40:21 2007 Copyright (c) 1982, 2007, Oracle. All rights reserved. Password: password
DBNEWIDユーティリティを使用して、データ・ファイルではなく制御ファイルへの入出力を試行する前に、ファイルのヘッダーで妥当性チェックを実行します。妥当性チェックが正常に行われると、操作の確認が求められ、制御ファイル内のデータベース名が変更されます。これらの処理の完了後、データベースが停止され、DBNEWIDユーティリティが終了します。次に、この出力例を示します。
. . . Control Files in database: /oracle/TEST_DB/data/cf1.f /oracle/TEST_DB/data/cf2.f The following datafiles are offline clean: /oracle/TEST_DB/data/tbs_61.f (23) /oracle/TEST_DB/data/tbs_62.f (24) /oracle/TEST_DB/data/temp3.f (3) These files must be writable by this utility. The following datafiles are read-only: /oracle/TEST_DB/data/tbs_51.f (15) /oracle/TEST_DB/data/tbs_52.f (16) /oracle/TEST_DB/data/tbs_53.f (22) These files must be writable by this utility. Changing database name from PROD to TEST_DB Control File /oracle/TEST_DB/data/cf1.f - modified Control File /oracle/TEST_DB/data/cf2.f - modified Datafile /oracle/TEST_DB/data/tbs_01.f - wrote new name Datafile /oracle/TEST_DB/data/tbs_ax1.f - wrote new name Datafile /oracle/TEST_DB/data/tbs_02.f - wrote new name Datafile /oracle/TEST_DB/data/tbs_11.f - wrote new name Datafile /oracle/TEST_DB/data/tbs_12.f - wrote new name Datafile /oracle/TEST_DB/data/temp1.f - wrote new name Control File /oracle/TEST_DB/data/cf1.f - wrote new name Control File /oracle/TEST_DB/data/cf2.f - wrote new name Instance shut down Database name changed to TEST_DB. Modify parameter file and generate a new password file before restarting. Successfully changed database name. DBNEWID - Completed successfully.
妥当性チェックが正常に行われなかった場合、DBNEWIDユーティリティは終了し、ターゲット・データベースは変更されません。データベースをオープンし、エラーを修正した後で、DBNEWIDユーティリティの操作を再開するか、またはデータベース名を変更せずに継続してデータベースを使用することができます。妥当性チェックが正常に行われなかった場合の出力例は、「DBIDおよびデータベース名の変更」の手順3を参照してください。
DB_NAME
初期化パラメータを新しいデータベース名に設定します。
STARTUP
データベースIDは変更せずに、データベース名のみを変更したため、データベースのオープン時にRESETLOGS
オプションを使用する必要はありません。これまでのすべてのバックアップは使用可能です。
DBNEWIDユーティリティによって妥当性チェックが正常に行われたが、要求された変更の実行中にエラーが検出された場合、DBNEWIDユーティリティは停止し、データベースは変更中のままになります。この場合、DBNEWIDユーティリティの操作を完了するか、または元に戻さないかぎり、データベースをオープンできません。DBNEWIDユーティリティによって操作の状態を示すメッセージが表示されます。
操作を続行するか元に戻す前に、エラーの原因を解決します。データベース全体を最新のバックアップからリストアして、DBNEWIDユーティリティの起動前の時点までリカバリを実行する以外に解決策がない場合もあります。そのため、DBNEWIDユーティリティの実行前に最新のバックアップを使用可能にしておくことが重要です。
変更を続行する場合は、元のコマンドを再実行します。DBNEWIDユーティリティが再開され、すべてのデータ・ファイルおよび制御ファイルに新しい値が指定されるまで変更操作が続行されます。この時点では、データベースは停止されます。RESETLOGS
オプションを使用してデータベースをオープンする前に、マウントする必要があります。
DBNEWIDユーティリティの操作を元に戻した場合、DBNEWIDユーティリティによって実行されたすべての変更が元に戻され、データベースはマウントされた状態のままになります。
DBNEWIDがリリース1(10.1)以上のOracle Databaseに対して実行された場合は、操作の要約がアラート・ファイルに記録されます。たとえば、データベース名およびデータベースIDの変更では、次のような内容が記録されます。
*** DBNEWID utility started *** DBID will be changed from 86997811 to new DBID of 1250452230 for database PROD DBNAME will be changed from PROD to new DBNAME of TEST_DB Starting datafile conversion Setting recovery target incarnation to 1 Datafile conversion complete 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 1250452230. All previous backups and archived redo logs for this database are unusable. Database has been shutdown, open with RESETLOGS option. Successfully changed database name and ID. *** DBNEWID utility finished successfully ***
データベース名だけの変更では、次のような内容がアラート・ファイルに記録されます。
*** DBNEWID utility started *** DBNAME will be changed from PROD to new DBNAME of TEST_DB Starting datafile conversion Datafile conversion complete Database name changed to TEST_DB. Modify parameter file and generate a new password file before restarting. Successfully changed database name. *** DBNEWID utility finished successfully *** In case of failure during DBNEWID the alert will also log the failure: *** DBNEWID utility started *** DBID will be changed from 86997811 to new DBID of 86966847 for database AV3 Change of database ID failed. Must finish change or REVERT changes before attempting any database operation. *** DBNEWID utility finished with errors ***
次の図に、DBNEWIDユーティリティの構文を示します。
表17-1に、DBNEWIDユーティリティの構文のパラメータを示します。
DBNEWIDユーティリティには次の制限事項があります。
NOPARALLEL
モードでマウントする必要があります。
RESETLOGS
オプションを使用してデータベースをオープンする必要があります。データベース名のみの変更後は、RESETLOGS
オプションを使用してオープンする必要はありません。
DBNEWIDユーティリティをリリース1(10.1)より前のOracle Databaseに対し実行する場合は、次の制限事項がさらに適用されます。
|
![]() Copyright © 2007 Oracle Corporation. All Rights Reserved. |
|