There are some PROBLEMS WITH 10g CLONE see optional steps
Source Database: HRPRD
Target Database: HRTEST
Step 1.
Log in to sql*plus:
c:\oracle>set ORACLE_SID=HRPRD
c:\oracle>sqlplus / as sysdba
Step 2.
Issue Command to backup control file to trace.
SQL>alter database backup controlfile to trace;
Step 3.
Shutdown the database
SQL>shutdown immediate;
Step4.
Navigate to the location of your .trc files. Sort by date and copy the most current out somewhere to be edited. Then cut out the following section and save it as createnewdb.sql:
STARTUP
NOMOUNTCREATE
CONTROLFILE REUSE DATABASE "OLDLSQ" NORESETLOGS
NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 240
MAXINSTANCES 1
MAXLOGHISTORY 113
LOGFILEGROUP 1 ('/u03/oradata/oldlsq/log1a.dbf','/u03/oradata/olslsq/log1b.dbf') SIZE 30M,GROUP 2 ('/u04/oradata/oldlsq/log2a.dbf','/u04/oradata/oldlsq/log2b.dbf') SIZE 30MDATAFILE'/u01/oradata/oldlsq/system01.dbf','/u01/oradata/oldlsq/mydatabase.dbf';
# Recovery is required if any of the datafiles are restored
# backups, or if the last shutdown was not normal or immediate.
RECOVER DATABASE# Database can now be opened normally.
ALTER DATABASE OPEN;
Step5.
Modify lines from the "createnewdb.sql" we just created:
Remove the lines following the characterset lines including:
# Recovery is required if any of the datafiles are restored
# backups, or if the last shutdown was not normal or immediate.
RECOVER DATABASE# Database can now be opened normally.
ALTER DATABASE OPEN;
Step6.
Do a global replace on the old Database name "HRPRD" with "HRDEV" (without quotes-lol) within the createnewdb.sql file. Also change the following like to read
before changes:
CREATE CONTROLFILE REUSE DATABASE "HRPRD" NORESETLOGS
after changes:
CREATE CONTROLFILE SET DATABASE "HRDEV" RESETLOGS
note: The instructions I've read everywhere say that you choose the "NORESETLOGS" option when using the "SET" operator. In 10g it explicitly tells me that in order to change the database name you have to use the "RESETLOGS" Option.
Disclaimer: I'm no know it all. I do what works :)
Step7.
On your Destination machine(HRDEV). Create a shell database (using your new DB name "HRDEV") using the Database configuration assistant.
Step8.
Copy all of the datafiles from the source machine to the target machine (yes the clone is on a separate box)using the "windows copy" option or "cp" for UNIX. Put the files in the same location as where you got them on the Production box. Or if you want them in a different location change the createnewdb.sql we just created.
Step9.
log in to the HRDEV machine as sys
c:\>set ORACLE_SID=HRDEV
c:\>sqlplus / as sysdba
Connected to an idle instance
SQL>@c:\createnewdb.sql
SQL>Alter database open;
YOU'RE GOOD TO GO!!
Step10.
I got an error the first time I did this because I copied over the control files. It can't recreate the control files if they are there already. So move them out then run the script again.
Problems with my new clone:
Enterprise Manager on clone corrupt or not in Sync
RMAN Backup problems.
Optional Steps.
(some people don't need a GUI interface but with all the new tools in OEM you'll want to fix this)
- Enterprise manager gives me an error saying invalid password for sys. It also says my database is down. It makes sense since it's pointing to the old shell database. I'm sure there are other solutions to fix this but this is what I did.
- If using an RMAN backup repository and backing up all database you will have problems due to the clone having the same DBID as the production database.
To fix both problems:
to issue a new DBID (database Id) run:
c:\>nid TARGET=sys/password@HRDEV
Follow the prompts, supplying the sys password, etc
To change the enterprise manager issue I had to drop and recreate the console.
To drop old Database console
- c:\> emca -deconfig dbcontrol db
To recreateDatabase console
- c:\> emca -config dbcontrol db
Enjoy!
--Jdog
-Let me know of your comments. I Don't know everything.
reference material:
DBA Tips on Cloning
No comments:
Post a Comment