I have a cold backup for my prod DB and now my boss asked me to create another DB called TEST on same server.
step1- I copied all datafiles, control files, redo log files to new disk location.
step2- edit initTEST.ora to reflect the path of new controlfiles,archive_log_dest, and DB_Name.
step3- oradim80 -new -sid test intpwd oracletest -startmode auto -pfile c:\initTEST.ora
step4- set oracle_sid=TEST, svrmgr30 and startup nomount pfile=c:\initTEST.ora;
(db nomount- OK)
step5 -alter database mount; - (error)
--> ora-01103: database name 'prod' in controlfile is not test
Upto step4 everything is fine no problem at all.The only problem over here is step5.I will tell why the error is coming up because the name of the database is recorded in the control files so you need to recreate the control files and how to go about doing this is first and the foremost thing is collect information about all the datafiles and redo log files the path of the files is very important and you need to recreate the control files this you need to do after step4
I will give you an example to create a control file over here but change the parameters according to ur environment
create controlfile set database "test" maxlogfiles 32
maxlogmembers 2 maxdatafiles 32 maxinstance 1 maxloghistory 1500 logfile
group 1 'c:\oracle\database\test\log1test.ora' size 200k,
group 2 'c:\oracle\database\test\log2test.ora' size 200k
....Path of the rest of the data files ;
Take extreme precaution when creating the control file dont miss out on any of the datafiles and also make sure you have the correct parameter set for control_files in the initialization files if you miss probably you will not be able to add them to the database.Once you execute the above command the command picks up the values of the from control_files and creates all the control file what you have specified in the initilization file
The Noresetlogs option specifies that the online redo log files should not be reset
That's it then now you should be able to mount and open the database
-- Script: clonedatabase.txt
-- Purpose: Outlines procedures for cloning a database
-- Copyright: (c) 2000 Howard Rogers
-- Author: Howard Rogers
-- Date: 2nd September 2000
-- This is a simple list of steps that will allow you to clone
-- a database on the same machine as the original database.
-- It then goes on to show how you can re-name the clone, and
-- thereby permit the original database, plus its clone, to be
-- up and running at the same time on the one machine.
-- Clearly, if you were cloning off onto another machine altogether,
-- you wouldn't particularly need to rename the database.
-- CLONING A DATABASE
--1. In the original database, run the 'Alter Database Backup Controlfile to trace' command
--2. Perform a clean shutdown of the original database
--3. Copy all files (ie, Control Files, Data Files and Redo Logs) to clone location
--4. Blow away the Control files in the clone location
-- Since you are going to delete the Control Files, you could skip copying them in the first place
-- However, especially on Unix, it might be easier to simply 'cp -R' and sort out the files afterwards!
--5. Edit the Control File trace script:
-- Add a PFILE statement to the startup line
-- Edit all the file locations so they point to clone locations
--6. Copy the init.ora from the original database, then edit it for the Clone.
-- Make sure you edit:
-- Control_Files= (point to new location)
-- Log_archive_dest (and variants) (make sure you aren't going to generate
-- files which might over-write real logs etc)
-- User_Dump_Dest and Background_Dump_dest (the clone's alert log etc shouldn't
-- be allowed to over-write the real ones)
--7. Start Server Manager
--8. Run the Trace File script
-- At this point, you make sure everything is working perfectly. Once you know it is, it is
-- time to consider re-naming the Instance and the Database (yes, that's two separate operations!)
--CHANGING THE INSTANCE NAME
--1. Export a new ORACLE_SID
-- In other words, it isn't hard to change the Instance name. Just have a new ORACLE_SID set
-- before trying to do a 'startup'.
--CHANGING THE DATABASE NAME
--1. Issue the 'Alter Database Backup Controlfile to Trace' command once again from the Clone
--2. Perform a clean Shutdown of the clone.
--3. Blow away all clone Control Files
--4. Edit Control File trace script:
-- Change the "Create Controlfile Reuse 'X' noresetlogs....." line to read
-- "Create Controlfile SET 'Y' Resetlogs.....
-- In other words, X is the old name, and Y is the new one. And you're going to have to do a
-- Resetlogs after this procedure.
--5. Change the line "Alter database open" to 'Alter Database Open Resetlogs"
--6. Edit the clone init.ora and change the db_name parameter to match the new database name
--7. Start Server Manager
--8. Run the Control File trace script
--9. Perform a clean shutdown and backup.
-- You must always do a complete, closed database backup after every resetlogs. Otherwise, you
-- have no baseline to fall back on, or to which you can apply Redo Logs to achieve recovery.