问题
I have restored database with the name DB to another database called DB01
it is in STARTED status (not mounted) and it seems I can not change the name if it is not mounts, and I can not mount it because of the name, how to solve this issue if possible?
I have RMAN full backup from DB on my current server which hosting the database DB01 the initdb01.ora is ready and configured with DB01
what can I do next
nid did not help! it asks for the database to be mounted! which i can not mount it
ORA-01103: database name 'DB' in control file is not 'DB01'
回答1:
So here set db_name as DB, start restore once database opened, you can change database name using nid utility.
SQL > ALTER SYSTEM SET DB_NAME=DB SCOPE=spfile;
Please refer the link: Changing oracle db name in 10G
回答2:
You need to recreate the controlfile. The best approach is to first execute the following command in the original databasr:
alter database backup controlfile to trace;
This creates a textfile in the trace directory. You need to change the file path to match the new database file locations and also change the db_name parameter.
Once the previous step has been completed start the new database in nomount and execute above file (BE SURE YOU ARE CONNECTED TO THE NEW DATABASE AND ALL THE FILE PATH POINT TO THE NEW DATABASE). This will create a new controlfile.
回答3:
If you are restoring to a different box, then you can temporarily use the name of the original database to mount the restored database. You can then mount the restored database and use the tools available with a mounted database.
Change the
ORACLE_SID
to the original database nameRename the spfile to contain the original database name
Use this to change the name in the spfile.
ALTER SYSTEM SET DB_NAME=ORIGINAL_DBNAME SCOPE=spfile;
This will not work on the box with the original database running, as you cannot have two databases with the same name running on the same box.
回答4:
See Oracle support Doc ID 1906009.1.
You need to recreate the controlfile from a backup, then modify it to use REUSE with the SET DATABASE option, and with RESETLOGS. Use
alter database backup controlfile to trace;
Then find the relevant tracefile with the create controlfile command in it. Modify the SQL to include the recommended options. I just did this, here's my example:
CREATE CONTROLFILE REUSE set DATABASE "ANDYSTBY" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'+LOGS/ANDYSTBY/ONLINELOG/group_1.258.917112951',
'+LOGS/ANDYSTBY/ONLINELOG/group_1.259.917113325'
) SIZE 50M BLOCKSIZE 512,
GROUP 2 (
'+LOGS/ANDYSTBY/ONLINELOG/group_2.257.917112935',
'+LOGS/ANDYSTBY/ONLINELOG/group_2.260.917113339'
) SIZE 50M BLOCKSIZE 512,
GROUP 3 (
'+LOGS/ANDYSTBY/ONLINELOG/group_3.256.917112925',
'+LOGS/ANDYSTBY/ONLINELOG/group_3.261.917113345'
) SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+DATA/ANDYSTBY/DATAFILE/system.257.917108631',
'+DATA/ANDYSTBY/DATAFILE/sysaux.256.917108485',
'+DATA/ANDYSTBY/DATAFILE/undotbs1.259.917108757',
'+DATA/ANDYSTBY/DATAFILE/users.258.917108757'
CHARACTER SET AL32UTF8;
After restoring the database you will need to use the "using backup controlfile" option for recovery.
recover database until cancel using backup controlfile;
来源:https://stackoverflow.com/questions/11446666/change-database-name-controlfiles-after-restore