2008-05-14

cloning host with oracle database 9.2, 10.2

scenario:
host was cloned to VMware.
oracle version 9.2.0.6
windows server 2003

it was also repeated with
oracle database 10.2.03
windows server 2003 SP1

task:
rename database, instance and listener on new host
old db name: dcsdrp01
new db name: dcsdrt01
solution:
1. change tnsnames.ora for existing database (or u might connect to real production if u use tns)
2. add new database in tnsnames.ora
3. change listener.ora if u need listener (it has wrong host name)
4. create proper directories under d:\oracle\admin (depends on name convention and directory structure)
5. prepare new init.ora, default location for init.ora in windows is $ORACLE_HOME\database
6. prepare script to recreate control file.
use alter database backup controlfile to trace; and look in udump directory.
7. shutdown new database
8. configure listener.ora for new database
9. create password file for new database
orapwd file=D:\oracle\ora92\database\PWDDCSDRT01.ora password=password entries=10
10.  create windows service and START it! (you can not login to idle instance without it!)
oradim -new -sid DCSDRT01 -intpwd password -startmode a -pfile D:\oracle\admin\DCSDRT01\pfile\init.ora
11.  make sure original database (dcsdrp01) is down
12.  rename directories according to new init.ora file.
13.  delete current control files
14.  set ORACLE_SID=dcsdrt01
15.  sqlplus "/ as sysdba"
16.  startup nomount
17.  select * from v$instance;
18.  @new_controlfile.sql
19. alter database open resetlogs;
20. alter database rename global_name to dcsdrt01;
21. alter system switch logfile;
22. check connectivity thru listener
connect sys/password@dcsdrt01 as sysdba;
alter user system identified by password;
connect system/password@dcsdrt01
23. delete windows service of old instance
oradim -delete -sid dcsdrp01
24. disable or delete windows service of old listener
sc delete OracleOUIHome_dcsdrc2TNSListenerlistener_9i_dcsdrp01