Vous êtes sur la page 1sur 7

ABAP Refresh Backup & Restore Method

1. Backup

A successful online or offline backup (brbackup or OS backup) of the source system is
required.

2. Logon Groups (On Target System)

On the TRG system use the path Tools >> CCMS >>Configuration>>Logon Groups to
display the existing Logon Groups. Print these out. These will be needed after the database has
been refreshed.

3. SAP License (On Target System)

On TRG system log on as <SID>ADM user, execute the command.

***Saplicense show > Drive letter:\<Path>\saplicense.txt***

4. Export User Master Data

Export the user master data of the TRG system using SCC8 transaction code. Specify a
valid system in the landscape so that the transport files available with us which can be used in the
import process.

5. Files from the SRC system

a. Copy the backup file (.and file) from <Oracle home>\SRC\sapbackup to <Oracle
home>\TRG\sapbackup (If this file exists on Source System)
b. Copy the init<SRC>.sap file from <Oracle home>\SRC\Ora92\database to
<Oracle home>\TRG\Ora92\database.
Note: After copy the file, make the necessary changes accordingly your Target system in the file.
Ex: Change the Source SID to Target SID.


6. Creation of Control file (On Source system)

Perform the below steps in the command prompt for generating the latest control
trace file which is available in the location Oracle home>\SRC\saptrace\usertrace\
<SID>_ora_XXXX.trc

a. C:\ > sqlplus /as sysdba
b. SQL>alter database backup controlfile to trace;

Once the above command performed successfully the output should be like this
Database altered.



Now the latest trace file (control file) available in the location Oracle
home>\SRC\saptrace\usertrace\ with the file extension .trc.

Below screenshot is reference of creation of Control file in the command prompt.




c. Changes to be made in the control file trace

Open the trace file which is obtained by executing the previous command on
the SRC system.
Choose to have
o No Reset logs option (or)
o Reset logs option
Using reset logs, remove all the other details from the trace file except the
information under Reset logs.
Under reset logs section, change the option REUSE database to SET and
also it contains the SRC <SID>, change the <SID> to TRG <SID>.
Make necessary changes to the paths under which the data files structure
exists.
Note: This should be done after restoring the backup on the TRG system.
Save the file as .SQL for example CONTROL.SQL



Note: Make sure that the paths specified in the control file should be same as in the
target system.


After making necessary changes in the CONTROL.SQL file, the file output should be
like this:
EXAMPLE: here in this example YRD is the Target system SID. And specified in the
Bold is changes in the file

STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "YRD" RESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 255
MAXLOGMEMBERS 3
MAXDATAFILES 254
MAXINSTANCES 50
MAXLOGHISTORY 1134
LOGFILE
GROUP 1 (
'E:\ORACLE\YRD\ORIGLOGA\LOG_G11M1.DBF',
'E:\ORACLE\YRD\MIRRLOGA\LOG_G11M2.DBF'
) SIZE 50M,
GROUP 2 (
'E:\ORACLE\YRD\ORIGLOGB\LOG_G12M1.DBF',
'E:\ORACLE\YRD\MIRRLOGB\LOG_G12M2.DBF'
) SIZE 50M,
GROUP 3 (
'E:\ORACLE\YRD\ORIGLOGA\LOG_G13M1.DBF',
'E:\ORACLE\YRD\MIRRLOGA\LOG_G13M2.DBF'
) SIZE 50M,
GROUP 4 (
'E:\ORACLE\YRD\ORIGLOGB\LOG_G14M1.DBF',
'E:\ORACLE\YRD\MIRRLOGB\LOG_G14M2.DBF'
) SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'E:\ORACLE\YRD\SAPDATA1\SYSTEM_1\SYSTEM.DATA1',
'E:\ORACLE\YRD\SAPDATA2\ROLL_1\ROLL.DATA1',
'E:\ORACLE\YRD\SAPDATA3\YRD_1\YRD.DATA1',
'E:\ORACLE\YRD\SAPDATA3\YRD_2\YRD.DATA2',
'E:\ORACLE\YRD\SAPDATA3\YRD_3\YRD.DATA3',
'E:\ORACLE\YRD\SAPDATA3\YRD_4\YRD.DATA4',
'E:\ORACLE\YRD\SAPDATA4\YRD_5\YRD.DATA5',
'E:\ORACLE\YRD\SAPDATA4\YRD_6\YRD.DATA6',
'E:\ORACLE\YRD\SAPDATA4\YRD_7\YRD.DATA7',
'E:\ORACLE\YRD\SAPDATA4\YRD_8\YRD.DATA8',
'E:\ORACLE\YRD\SAPDATA4\YRD_9\YRD.DATA9',
'E:\ORACLE\YRD\SAPDATA1\YRD620_1\YRD620.DATA1',
'E:\ORACLE\YRD\SAPDATA1\YRD620_2\YRD620.DATA2',
'E:\ORACLE\YRD\SAPDATA1\YRD620_3\YRD620.DATA3',
'E:\ORACLE\YRD\SAPDATA1\YRD620_4\YRD620.DATA4',
'E:\ORACLE\YRD\SAPDATA2\YRD620_5\YRD620.DATA5',
'E:\ORACLE\YRD\SAPDATA2\YRD620_6\YRD620.DATA6',
'E:\ORACLE\YRD\SAPDATA2\YRD620_7\YRD620.DATA7',
'E:\ORACLE\YRD\SAPDATA2\YRD620_8\YRD620.DATA8',
'E:\ORACLE\YRD\SAPDATA2\YRD620_9\YRD620.DATA9',
'E:\ORACLE\YRD\SAPDATA3\YRD620_10\YRD620.DATA10',
'E:\ORACLE\YRD\SAPDATA4\YRD620_11\YRD620.DATA11',
'E:\ORACLE\YRD\SAPDATA1\YRDUSR_1\YRDUSR.DATA1'
CHARACTER SET WE8DEC
;
7. Shut down the TRG system

