Cloning a Windows Database

xiaoxiao2021-03-06  118

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 / 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.sql4. 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: / OR Adata / prodx2 / ocl_dcmq.dbf ',' E: /ORADATA/PrODBF ',' 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/prodx2/oCl_test_data/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 stocking environment variables: Oracle_home location of oracle software oracle_sid sid for the new database prodx2 (to be create)

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 . landab files.8.recreate the control file, Andokeen 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 Grand 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!

转载请注明原文地址:https://www.9cbs.com/read-125743.html

New Post(0)