Você está na página 1de 7

Applications On Demand Oracle Group SOP Database Refresh using RMAN utility document.

APPLICATIONS ON DEMAND ORACLE APPLICATION GROUP SOP DATABASE REFRESH USING RMAN STEPS AND TROUBLESHOOTING

Author: Creation Date: Last Updated:

Santosh Gorte 24-June-2011 Pramod Belsare, Bhupendra Patidar

Document Reviewers: Version:

IBM AOD Internal Use only 1

Applications On Demand Oracle Group SOP Database Refresh using RMAN utility document.

Document Control

Change Record 7 Author


24-June-2011 Santosh Gorte

Versi Change Reference on


1

Reviewers

Name Pramod Belsare Bhupendra Patidar

Position Manager Oracle Applications Lead Oracle Applications

Distribution

Copy No. 1 2 3

Name All members of Oracle application Group Oracle Group Library and Run book

Location

IBM AOD Internal Use only 2

Applications On Demand Oracle Group SOP Database Refresh using RMAN utility document.

Introduction
Purpose
The purpose of this document is to explain in detail the step-by-step procedure to refresh database without connecting source database using RMAN Cold backup.

IBM AOD Internal Use only 3

Applications On Demand Oracle Group SOP Database Refresh using RMAN utility document.

Requirements:
The following are the following requirements for the database refresh using RMAN Cold backup utility.

1) Database need to be refresh using source name. e.g. If your source database name PROD on node 111 and you want to clone on 100 server so we need to refresh the database using same name. 2) Take the cold backup using below scripts

a) SET NEWNAME Command vi getfiledetails.sql Set pages 1000 Set linesize 80 set feed off set head off spool datafiledetails.txt select 'SET NEWNAME FOR DATAFILE '||chr(39)||file_name||chr(39)||' to '||chr(39)||'/u008/app/oracle/oradata/RICAAE2/'|| replace(file_name,'/u016/app/oradata/RICAAN4/','')||chr(39)||';' from dba_data_files union select 'SET NEWNAME FOR TEMPFILE '||chr(39)||file_name||chr(39)||' to '||chr(39)||'/u008/app/oracle/oradata/RICAAE2/'|| replace(file_name,'/u016/app/oradata/RICAAN4/','')||chr(39)||';' from dba_temp_files; spoll off;

Note : Please allocate the channel as per server configuration. . /home/oracle/RICAAN4.env sqlplus /nolog << EOF CONNECT / as sysdba @/u008/app/backup/RICAAN4/RMAN_Backup/getfiledetails.sql shutdown immediate; startup mount; EOF rman target=/ nocatalog log="/u008/app/backup/RICAAN4/RMAN_Backup/RICAAN4_RMAN_DB_Backup_$(date '+%y%m%d@%H%M%S').log"<<BRV run { host "echo Disk_FULL_backup_start_time"; host "date '+%Y/%m/%d @ %H:%M:%S'"; allocate channel ch1a device type disk MAXPIECESIZE 8192M format '/u008/app/backup/RICAAN4/RMAN_Backup/dbf_N41_%d_%U';

IBM AOD Internal Use only 4

Applications On Demand Oracle Group SOP Database Refresh using RMAN utility document.
allocate channel ch1b device type disk MAXPIECESIZE 8192M format '/u008/app/backup/RICAAN4/RMAN_Backup/dbf_N41_%d_%U'; allocate channel ch1c device type disk MAXPIECESIZE 8192M format '/u008/app/backup/RICAAN4/RMAN_Backup/dbf_N41_%d_%U'; allocate channel ch1d device type disk MAXPIECESIZE 8192M format '/u008/app/backup/RICAAN4/RMAN_Backup/dbf_N41_%d_%U'; allocate channel ch1e device type disk MAXPIECESIZE 8192M format '/u008/app/backup/RICAAN4/RMAN_Backup/dbf_N41_%d_%U'; allocate channel ch1f device type disk MAXPIECESIZE 8192M format '/u008/app/backup/RICAAN4/RMAN_Backup/dbf_N41_%d_%U'; allocate channel ch1g device type disk MAXPIECESIZE 8192M format '/u008/app/backup/RICAAN4/RMAN_Backup/dbf_N41_%d_%U'; allocate channel ch1h device type disk MAXPIECESIZE 8192M format '/u008/app/backup/RICAAN4/RMAN_Backup/dbf_N41_%d_%U'; backup as compressed backupset incremental level 0 database tag 'LEVEL0COLDBACKUP'; BACKUP CURRENT CONTROLFILE format '/u008/app/backup/RICAAN4/RMAN_Backup/cntl_%U.bkp'; release channel ch1a; release channel ch1b; release channel ch1c; release channel ch1d; release channel ch1e; release channel ch1f; release channel ch1g; release channel ch1h; } BRV

