Sie sind auf Seite 1von 11

Refreshing BOT Preprod Database with Production Data The BOT database in production (ORBBOTP1) uses a link directory

where each data file has been defined to Oracle to be in a link directory /pac/bbotppm0/app/oracle/admin/ORBBOTP1/links However, in this link directory there is a Unix link pointing to the file system/directory where the data files actually are. The development databases may have a slightly different location for the link directory and this location can be found by querying dba_data_files. Please note that to do restores from the production database to the preprod database, an id will be required with sysdba authority. Example: Load ORBBOTP1 into ORBBOTT3 Target database: ORBBOTP1 (source of the data to load into another database) Auxiliary database: ORBBOTT3 (database to be refreshed with the target data)

1) Take an RMAN backup of the target database ORBBOTP1. A good way to take this backup is to use the entry in CRON for the RMAN daily hot backup: /export/home/oracle/tools/RMAN/bin/rman_ORBBOTP1_hotbkup To find the log, ps ef | grep i rman while the backup is running. The backup will produce the following files in the RMAN backup directory /opt/data/oracle/orabkup01/ORBBOTP1/RMAN Below is the correct path /pac/bbotppm0/data/orabkup01/ORBBOTP1/RMAN/pool1 And the files will be: rman_hotbkup_ORBBOTP1_%i_04142010716286532_22lb3ai4_1_1 rman_hotbkup_ORBBOTP1_%i_04142010716286628_23lb3al4_1_1 rman_hotbkup_ORBBOTP1_%i_04142010716286532_21lb3ai4_1_1 rman_archbkup_ORBBOTP1_04142010716286720_25lb3ao0_1_1 rman_archbkup_ORBBOTP1_04142010716286720_24lb3ao0_1_1

rman_cntrbkup_ORBBOTP1_04142010716286723_26lb3ao3_1_1 rman_cntrbkupc-3587329784-20100414-00 2) Ftp the files to the ORBBOTT3 machine into the directory: /opt/data/oracle/orabkup01/ORBBOTP1/RMAN
The above mentioned path is not correct for preprod. Below is the correct path. /pac/bbotppm0/data/orabkup01/ORBBOTP1/RMAN/pool1

3) You do not need to run this step. You do not need to remove the files. The refresh will overwrite the files. DO NOT RUN STEP 3. On the ORBBOTT3 machine. RMAN can use the link directory but after the files have been removed, each will need to be touched. We now need to remove all the data files (after we shut down the database) data files, redo logs, control files the only file we need to leave is the temp data file so we can just reuse that one when we recreate temp. To find all the data files to remove, use the following queries in the ORBBOTT3 database before shutting it down: Select file_name from from dba_data_files; Select member from v$logfile; Show parameter control; After removing the actual files, touch each datafile: Ex: touch /opt/data/oracle/oracle03/ORBBOTT3/data/tools01.dbf 4) Now shut down the ORBBOTT3 database Actual process starts from here. First of all login to the Application Server and go to path

/pac/bbotqpm1/home and look for freezecluster.ksh . Execute it and after the refresh is done then we have to unfreeze it by executing unfreezecluster.ksh . Now below are the steps for shutting down the databse. You will have to log into the Database Server. ( Steps : sqlplus geneva_admin@ORBBOTT3 ; Connect geneva_admin as sysdba ; Shutdown immediate ; ) 5) Do NOT RUN THIS STEP. This step may not be necessary but I havent tested not removing the data files. DO NOT REMOVE the FILES. Remove the files. There is a script in /export/home/oracle/RMAN that will remove the data files. These files are hard-coded into the script so you will need to verify this script contains all the database files in ORBBOTT3. /export/home/oracle/RMAN/ORBBOTT3_RMAN_rm_files.ksh And then touch each file that was removed: Ex: touch /opt/data/oracle/oracle03/ORBBOTT3/data/tools01.dbf

6) Start the auxiliary database (ORBBOTT3) Sqlplus / as sysdba Startup force nomount exit 7) Verify you can get into the target database ORBBOTP1 from the ORBBOTT3 machine sqlplus sys/<password>@ORBBOTP1 If you cant get in and you know the database and listener are up for ORBBOTP1, then update the tnsnames on the ORBBOTT3 machine for the ORBBOTP1 database. Path of tnsnames.ora in T6 : /bto/sys/oracle/product/10.2.0/network/admin

