Friday, 15 June 2012

USER MANAGED DATABASE CLONING




================
USER MANAGED
================
##Steps to create a database CLONENING in window environment for 10g


1) Create required directories
E:\oracle\product\10.2.0\admin\VINY1011

adump
bdump
cdmp
dpdump
udump
pfile

2) Create datafile/Archive detination
E:\vinyd1011
E:\Archive_viny1011

3) SQLPLUS
SET ORACLE_SID=ORCL1
ECHO %ORACLE_SID%
SQLPLUS /NOLOG
CONN / AS SYSDBA
SET LINE 32000 PAGESIZE 32000
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

##Go E:\oracle\product\10.2.0\admin\udump (location controlfile trace file copy code & write script n save db_cntrolfile.sql)

##COPY OLD TRACE FILE
CREATE CONTROLFILE REUSE DATABASE "ORCL1011" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 'E:\ORCLD1011\REDO01.LOG'  SIZE 50M,
  GROUP 2 'E:\ORCLD1011\REDO02.LOG'  SIZE 50M,
  GROUP 3 'E:\ORCLD1011\REDO03.LOG'  SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  'E:\ORCLD1011\SYSTEM01.DBF',
  'E:\ORCLD1011\UNDOTBS01.DBF',
  'E:\ORCLD1011\SYSAUX01.DBF',
  'E:\ORCLD1011\USR.DBF'
CHARACTER SET WE8MSWIN1252
;



##PASTE INTO NEW NOTEPAD FILE AND FEW CHANGES OF LOCATION SEE AND save (db_cntrolfile.sql in E:\ drive)

CREATE CONTROLFILE SET DATABASE "viny1011" RESETLOGS  ARCHIVELOG
   MAXLOGFILES 16
   MAXLOGMEMBERS 3
   MAXDATAFILES 100
   MAXINSTANCES 8
   MAXLOGHISTORY 292
LOGFILE
 GROUP 1 'E:\vinyd1011\REDO01.LOG'  SIZE 50M,
 GROUP 2 'E:\vinyd1011\REDO02.LOG'  SIZE 50M,
 GROUP 3 'E:\vinyd1011\REDO03.LOG'  SIZE 50M
-- STANDBY LOGFILE
DATAFILE
 'E:\vinyd1011\SYSTEM01.DBF',
 'E:\vinyd1011\UNDOTBS01.DBF',
 'E:\vinyd1011\SYSAUX01.DBF',
 'E:\vinyd1011\USR.DBF'
CHARACTER SET WE8MSWIN1252
;


4) conn / as sysdba
create pfile from spfile;

5) Shutdown immediate

Copy all datafiles for the detination without any control file and Paste new destination.

COPY OLD DESTINATION
E:\ORCLD1011
LOGFILE
 E:\ORCLD1011\REDO01.LOG
 E:\ORCLD1011\REDO02.LOG
 E:\ORCLD1011\REDO03.LOG
DATAFILE
 E:\ORCLD1011\SYSTEM01.DBF
 E:\ORCLD1011\UNDOTBS01.DBF
 E:\ORCLD1011\SYSAUX01.DBF
 E:\ORCLD1011\USR.DBF

PASTE NEW DESTINATION
E:\VINYD1011
LOGFILE
 E:\vinyd1011\REDO01.LOG
 E:\vinyd1011\REDO02.LOG
 E:\vinyd1011\REDO03.LOG
DATAFILE
 E:\vinyd1011\SYSTEM01.DBF
 E:\vinyd1011\UNDOTBS01.DBF
 E:\vinyd1011\SYSAUX01.DBF
 E:\vinyd1011\USR.DBF





6) Go there location old pfile like these
E:\oracle\product\10.2.0\db_1\database\INITorcl2.ORA

##OLD LOCATION PFILE
orcl2.__db_cache_size=117440512
orcl2.__java_pool_size=4194304
orcl2.__large_pool_size=4194304
orcl2.__shared_pool_size=75497472
orcl2.__streams_pool_size=0
*.audit_file_dest='E:\oracle\product\10.2.0\admin\orcl1011\adump'
*.background_dump_dest='E:\oracle\product\10.2.0\admin\orcl1011\bdump'
*.compatible='10.2.0.3.0'
*.control_files='E:\ORCLD1011\control01.ctl','E:\ORCLD1011\control02.ctl','E:\ORCLD1011\control03.ctl'
*.core_dump_dest='E:\oracle\product\10.2.0\admin\orcl1011\cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=8
*.db_name='orcl1011'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orcl2XDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=E:\Archive1011'
*.log_archive_format='ARC%S_%R.%T'
*.open_cursors=300
*.pga_aggregate_target=68157440
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=204472320
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='E:\oracle\product\10.2.0\admin\orcl1011\udump'


Copy old pfile code open new notepad file and paste into notepad n save pfile.
open Pfile changes few locations and db_name & save ( initviny1.ora )like
## NEW LOCATION FILE
orcl2.__db_cache_size=117440512
orcl2.__java_pool_size=4194304
orcl2.__large_pool_size=4194304
orcl2.__shared_pool_size=75497472
orcl2.__streams_pool_size=0
*.audit_file_dest='E:\oracle\product\10.2.0\admin\viny1011\adump'
*.background_dump_dest='E:\oracle\product\10.2.0\admin\viny1011\bdump'
*.compatible='10.2.0.3.0'
*.control_files='E:\vinyd1011\control01.ctl','E:\vinyd1011\control02.ctl','E:\vinyd1011\control03.ctl'
*.core_dump_dest='E:\oracle\product\10.2.0\admin\viny1011\cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=8
*.db_name='viny1011'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orcl2XDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=E:\Archive1011'
*.log_archive_format='ARC%S_%R.%T'
*.open_cursors=300
*.pga_aggregate_target=68157440
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=204472320
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='E:\oracle\product\10.2.0\admin\viny1011\udump'







7) oradim -new -sid viny1 -startupmode auto -initpwd oracle



8) startup nomount pfile='E:\oracle\product\10.2.0\db_1\database\initviny1.ora'



9) @ D:\db_controlfile.sql; //database is automatic in mount stage



10) alter database open resetlogs;



11) create spfile from pfile;



12) Create viny1011srv service & listener setting



13) shutwon immeidate



14) startup



15) set oracle_sid=viny1



16) sqlplus /nolog
conn / as sysdba
show user
shutdown immediate
startup



17) Create database control console service
emca -config all db
sid=viny1
sys=oracle
---
---
---
---
---


Script Complete login viny1011 database open normal mode n enjoy Have a great Day....Gud N8....?

No comments: