manual clone of oracle 11i database

4
Oracle application training Mr Prasad . +91-9441235888 oracle application training Manual Clone of Oracle 11i Database Cloning an Oracle Application Release 11i database to a Seperate UNIX Machine Objective Cloning an Oracle Application Release 11i database to a Seperate UNIX Machine Steps to Clone 1. On the target box create the user who owns ORACLE_HOME files and database files (will be oracle for the purposes of this paper). Create an environment file for each of these users specifying the environment variables referenced in the Oracle Applications Release 11i for UNIX Installation Manual. Example of variables for the oracle user: LD_LIBRARY_PATH ORACLE_HOME ORACLE_SID TWO_TASK (if applicable) PATH TERM JRE_DIR 2. Make zip files of all the ORACLE_HOME files on the Source Box. 3. FTP the zipped files over to the Target Box 4. Unzip all files into the new $ORACLE_HOME locations. 5. Relink the ORACLE_HOME.Example of items to be relinked: cd $ORACLE_HOME/rdbms/lib; make -f ins_rdbms.mk install or cd $ORACLE_HOME/rdbms/lib relinkall Modify the listener.ora and tnsnames.ora files to reflect your new environment. These files should be found in the $ORACLE_HOME/network/admin directory. Copying a Database Moving a database from one location to another is conceptually very simple. However, you must be extremely careful or the migration will fail. The physical approach involves cloning the source database. This method is very similar to an offline backup of the database. The steps involved are:

Upload: prasad-v

Post on 19-Mar-2016

216 views

Category:

Documents


3 download

DESCRIPTION

Cloning an Oracle Application Release 11i database to a Seperate UNIX Machine

TRANSCRIPT

Page 1: Manual clone of oracle 11i database

Oracle application training

Mr Prasad . +91-9441235888 oracle application training

Manual Clone of Oracle 11i Database

Cloning an Oracle Application Release 11i database to a Seperate UNIX Machine Objective Cloning an Oracle Application Release 11i database to a Seperate UNIX Machine Steps to Clone 1. On the target box create the user who owns ORACLE_HOME files and database files (will be oracle for the purposes of this paper). Create an environment file for each of these users specifying the environment variables referenced in the Oracle Applications Release 11i for UNIX Installation Manual. Example of variables for the oracle user: LD_LIBRARY_PATH ORACLE_HOME ORACLE_SID TWO_TASK (if applicable) PATH TERM JRE_DIR 2. Make zip files of all the ORACLE_HOME files on the Source Box. 3. FTP the zipped files over to the Target Box 4. Unzip all files into the new $ORACLE_HOME locations. 5. Relink the ORACLE_HOME.Example of items to be relinked: cd $ORACLE_HOME/rdbms/lib; make -f ins_rdbms.mk install or cd $ORACLE_HOME/rdbms/lib relinkall Modify the listener.ora and tnsnames.ora files to reflect your new environment. These files should be found in the $ORACLE_HOME/network/admin directory. Copying a Database Moving a database from one location to another is conceptually very simple. However, you must be extremely careful or the migration will fail. The physical approach involves cloning the source database. This method is very similar to an offline backup of the database. The steps involved are:

Page 2: Manual clone of oracle 11i database

Oracle application training

Mr Prasad . +91-9441235888 oracle application training

• Backup the source database's control file to a trace file. • Make a list of all of your data and redo log files. • Perform a "clean" shutdown of the source database. • Copy all datafiles, redo log files, init.ora file, and trace file from the source location to the target location. • Edit the target init.ora file and trace file. • Start the target instance. • Recreate the control file, recover and open the database. Note: The following instructions assume you (1) already have the server installed for the target location, (2) all parameters are already set for the target environment, 1. Backup the source database's control file to a trace file. Connect to the source database via SQL*Plus using an account that has the SYSDBA or DBA role granted to it. Run the following command: 2. SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE; 3. This will create a text file that we'll use later. This file will be written to the subdirectory designated by the value of the USER_DUMP_DEST parameter. 4. Make a list of all datafiles and redo log files. It is absolutely essential to know the names and locations of all datafiles and redo log files. To do this, issue the following queries: 5. SQL> SELECT file_name FROM dba_data_files; 6. SQL> SELECT member FROM v$logfile; 7. The first query will give the full path and file name for each of your datafiles. The second query will give the same information for all redo log files. Be sure to record this information for future reference. 8. Perform a "clean" shutdown of the source database.A clean shutdown is necessary in order to make sure all datafiles and control files are synchronized with the most recent transactions. The following commands will give you a clean shutdown: 9. shutdown immediate; 10. Copy all data files,redo log files,the init.ora file,and the trace file from the source location to the target location.Using the information collected in Step 2,copy all source datafiles and redo log files to the target location. Also copy your init.ora file and the trace file generated in Step 1 to the target location. 11. Edit the target init.ora file and the trace file. Using a text editor, revise the init.ora file to reflect the