Again an id can be used with sysdba authority. rman target userid/password@ORBBOTP1 auxiliary userid/password@ORBBOTT3 8) To do the refresh using RMAN, we will use the RMAN DB_FILE_NAME_CONVERT approach. First well go into RMAN and list the backup file list to verify the files that need to be input to the RMAN restore and their corresponding file number. There is another script in /export/home/oracle/RMAN with the format and file names for this ORBBOTP1 database . You just need to verify all the file names are in the script and are correct. This file will be used as a CMD file to RMAN to do the refresh. ORBBOTT3_RMAN_input.cmd Using the DB_FILE_NAME_CONVERT method, the ORBBOTT3_RMAN_input.cmd file will have the mapping from the P1 file name to the T3 file name. The T3 link directory can be used. To log into RMAN and list the backup information: Rman> target sys/<password>/@ORBBOTP1 auxiliary sys/<password>@ORBBOTT3 rman target userid/password@ORBBOTP1 auxiliary userid/password@ORBBOTT3 Rman> list backup;

List of Datafiles in backup set 57 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---3 4 Full 52768123 13-APR-10 /opt/data/oracle/oracle01/ORBBOTP1/admin/link/sysaux01.dbf Full 52768123 13-APR-10 /opt/data/oracle/oracle01/ORBBOTP1/admin/link/users01.dbf

BS Key Type LV Size

Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ --------------58 Full 814M DISK 00:03:05 13-APR-10

BP Key: 58 Status: AVAILABLE Compressed: YES Tag: DAILY_HOTBKUP

Piece Name: /opt/data/oracle/orabkup01/ORBBOTP1/RMAN/rman_hotbkup_ORBBOTP1_%i_04132010716228407_1rlb1hpn_1_1 List of Datafiles in backup set 58 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---1 2 6 7 Full 52768090 13-APR-10 /opt/data/oracle/oracle01/ORBBOTP1/admin/link/system01.dbf Full 52768090 13-APR-10 /opt/data/oracle/oracle01/ORBBOTP1/admin/link/undotbs01.dbf Full 52768090 13-APR-10 /opt/data/oracle/oracle01/ORBBOTP1/admin/link/geneva_dat01.dbf Full 52768090 13-APR-10 /opt/data/oracle/oracle01/ORBBOTP1/admin/link/cygent_dat01.dbf

You will also need to update the SCN number in this script you get this number from the RMAN> list backup; Command the SCN number will be for the archbackup file. If there are two archbackup files, use the higher SCN number. You will need to subtract 1 from this number and update the script above. Ex: Rman> list backup;
BS Key Size Device Type Elapsed Time Completion Time

------- ---------- ----------- ------------ --------------65 37K DISK 00:00:01 14-APR-10

BP Key: 65 Status: AVAILABLE Compressed: YES Tag: DAILY_HOTBKUP Piece Name: /opt/data/oracle/orabkup01/ORBBOTP1/RMAN/rman_archbkup_ORBBOTP1_04142010716286720_24lb3ao0_1_1

List of Archived Logs in backup set 65 Thrd Seq Low SCN Low Time Next SCN Next Time

---- ------- ---------- --------- ---------- --------1 1830 52797102 14-APR-10 52797269 14-APR-10

BS Key Size

Device Type Elapsed Time Completion Time

------- ---------- ----------- ------------ --------------66 1K DISK 00:00:01 14-APR-10

BP Key: 66 Status: AVAILABLE Compressed: YES Tag: DAILY_HOTBKUP Piece Name: /opt/data/oracle/orabkup01/ORBBOTP1/RMAN/rman_archbkup_ORBBOTP1_04142010716286720_25lb3ao0_1_1

List of Archived Logs in backup set 66 Thrd Seq Low SCN Low Time Next SCN Next Time

---- ------- ---------- --------- ---------- --------1 1829 52797094 14-APR-10 52797102 14-APR-10

In this case the SCN number we are interested in is 52797269. We subtract 1 from the number and update the cmd script with 52797268.

