End to End SAP on Oracle Database Refresh Procedure
End to End SAP on Oracle Database Refresh Procedure
Convention : In this document we follow the given convention
while refreshing to system
Source system : The whose database backup is taken and
applied on the other system.
Target system : The system which will be refreshed
1.
Login to the target system : As <sid>admàstopsap
2.
If the target system is in a host which house no
other AS then stop the listener à
lsntctl stop
Note : In case the host houses other AS
proceed without this step .
3.
In the target system switch user to
ora<sid> à
su -ora<target-sid>
4.
In the target system moved the contents of the
/oracle/sid/saptrace/directoey :
Mkdir /oracle/SID/saptrace/background/old
Mkdir /oracle/SID/saptrace/usertrace/old
Mv /oracle/SID/saptrace/background/*
/oracle/SID/saptrace/background/old
Mv /oracle/SID/saptrace/usertrace/*
/oracle/SID/saptrace/usertrace/old
5.
In the target system remove the .dbf files from
the orilog and mirrorlog directorys
Rm /oracle/sid/origlogB/*.dbf
Rm /oracle/sid/origlogA/*.dbf
Rm /oracle/sid/mirrlogB/*.dbf
Rm /oracle/sid/mirrlogA/*.dbf
6.
In the target system delete the content
of all the sapdata<n> directory
Cd /oracle/SID/sapdata<n>
Rm -r*
7.
In the target system take the backup the
following files which are in /oracle/SID/102_64/dbs
Mv initSID.ora initSID.ora.orig
Mv initSID.dbA initSID.dba.orig
Mv initSID.sap initSID.sap.orig
Mv initSID.utl initSID.utl.orig
Mv initSID.bki initSID.bki.orig
8.
Copy the following files from the source system
to the target system directrory
/oracle/target_sid/102_64/dbs using
Cd /oracle/target_sid/102_64/dbs
Sftp <source_sid>adm@SourceIP
Cd /oracle/source_sid/102_64/dbs
Get init<source_sid>.ora
Get init<source_sid>.dba
Get init<source_sid>.sap
Get init<source_sid>.utl
Get init<source_sid>.bki
9.
Also copy the latest .aff/.anf and .log file
from the source system to the target system directory
/oracle/<target_sid>/sapbackup:
/oracle/<target_sid>/sapbackup
Sftp ora<source_sid>@<source
system IP>
Cd /oracle/<source_sid>/sapbackup
Ls -ltr
Get <latest>.aff
Get backu<source_sid>.log
In case of online backup restore , also get
the following file:
Cd /oracle/<source_sid>/saparch
Get arch<source_sid>.log
10. Change
the name of the .log file in the target system:
Mv back<source_sid>.log
back<target_sid>.log
Mv arch<source_sid>.log
arch<target_sid>.log
11. Also
rename the init<sid>.* files in the target system brought from source
system in step 7
Eg : mv init<source_sid>.ora
init<target_sid>.ora
12. In
the target system change the content of the init<sid>.* files by
replacing all occurrence of <source SID> with <target SID> .
However in the following lines og the files the <source_sid> should be
left unchanged :
è
In the init<sid>.ora file the volume_archive
and Volume_backup files
è
In the init<sid>.util file the
BACKUPIDPREFIX filed
13. Both
in the target system and the source system see the name of the TSM server from
the dsm.sys file:
Cd /usr/Tivoli/tsm/client/ba/bin
More dsm.sys
The first line of the file shows the servername
14. If
the source and target system are on different tsm sever then execute the following:
In the Target :
Cd /usr/Tivoli/tsm/client/ba/bin
Mv dsm.opt dsm.opt.old
Mv dsm.sys dsm.sys.old
Sftp root@sourceIP
Cd /usr/Tivoli/tsm/client/ba/bin
Get dsm.opt
Get dsm.sys
Bye
Chmod 755 dsm.opt
Chmod 755 dsm.sys
Cd /oracle/targetSID/102_64/dbs
Vi dsm.opt
Change the virtualname in the dsm.opt file
to that in the dsm.opt of the source system.
15. Check
the connection to the TSM server using the following command
Backint -p
/oracle/SID/102_64/dbs/init<SID>.utl -f password
Backfm -p
/oracle/SID/102_64/dbs/init<SID>.utl
16. Start
the restore with the following command :
Nohop brrestore -b <.anf file> -d util_file
-c Fource -r /oracle/targetSID/102_64/dbs/inittarget_sid>.util -m full -l E
&
17. In
case of online backup restore take the archive log backup restore
Nohup brrestore -a
<start_log#>-<end_log#> -c -d util_file -r
/oracle/targetSID/102_64/dbs/inittarget_SID.utl &
18. Goto
the source system goto the SQL prompt and execute the following:
SQL>alter database backup controlfile to
trace
The file thus created is stored in the
/oracle/sid/saptrace/usertrace directory
19. Copy
the trace file to the /oracle/sid/sapbackup directory in the target system as a
.sql file
Eg : trace.sql
20. Edit
the trace.sql file and make the following changes
Vi trace.sql
àDelete
all the lines before and not including the line containing STSRTUP NOMOUNT
àChange
all the occurrence of the source_SID to Target_SID the the below command
:1,$
S/<source_sid>/<target_sid>/g
àChangethe
settin REUSE to SET and NORESETLOGS to RESETLOGS
àDelete
the lone containing STANDBY LOGFILE
àDelete
all the lines after :
CHARACTER SET UTF8
;
21. Goto
SQL prompt and execute the file
SQL>@trace.sql
22. If
an error “DB_FILES reached maximum” in encountered . edit the init.ora file and
increase the db_files to 700.
Cd /oracle/sid/102_64/dbs
Vi initsid.ora
Change the value of the DB_FILES to 700
Create spfile from pfile;
Repeat the step 21
23. Shutdownthe
database
SQL>shutdown Immediate
24. Take
the database in the mount mode .
Sqlplus / as sysdba
SQL>startup mount
25. For
the Online restore only use the following command (Donot use for the ofline
restore )
SQL> recover database using backup
controlfile until cancel.
Type AUTO and press enter {before that we
require to copy all the desire archive log files}
26. For
Offline /Online restore execute the following command
SQL>alter database open resetlogs
27. Execute
the following commands
à
Create user OPS$<SID>ADM identified externally;
à
Create user OPS$ORA<SID> identified externally;
àgrant
sapdba , connect , resource to OPS$<SID>ADM;
àgrant
connect , resource to OPS$ORA<SID>
àCreate
table OPS$<SID>ADM.SAPUSER (USERID VARCHAR2(255), PASSWD VARCHAR(255));
àinsert
into OPS$<SID>ADM.SAPUSER values (‘SAPSR3’,’U2pa554U’);
àdrop
user OPS$<source_sid>ADM cascade;
àdrop
user OPS$ORA<source_SID> casecade;
28. Start
SAP AS
Startsap
29. Add
temp files to the PSAPTEMP tablespace using brtools
BrtoolsàSpace
Management à
Extend Tablespace
Command similar to the following can be
used
ALTER TABLESPACE PSAPTEMP ADD TEMPFILE ‘/oracle/<SID>/sapdata<n>/temp_<n>/temp.data<n>’ SIZE 3860M REUSE AUTOEXTEND ON NEXT 20971520 MAXSIZE 30000M;
Comments
Post a Comment