PROCEDURE NIDBEGIN
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
NEWDBNAME VARCHAR2 IN
OLDDBNAME VARCHAR2 IN
NEWDBID NUMBER IN
OLDDBID NUMBER IN
DOREVERT BINARY_INTEGER IN
DORESTART BINARY_INTEGER IN
EVENTS NUMBER IN
PROCEDURE NIDEND
PROCEDURE NIDGETNEWDBID
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
DBNAME VARCHAR2 IN
NDBID NUMBER OUT
PROCEDURE NIDPROCESSCF
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
CHGDBID BINARY_INTEGER OUT
CHGDBNAME BINARY_INTEGER OUT
顺便说一句,如果你遇到数据库DBMS_BACKUP_RESTORE不存在的情况:
[quote]SQL> DESC DBMS_BACKUP_RESTORE
ERROR:
ORA-04043: 对象 DBMS_BACKUP_RESTORE 不存在
可以通过运行 $ORACLE_HOME/rdbms/admin/dbmsbkrs.sql 来创建!
通过以上几个新增的SQL我们可以来修改数据库的DBID,以下是一个测试过程:
C:>sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期三 5月 21 22:10:17 2008
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> alter database open;
数据库已更改。
SQL> select dbid from v$database;
DBID
----------
1465764760
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string eygle
SQL> exec dbms_backup_restore.nidbegin('eygle','EYGLE','3935589514','1465764760',0,0,10)
PL/SQL 过程已成功完成。
SQL> select dbid from v$database;
DBID
----------
1465764760
SQL> variable a number;
SQL> variable b number
SQL> variable c number;
SQL> exec dbms_backup_restore.nidprocessdf(0,0,:a,:b,:c);
PL/SQL 过程已成功完成。
SQL> print :a
A
----------
0
SQL> print :b
B
----------
1
SQL> print :c
C
----------
1
SQL> exec dbms_backup_restore.nidprocesscf(:a,:b);
PL/SQL 过程已成功完成。
SQL> print :a
A
----------
1
SQL> print :b
B
----------
1
SQL> exec dbms_backup_restore.nidend;
PL/SQL 过程已成功完成。
SQL> select dbid from v$database;
DBID
----------
3935589514
此时修改完成,最好重启一次数据库,使得修改被确认。