3) Transfer the cold backup and datafiledetails.txt file on target server. Same path if available if not Transfer wherever you have sufficient space and create the soft link.

4) On Clone server a) Edit the init file change the DN_NAME=RICAAN4 name. b) Startup the database in nomount state using source SID.

STARTUP NOMOUNT; 5) Start the restoration using below scripts Note : Please check the backup log and change the controlfile backup piecs name Its starting with cntl_XXXXXX.bkp and set the NEWNAME DATAFILE using datafiledetails.txt file

restore controlfile from '/u008/app/backup/RICAAN4/RMAN_Backup/cntl_07mfhjak_1_1.bkp';

IBM AOD Internal Use only 5

Applications On Demand Oracle Group SOP Database Refresh using RMAN utility document.

vi RMAN_RICAAE2_Restoration.sh #!/bin/ksh . /home/oracle/RICAAE2.env sqlplus /nolog << EOF CONNECT / as sysdba startup nomount; EOF rman target =/ log="/u008/app/backup/RICAAE2/RMAN_Backup/${ORACLE_SID}_Recovery_$(date '+%y%m%d@%H%M%S').log" <<EOF run { allocate channel ch1 device type disk; allocate channel ch2 device type disk; allocate channel ch3 device type disk; allocate channel ch4 device type disk; allocate channel ch5 device type disk; restore controlfile from '/u008/app/backup/RICAAN4/RMAN_Backup/cntl_07mfhjak_1_1.bkp'; alter database mount; SET NEWNAME FOR DATAFILE '/u016/app/oradata/RICAAN4/a_archive01.dbf' to '/u009/app/oradata/RICAAE2/a_archive01.dbf'; SET NEWNAME FOR DATAFILE '/u016/app/oradata/RICAAN4/a_archive02.dbf' to '/u009/app/oradata/RICAAE2/a_archive02.dbf'; SET NEWNAME FOR DATAFILE '/u016/app/oradata/RICAAN4/a_archive03.dbf' to '/u009/app/oradata/RICAAE2/a_archive03.dbf'; SET NEWNAME FOR DATAFILE '/u016/app/oradata/RICAAN4/a_archive04.dbf' to '/u009/app/oradata/RICAAE2/a_archive04.dbf'; restore database; SWITCH DATAFILE ALL; SWITCH TEMPFILE ALL; sql "ALTER DATABASE RENAME FILE ''/u004/app/oradata/RICAAN4/log04a.dbf'' ''/u004/app/oradata/RICAAE2/log04a.dbf'' ";'' sql "ALTER DATABASE RENAME FILE ''/u005/app/oradata/RICAAN4/log04b.dbf'' ''/u005/app/oradata/RICAAE2/log04b.dbf'' ";'' sql "ALTER DATABASE RENAME FILE ''/u004/app/oradata/RICAAN4/log03a.dbf'' ''/u004/app/oradata/RICAAE2/log03a.dbf'' ";'' sql "ALTER DATABASE RENAME FILE ''/u005/app/oradata/RICAAN4/log03b.dbf'' ''/u005/app/oradata/RICAAE2/log03b.dbf'' ";'' alter database open resetlogs; release channel ch1; release channel ch2; release channel ch3; release channel ch4; release channel ch5; }

to to to to

IBM AOD Internal Use only 6

Applications On Demand Oracle Group SOP Database Refresh using RMAN utility document.

6) Do the sanity check. SELECT INSTANCE_NAME ,STARTUP_TIME,STATUS, DATABASE_STATUS FROM V$INSTANCE; SELECT NAME, CREATED,OPEN_MODE,LOG_MODE FROM V$DATABASE; SELECT DISTINCT STATUS,ENABLED FROM V$DATAFILE; SELECT * FROM V$DATAFILE WHERE NAME LIKE '%MISS%'; SELECT * FROM V$RECOVER_FILE; SELECT DISTINCT STATUS FROM V$DATAFILE; SELECT COUNT(*) FROM V$TEMPFILE;

7) Change the DB name using NID command. a) Shutdown the instance gracefully and start in mount state

SHUTDOWN IMMEDIATE; STARTUP MOUNT; b) NID TARGET =/ DBNAME=RICAAE2 It will ask your confirmation pass the Y Change database ID and database name RICAAN4 to RICAAE2? (Y/[N]) => Y

Once the db name changed edit the initfile and change the DB_NAME=RICAAE2 and open the database in resetlogs. 8) Delete the backup if not require

Pre-check before executing the scripts.

IBM AOD Internal Use only 7

Você também pode gostar