9) Now we can kick off the refresh. We are already in RMAN so we can run our script: Rman> @@/export/home/oracle/RMAN/ ORBBOTT3_RMAN_input.cmd ( If you are already in RMAN then give this way : For bbotqpm1 id : @@/pac/bbotqpm1/home/RMAN/ORBBOTT3_RMAN_input.cmd For bbotqpm0 id : @@/pac/bbotqpm0/home/RMAN/ORBBOTT3_RMAN_input.cmd For T6 : @@/export/home/oracle/RMAN/ORBBOTT6_RMAN_input_using_links.cmd For U1 : @@/export/home/oracle/RMAN/ORBBOTU1_RMAN_input_new.cmd

10) After the restore is finished, we need to perform the following: a) Add a tempfile to the temp tablespace

b) Rename the global name c) Run the password regeneration file d) Run the EDS script setup and reports

We can do all this by running the script post_RMAN_Clone.sh in the bbs directory. This script has to be run as Oracle User in Dev/Test and as bbotqpm0 in Preprod. Path Preprod : /pac/bbotqpm0/home/tools/etas_scripts/bin Path T6 ,U1: /export/home/oracle/tools/etas_scripts/bin

We no longer need to run the post_cloning.sh script. 11) tablespace may not have a tempfile and if so, one will have to be added: If the temp tablespace already has a temp file you dont need to do this. First you need to check whether tempfile is there or not by giving the following commands: Log in to SQL and then give the commands : SQL> desc dba_temp_file SQL>select file_name, tablespace_name, status from dba_temp_files; The temp

If its not present then give the below commands:


ALTER TABLESPACE temp ADD TEMPFILE '/oradata/temp01.dbf' SIZE 100M;

12) need to run the RMAN setup script for the database we are loading:

To finish, we

The script I need you guys to run after an RMAN duplicate activity is called rman_<SID>_setup.

The file is located in the /pac/<PACID>/app/oracle/admin/<SID>/rman for production and preprod and in the /opt/data/oracle/oracle01/<SID>/admin/rman directory for the other environments. Path for T3 with bbotqpm0 id : /pac/bbotqpm0/app/oracle/admin/ORBBOTT3/rman

Path Of this Script in T6: /opt/data/oracle/oracle01/ORBBOTT6/admin/rman Path for U1 : /opt/data/oracle/oracle01/ORBBOTU1/admin/rman

Script Name : rman_ORBBOTT6_setup

13) There is quite a probability that an account would have been locked , so please execute thsese queries before starting the server : SQL> alter user unif_admin account unlock ; SQL> commit ;

EXAMPLE of the ORBBOTT3_RMAN_input.cmd:

bos67528:SID=ORBBOTT3=>cat ORBBOTT3_RMAN_input.cmd run

{ set until scn 526091539; duplicate target database to ORBBOTT3 PFILE = /pac/bbotqpm0/app/oracle/product/10.1.0/dbs/initORBBOTT3.ora DB_FILE_NAME_CONVERT=('/pac/bbotppm0/app/oracle/admin/ORBBOTP1', '/pac/bbotqpm0/app/oracle/admin/ORBBOTT3') LOGFILE GROUP 1 ('/pac/bbotqpm0/app/oracle/admin/ORBBOTT3/links/redo1_a.log', '/pac/bbotqpm0/app/oracle/admin/ORBBOTT3/links/redo1_b.log') size 128M, GROUP 2 ('/pac/bbotqpm0/app/oracle/admin/ORBBOTT3/links/redo2_a.log', '/pac/bbotqpm0/app/oracle/admin/ORBBOTT3/links/redo2_b.log') size 128M, GROUP 3 ('/pac/bbotqpm0/app/oracle/admin/ORBBOTT3/links/redo3_a.log', '/pac/bbotqpm0/app/oracle/admin/ORBBOTT3/links/redo3_b.log') size 128M, GROUP 4 ('/pac/bbotqpm0/app/oracle/admin/ORBBOTT3/links/redo4_a.log', '/pac/bbotqpm0/app/oracle/admin/ORBBOTT3/links/redo4_b.log') size 128M; }

Path of backup file in preprod : /pac/bbotppm0/data/orabkup01/ORBBOTP1/RMAN/pool1

Example List of Archived Logs in backup set 831 Thrd Seq Low SCN Low Time Next SCN Next Time

---- ------- ---------- --------- ---------- --------1 174 541820291 29-AUG-10 541937617 30-AUG-10

_______________________________________________________

Success message after running Rman script for refresh : contents of Memory Script: { Alter clone database open resetlogs; } executing Memory Script

database opened Finished Duplicate Db at 01-OCT-10

RMAN> **end-of-file**

Das könnte Ihnen auch gefallen