Page 3: Manual clone of oracle 11i database

Oracle application training

Mr Prasad . +91-9441235888 oracle application training

new values for the target database. This will involve changing the paths indicated in parameters such as CONTROL_FILES, USER_DUMP_DEST, BACKGROUND_DUMP_DEST, and any other parameter that specifies a path/file location (see Attachment 1 below). Likewise, we must modify the trace file. This file contains the CREATE CONTROLFILE command that we will be using in Step 7. You will have to change the paths for all the datafiles and redo log files to reflect their new location (see Attachment 2 below). 12. Start the target instance.Once the init.ora file is edited, you can start the istance.However, since we don't have control files yet, you must use the following command: 13. startup nomount; 14. Recreate the control file.Once the instance is started, you can create your control files. If you saved your trace file as mytrace.trc, you can now create the control files by running this file as follows: 15. @mytrace.trc 16. This script will create the control files, perform a database recovery to resynchronize the control file with the rest of the database, and open the database. 17. Database can now be opened normally using resetlogs options. 18. ALTER DATABASE OPEN restlogs; Attachment 1. Sample init.ora file Here is a sample init.ora file. Entries that should be edited to reflect the target file locations are identified by an '<-- edit this' entry. init.ora AQ_TM_PROCESSES = 1 background_dump_dest = G:\orant\rdbms80\trace <-- edit this compatible = 9.2 control_files = ("G:\orant\database\ctl1home.ora", <-- edit this "G:\orant\database\ctl2home.ora") <-- edit this db_block_buffers = 200 db_block_size =2048 db_file_multiblock_read_count = 8 db_files = 1020 db_name = home dml_locks = 100 log_buffer = 8192

Page 4: Manual clone of oracle 11i database

Oracle application training

Mr Prasad . +91-9441235888 oracle application training

log_checkpoint_interval = 8000 log_checkpoint_timeout = 0 max_dump_file_size = 10240 processes = 50 remote_login_passwordfile = exclusive sequence_cache_entries = 10 sequence_cache_hash_buckets = 10 shared_pool_size = 6500000 sort_area_size = 65536 user_dump_dest = G:\orant\rdbms80\trace <-- edit this Attachment 2. Sample trace file Here is a sample of the output from the command alter database backup controlfile to trace. Entries that should be edited to reflect the target file locations are identified by an '<-- edit this' entry. clone.trc *** 1999.10.08.10.49.07.171 # The following commands will create a new control file and use it # to open the database. # Data used by the recovery manager will be lost. Additional logs may # be required for media recovery of offline data files. Use this # only if the current version of all online logs are available. STARTUP NOMOUNT CREATE CONTROLFILE SET DATABASE "HOME" RESETLOGS NOARCHIVELOG MAXLOGFILES 32 MAXLOGMEMBERS 2 MAXDATAFILES 30 MAXINSTANCES 1 MAXLOGHISTORY 112 LOGFILE GROUP 1 'G:\ORANT\DATABASE\LOGHOME1.ORA' SIZE 1M, <-- edit this GROUP 2 'G:\ORANT\DATABASE\LOGHOME2.ORA' SIZE 1M <-- edit this DATAFILE 'G:\ORANT\DATABASE\HOMESYS.DBF', <-- edit this 'G:\ORANT\DATABASE\HOMERBS.DBF', <-- edit this 'G:\ORANT\DATABASE\HOMEUSER.DBF', <-- edit this 'G:\ORANT\DATABASE\HOMETEMP.DBF', <-- edit this 'G:\ORANT\DATABASE\HOMEINDX.DBF' <-- edit this ;