Scripts:dbms_backup_restore_dbid
eg:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @dbid
Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.
Total System Global Area 2.0176E+10 bytes
Fixed Size 2237048 bytes
Variable Size 2483031432 bytes
Database Buffers 1.7650E+10 bytes
Redo Buffers 41488384 bytes
Database mounted.
Database opened.
PL/SQL procedure successfully completed.
OLD_NAME
--------------------------------------------------------------------------------
LOUIS
Enter the new Database Name:louisliu
Enter the new Database ID:100
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Convert LOUIS(1153888553) to louisliu(100)
PL/SQL procedure successfully completed.
ControlFile:
=> Change Name:1
=> Change DBID:1
DataFile: /data/oracle/oradata/louis/system01.dbf
=> Skipped:0
=> Change Name:1
=> Change DBID:1
DataFile: /data/oracle/oradata/louis/sysaux01.dbf
=> Skipped:0
=> Change Name:1
=> Change DBID:1
DataFile: /data/oracle/oradata/louis/undotbs01.dbf
=> Skipped:0
=> Change Name:1
=> Change DBID:1
DataFile: /data/oracle/oradata/louis/users01.dbf
=> Skipped:0
=> Change Name:1
=> Change DBID:1
DataFile: /data/oracle/oradata/louis/temp01.dbf
=> Skipped:0
=> Change Name:1
=> Change DBID:1
PL/SQL procedure successfully completed.
[oracle@db-2-16 dbs]$ cat initlouis.ora | sed "s/db_name='louis'/db_name='louisliu'/" > initlouisliu.ora
[oracle@db-2-16 dbs]$ export ORACLE_SID=louisliu
[oracle@db-2-16 dbs]$ ora si
SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 5 00:17:20 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 2.0176E+10 bytes
Fixed Size 2237048 bytes
Variable Size 2483031432 bytes
Database Buffers 1.7650E+10 bytes
Redo Buffers 41488384 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database openresetlogs;
alter database openresetlogs
*
ERROR at line 1:
ORA-02231: missing or invalid option to ALTER DATABASE
SQL> alter database open resetlogs;
Database altered.
SQL> select dbid ,name from v$database;
DBID NAME
---------- ---------------------------
100 louisliu
SQL> alter system switch logfile;
System altered.
It’s very usefull!