Cloning a Windows Database

                               Cloning a Windows Database

1.cold backup database

2.Connect to the source database test via svrmgr or SQL*Plus using an account that has the  SYSDBA,     SYSOPER
   SQL> alter database backup controlfile to trace resetlogs;
   examples:
   on NT
  C:/> set ORACLE_SID=prodx1
  C:/> set ORACLE_HOME=e:/oracle/ora81741
  C:/> %ORACLE_HOME%/bin/sqlplus sys/change_on_install as sysdba
  SQL> alter database backup controlfile to trace resetlogs;

  trace file in user_dump_dest
  examples:e:/oracle/admin/prodx1/udump /
  Navigate to the directory selected above, identify the most recent .trc file and rename it to     recr_con.sql.
 
  C:/> move e:/oracle/admin/prodx1/udump/<trace_file> e:/oracle/admin/prodx1/udump/recr_con.sql 

3.Perform a "Clean" Shutdown of the new Database

   A clean shutdown is necessary in order to make sure all data files and control files are synchronized    with the most recent transactions.  The following command will give you a clean shutdown:
   SQL> shutdown immediate;

   You must connect as a user (i.e. SYS) who has privileges (i.e. SYSDBA) to shut down the database
   examples:
   On Windows Operating System:

   - Create administrative directories:
  % mkdir e:/oracle/admin/prodx2
  % mkdir e:/oracle/admin/prodx2/bdump
  % mkdir e:/oracle/admin/prodx2/udump
  % mkdir e:/oracle/admin/prodx2/cdump
  % mkdir e:/oracle/admin/prodx2/pfile

  - Create data file directory:
  % mkdir e:/oradata/prodx2

  - Copy Database Files
  C:> copy e:/oradata/prodx1/*.dbf    e:/oradata/prodx2/
  C:> copy e:/oradata/prodx1/*.log    e:/oradata/prodx2/
  C:> copy e:/oracle/admin/prodx1/pfile/initprodx1.ora    e:/oracle/admin/prodx2/pfile/initprodx2.ora
  C:> copy e:/oracle/admin/prodx1/udump/recr_con.sql    e:/oracle/admin/prodx2/udump/recr_con.sql
 

4. Modify the Parameter File for the Cloned Database

5  Modify the Trace Output Script File

   On Windows Operating System:
   e:/oracle/admin/prodx2/udump/recr_con.sql
   modified:
    STARTUP NOMOUNT PFILE=e:/oracle/admin/prodx2/pfile/initprodx2.ora
    CREATE CONTROLFILE SET DATABASE "prodx2" RESETLOGS NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 2
    MAXDATAFILES 96
    MAXINSTANCES 1
    MAXLOGHISTORY 226
    LOGFILE
    GROUP 1 'E:/ORADATA/prodx2/REDO01.LOG'  SIZE 10M,
    GROUP 2 'E:/ORADATA/prodx2/REDO02.LOG'  SIZE 10M
    DATAFILE
    'E:/ORADATA/prodx2/SYSTEM01.DBF',
    'E:/ORADATA/prodx2/RBS01.DBF',
    'E:/ORADATA/prodx2/TEMP01.DBF',
    'E:/ORADATA/prodx2/USERS01.DBF',
    'E:/ORADATA/prodx2/TOOLS01.DBF',
    'E:/ORADATA/prodx2/OCL_TEMP1.DBF',
    'E:/ORADATA/prodx2/OCL_APP.DBF',
    'E:/ORADATA/prodx2/OCL_APP_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_DEF.DBF',
    'E:/ORADATA/prodx2/OCL_DEF_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_GLIB.DBF',
    'E:/ORADATA/prodx2/OCL_GLIB_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_LI.DBF',
    'E:/ORADATA/prodx2/OCL_LI_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_DCMQ.DBF',
    'E:/ORADATA/prodx2/OCL_DCMQ_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_DCD.DBF',
    'E:/ORADATA/prodx2/OCL_DCD_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_RESP.DBF',
    'E:/ORADATA/prodx2/OCL_RESP_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_DISC.DBF',
    'E:/ORADATA/prodx2/OCL_DISC_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_VRV.DBF',
    'E:/ORADATA/prodx2/OCL_VRV_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_DES.DBF',
    'E:/ORADATA/prodx2/OCL_DES_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_LR.DBF',
    'E:/ORADATA/prodx2/OCL_LR_IDX.DBF',
    'E:/ORADATA/prodx2/OCL_TEST_DATA.DBF',
    'E:/ORADATA/prodx2/OCL_TEST_INDEX.DBF',
    'E:/ORADATA/prodx2/OCL_TEMP_DATA.DBF',
    'E:/ORADATA/prodx2/OCL_DISC_REP_DATA.DBF'
    CHARACTER SET WE8ISO8859P1 ;
    ALTER DATABASE OPEN RESETLOGS;


6 Create the Oracle Service for the New Database (Windows Operating System Only)
   Set the Oracle environment to the new database prodx2 in the Operating System. Define the following      environment variables:
   ORACLE_HOME Location of Oracle Software
   ORACLE_SID  SID for the new database prodx2 (to be created)

Example:

   C:/> set ORACLE_SID=prodx2
   C:/> set ORACLE_HOME=e:/oracle/ora81741

   Check whether the initialization parameter REMOTE_LOGIN_PASSWORDFILE in the initprodx2.ora file is set    to exclusive or shared. If it is set, then the original database prodx1 was using a password file. Use    the oradim command to create a new Oracle SID service for the new database prodx2 with a password file

   C:/> %ORACLE_HOME%/bin/oradim -new -sid prodx2 intpwd change_on_install -startmode auto -pfile         e:/oracle/admin/prodx2/pfile/initprodx2.ora

   This command creates the instance. The ultimate goal is to "attach" this instance to the database.
   The command above will create a password file in the %ORACLE_HOME%/database/pwdprodx2.ora with the     change_on_install as the password for the SYS account.

If the original database was not using a password file, then use the command:

   C:/> %ORACLE_HOME%/bin/oradim -new -sid prodx2 -startmode auto -pfile    e:/oracle/admin/prodx2/pfile/initprodx2.ora
 
7.Update Network Files and Restart the Listener

   Edit the listener.ora and tnsnames.ora files to mention the newly created instance prodx2.
   Stop and restart the listener.
   NOTE: The instance name is case sensitive. Make sure to match the instance name with the one in the    listener.ora, tnsnames.ora and oratab files.

8.Recreate the Control File, and Open the Database

    On Windows Operating System:

   Set the Oracle environment to the new database prodx2 in the Operating System. Define the following    environment variables:

   ORACLE_HOME Location of Oracle Software
   ORACLE_SID  SID for the new database prodx2 (to be created)

   Example:

   C:/> set ORACLE_SID=prodx2
   C:/> set ORACLE_HOME=e:/oracle/ora81741

   Connect to the target databases idle instance via svrmgr or SQL*Plus using an account that has the     SYSDBA, SYSOPER, or DBA role granted to it.

   Example:

   C:/> %ORACLE_HOME%/bin/sqlplus sys/change_on_install as sysdba

   Run the following command:

   SQL>  start e:/oracle/admin/prodx2/udump/recr_con.sql

   This script will do the following:
 

       Re-create the database control file
 
       Reset the online log sequence
 
       Mount and open the database


this is ok!

 

 


 

 

 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值