a. Stop SAP from SAP Management Console or from command prompt
b. Stop all oracle services
c. Stop saposcol service.

8. Clean out file system at Target system.

On the TRG system, remove all files from sapdata*, mirrlog*, origlog* and oraarch from
the respective directories.

9. Restoring the backup on TRG system

a. Restore all above files in the Target System respective folders.
b. Change the .and file obtained from the SRC system which is under the
<Oracle_home>\sapbackup directory according the file system of the TRG system as the
SRC and TRG may not have the same file system structure (If this file exists on Source
System).
c. After making necessary changes in the .and file, use the following command
Brrestore m full b <path for the .and file>

10. Create Control Files on Target System

a. Change the trace of the control file of the SRC system according to the TRG system and place
it under <Oracle_home>_dir as CONTROL.SQL.
b. Navigate to the Oracle_home directory and execute the following command in CMD
prompt.

CMD sqlplus /as sysdba
Sqlplus>@control.sql
Note: Before doing this step make sure that the all Oracle services are up in the service.msc file

Note:
1) Before executing the control file on the TRG system, make sure that the old control files
are removed from all the locations specified in init<SID>.ora file.
2) Edit the control file according the TRG datafiles directories structure.

Following screenshot shows the example of running the CONTROL.SQL file on the target
system.




10. Bringing database to OPEN state

After creating the control files, execute the following commands
1) cmd sqlplus /as sysdba
2) SQL>select status from v$instance;
After execute the above sql command the initial output should be STATUS MOUNTED.
But it shold be in OPEN Status.

3) SQL> recover database using backup controlfile until cancel;

After execute the above sql command the output will be like below:



Get the specified file from the SRC system under <SRC_Oracle_home>\oraarch
directory and place it under <TRG_Oracle_Home>\oraarch directory
Rename the file as per TRG SID (<SRC SID>ARCHARCXXXXX.001 <TRG
SID>ARCHARCXXXXX.001)
Rename the entire Archive files under this directory with Target SID names
After renaming the file specify the full path of the filename or use AUTO option

Note: We have to use this option, if you have taken Online Backup.
Note: If you have taken online backup the latest archive (which is appearing in the sql prompt)
available.

If you have taken Offline backup, here you have to provide path of the latest .DBF
file which is available in the OriglogA folder.
SQL> alter database open resetlogs;

The output should be like this: Database altered.
After alter the database, check the status of v$instance, It should be OPEN status.

The below screenshot shows the example of the above commands.

11. Setting OPS$ users

On TRG system,
1) CMD sqlplus /as sysdba
2) Check the OPS$ users on the TRG system by executing the following command
Sqlplus> select username from dba_users;
3) SQL> create user "OPS$<TRG-hostname>\<TRG-SID>ADM" identified externally;
4) SQL> create user "OPS$<TRG-hostname>\SAPSERVICE<TRG-SID>" identified
externally;

Grant permissions to OPS$ created users:
1) grant sapdba,dba to ""OPS$<TRG-hostname>\<TRG-SID>ADM";
2) grant sapdba,dba to "OPS$<TRG-hostname>\SAPSERVICE<TRG-SID>";


Giving access to SAPUSER table for OPS$ users

Execute the following commands

1) SQL> create table "OPS$<TRG_hostname>\<TRG SID>ADM".sapuser as select * from
"OPS$<SRC_hostname>\<SRC SID>ADM".sapuser;
2) SQL> create table "OPS$<TRG_hostname>\SAPSERVICE<TRG SID>".sapuser as
select * from "OPS$<SRC_hostname>\SAPSERVICE<SRC SID>".sapuser;
3) SQL> shut immediate;


The below screenshot shows the SAPUSER table of the Source System OPS$ users.
This is for our reference only



Changing the environment variable dbs_ora_schema
Change the value of the environment variable from SAP<TRG SID> to SAP<SRC SID> as
follows





Background Work process
Do not bring up the background work process on the TRG system to prevent the system from
running the SRC jobs by changing the value to zero in the instance profile.


Start SAP
Restart the listener and agent services. (Better restart the Operating system)
Start the SAP system using Management Console.
1) Apply the license using the file which is generated before starting the refresh activity on
the TRG system.
2) Go to SM37 transaction,
a. delete all finished and cancelled jobs using RSBTCDEL program
b. Change all release jobs to scheduled status.
3) Configure TMS
4) Incase any export of user master data of TRG system is done, import the user master data.
Adding datafiles to temporary tablespace PSAPTEMP using BRtools.