Wednesday, 26 November 2014

SYSTEM COPY. HOMOGENEOUS/HETEROGENEOUS/DB REFRESH.
  • System copy is a process of setting up a new system using a copy/backup of existing system.
  • It is required in the following scenarios.
                                I.            H/w migration.
                              II.            Os/db migration.
                            III.            Testing the backup of sap system.
                            IV.            Patch application and kernel upgrade.
                              V.            Sap upgrade.
                            VI.            To test the developed objects before moving to production.
                          VII.            To setup a sandbox, testing of training system in the landscape.
  • There are various ways to perform a system copy.
§  Homogeneous system copy- if there is no change in the database of operating system. Homogeneous system copy can be performed by following methods.
1.       File system copy.
2.       Database backup and restore (db specific method).
3.       Sapinst tool export and import.
Note: option 3 is the only method for heterogeneous copies/Unicode conversions, net weavers system based on java. For heterogeneous system based on oracle and db2. Sap also supports db specific methods using br tools.
§  Heterogeneous system copy- if there is a change either in the os or db of the target system. It has to be performed by a os/db migration certified consultant.
  • If the system is setup as new system then it is referred as system copy/installation os,  db, erp, restore/import is required for which no [re steps are required i.e the system is completely built from os, db and r/3 without changing os or db.
DB REFRESH:
The system exists with os, db, erp (sap component). Which is refreshed (replaced) by the database of any other system mostly PRD in the landscape. In such cases the source dependencies need to be documented or transported to revert them back after the refresh.
HOMOGENEOUS SYSTEM COPY(FILE SYSTEM COPY)
1.       Take full offline backup of database using  BR Tolls/DB 13.
Directly using the single line command of brtools
Brbackup –u –p init<sid>.sap –d disk –t offline –m all
or go through the br tools menu
Select 4th option –backup and database copy
Select 1st option –database backup
Select 2nd to change backup device type to disk
Select 6th to change backup type to offline_force type c for continue
Select 3rd option of menu for compression mode and set to yes. And the backup starts and in b/w asks for prompt continue, then type c to continue.
2.       Generate of control file.
è By generating trace file at os level (this method is used for /DB refresh )
Sql> alter database backup controlfile to trace
We can find the trace file in oracle/sid/saptrace/usertrace. Copy it on the desktop and do the modifications.
Remove all the lines above “STARTUP NOMOUNT” below CHARACTER SER UTF8;  save the file.
Replace S_sid with T_sid.
Replace REUSE with SET.e
Replace NORESETLOGS with RESETLOGS.
Replace ARCHIVELOG with NOARCHIVELOG.
Copy the init<sid>.ora and init<sid>.sap from source system(oracle/sid/102/database) and change the source S_sid with T_sid.
è  By using ORABRCOPY tool (java tool to generate control file)
ORABRCOPY is available as .SAR file in instmaster/im_windows_i386/common/dbtools/install /ora
Create a new directory copy the .sar file full permission, login to <Sid>adm and uncar using the command SAPCAR –XVF ORABRCOPY.SAP
It will generate 3 files
1.       Ora_br_copy.sh ------- used for linux os.
2.       Ora_br_copy.bat -------used for windows os.
3.       Orabrcopy .jar.
Now generate the control file using (orasid)
Ora_br_copy.bat -generateFiles –forceLogSwitch –targetSid < **> -password <******>  -listnerPort 1521
It will generate control.sql(target system) and control.trc(source system) and init<sid>.ora (target system).
Compare control.sql with control.trc and change according to control.trc file in control.sql file.
Copy the init<sid>.sap from /oracle/sid/102/database of the source system and change S_sid with T_sid.
3.       Target system preparation
Ø  Install os and oracle with same patch level as source.
Ø  Go to installation master and run Sapinst and select as below
n  Sap net wear 2004’s support release.
n  Sap system.
n  Additional life cycle tasks.
n  System copy.
n  Oracle.
n  Target system.
n  Central instance as abap.
Ø  Click ok.
Select the custom option. It will ask for log off click ok.
Select the java component.
Select the jdk directory.
Select the jce policy archive.
Provide sap sid .<T01>
Installation drive<e:>.
Enable Unicode system.
Ø  Provide the password.
Ø  Select local installation.
Ø  Provide os user password.
Ø  Select homogeneous system copy.
Ø  Provide db sid. it will show a reference error
Ø  Go to installation directory (pf/sap_instdir/nw045/lm/copy/ora/system/central/as/edit control.xml.
Search for update ORACHECK_PAR                 and delete line row. Create Db= false and restart the installation.
Ø  Provide the DB system parameters.
Ø  Select the DB system driver for installation
Ø  Provide standard database users
Ø  Click next for 4 times
Ø  Select kernel and oracle client path
Ø  Now it will ask to restore the db data. Click ok
Ø  Copy the init<dbsid>.sap from source system. Replace S_sid with T_sid and place it in target system /oracle/sid/102/database directory.
Ø  Copy the init<dbsid>.ora from source system and replace S_sid with T_sid and place database directory.
Ø  Copy control.sql file and place it in the target system installation directory.
Ø  Change S_sid with T_sid in b*****.afd log file which is generated during the offline backup.
Ø  Create the folders mirrlogA, mirrlogB, oraarch, saparch, origlogA/cntrl, origlogB/cntrl, sapbackup. Sapcheck, sapdata1/cntrl, sapdata2, sapdata3, sapdata4, sapreorg, saptrace/background and usertrace.
Ø  Copy the backup of source system and keep in the target system sapbackup directory.
Ø  Switch the user  <sid>adm and restore the db using
brrestore –u –b b*****.afd –d disk –k yes –m all
-k denotes compress  mode
-d means device type
-b backup log file
Ø  Click ok to continue and the target system installation will complete itself.
Ø  To ensure that the system copy is done successfully or not. We have to calculate the count of the tables before and after the system copy
RSTABLESEZE, TADIR, DD02L, TFDIR, TSTC, patch level, tables related to material master (MARA), vendor master (LFA1), plants and storage locations (T001l),RFCDES for RFC connections.
Ø   RSTABLESIZE is the report used to find the size of client patch level (ABAP,BASIS,APPL & HR) –screen shots.

System Refresh: General steps of Backup Restore method


System Refresh Steps:
There are 2 ways of doing System Refresh:
1.       Backup & Restore method  (for comparatively small database size)
2.       Export/Import using SAPINST (for comparatively large database size)

Example: Source System is PRD & Target system is QAS.


Pre-system refresh activity:
  1. Check size of database in both QAS & PRD. (If space issue, then resolve it)
  2. Take offline backup of both QAS as well as PRD
  3. Check file system size in QAS (is there enough space or not!)
  4. Check support pack levels of both system & Compare it.
  5. Take export of RFCs, user master data, application data.
  6. TMS Screenshots of an existing system.
  7. Suspend the jobs by running report BTCTRNS1.
  8. Profile parameters.
  9. Down QAS system & database.
  10. Copy the QAS license in text file at OS level. (rename it so that it will save your time of applying new license. Once the activity completed apply same license then no need to download it again from OSS).
  
System Refresh Activity:


Backup Restore Method:

  1. Take a backup of Source system (PRD)
  2. Then Restore it on target system (QAS).                                                          
  3. oraqas>brrestore –m full –b <backup>.aft –c
  4. If backup is online (.ant)--> then restore & recover it.
  5. If Backup is offline (.aft)-->only Restore it. (here we are using offline backup)
  6. Once the restore is complete, After that create a trace file at source system (PRD). SQL>alter database backup controlfile to trace;
  7. Copy that trace file to target system QAS & edit it in target system.
  8. In trace file:Locate  “STARTUP NOMOUNT”  From current line till end delete everything.
  9. Then change SID PRD to QAS (:1,$S/PRD/QAS/g)
  10. Change Reuse to set
  11. Change Noresetlogs to resetlogs           
  12. Change Archivelog to Noarchivelog
  13. Now save this file as <tracefilename>.sql at location /oracle/QAS/saptrace/usertrace
  14. Once you complete the above step, create controlfile using trace file in target system QAS.    
  15. SQL>@<tracefilename>.sql
  16. SQL> alter database open resetlogs;
 
Post Refresh Activities:
 
  1. Delete the existing license as it represents the old SID : PRD.  
  2. Install the SAP license for SID QAS. 
  3. Reconfigure STMS (SE06). 
  4. Delete RFC from SM59. Import RFCs, User master data, application data. 
  5. Release the jobs (Run the report BTCTRNS2). 
  6. Maintain logical system name. 
  7. Execute SGEN. 
  8. Stop Archiving Process when SGEN is executed. 
  9. Import profiles of active servers. 
  10. SCC4 setting. 
  11. Take a backup of existing system QAS. 
  12. Health check monitoring.