Sei sulla pagina 1di 0

Type Handbook Document

Area SAP Basis


Topic Cross Server Restore

Author Basis Consultant

Cross Server Restore

This procedure allows a database copy, without requiring UNIX system/SID changes. In addition to
requiring significantly less time, It also preserves the tuning settings specific to that server.

Phase 1 -- Pre-Migration Activities

a) Determine and Record current client settings with Transaction SCC4.

b) Preserve Target systems user/roles.
Run Tran SCC8 and select the export Profile SAP_USER .Schedule as Background Job and start
Immediate .
Check in Transaction SCC3 for the export logs. The resulting transport will be of the
format : <SID> KT<number>

c) Perform full backup of the source system
Crontab scheduled .This is where the script is called to perform the backup
/usr/local/bin/<SID>online/offline_backup.ksh

Or Perform Manually :
brbackup t offline m all p init<SID>.sap.OFL

backup_mode=all
backup_type=offline_force
backup_root_dir=/oracle/<SID>sapbackup/dbf
compress=yes
exec_parallel=6 (Number of Parallel Brbackup Processes , #CPUs x 1.5 )


Different Procedure for Cross Server Restore
1) On the source system

Perform a brbackup - offline is preferred as there is no need to apply redo logs after the
restore.

On the target system create a soft link from /oracle/TRG to /oracle/SRC.

TARGET: cd /oracle
TARGET: ln -s TGT SRC

2) Rdist

Rdist the sapbackup directory to the source server (or nfs mount or restore from tape or otherwise
make accessible.)
(See appendix 1 for RDIST guide)

Phase 2 -- Migration Activities

1. Get Control file information from the source system.Trace File

All Rights Reserved.
Copyright 2001-2002. Page 1 of 1

Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant


SORCE_# su - orasrc
SORCE:orasrc 1> svrmgrl

Oracle Server Manager Release 3.0.5.0.0 - Production

(c) Copyright 1997, Oracle Corporation. All Rights Reserved.

Oracle8 Enterprise Edition Release 8.0.5.1.0 - Production
PL/SQL Release 8.0.5.1.0 - Production

SVRMGR> connect internal
Connected.
SVRMGR> alter database backup controlfile to trace;
Statement processed.
SVRMGR> exit
Server Manager complete.
SORCE:orasrc 2> cd saptrace/usertrace
SORCE:orasrc 3> ls -lrat


Look for the most recent trace file (last one listed)

-rw-r----- 1 orasrc dba 3113 Nov 5 23:45 ora_24475.trc
2. Create Script

TARGET_# mv /tmp/ora_24475.trc create.sql

Edit create.sql.
Delete all lines up to the 'STARTUP NOMOUNT'
Replace 'REUSE' with 'SET'
Remove the 'NO' from 'NORESETLOGS'
Change the old SID to the new SID eg : %s/<SRC>/<TGT>/g
Comment out all lines after the datafiles
3. ftp this file Create.sql to the target server.
4. Get SAPlicense Details from the target server prior to refresh.

As tgtadm
TARGET:tgtadm 1> saplicense show >saplicenseinfo.txt

Customer id License key(s) Valid to Hardware key
1000010054 CRSYADHZTZ138NEQJQ7E7QAQ 31.12.9999 I2074845313

5. Look through init<SID>.ora on the target system and take note of the location of the control
files.

Target> more /oracle/<SID>/816_64/dbs/init<SID>.ora | grep contrl_files


All Rights Reserved.
Copyright 2001-2002. Page 2 of 2
Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant

~control_files = (/oracle/<TGT>/sapdata1/cntrl/cntrlTGT.dbf ,
(/oracle/<TGT>/sapdata2/cntrl/cntrlTGT.dbf,
(/oracle/<TGT>/origlogA/cntrl/cntrlTGT.dbf)



6. Stop SAP and then Oracle Database on the Target System

7. Copy the Backup Log file back<SID>.sap from source
/oracle/<SID>/sapbackup/back<sid>.log server to the target server

8. Copy the Backup file (.afd or .and for Online and offline backup to disk . Or .aft or .ant for
Online and offline backup to Tape .)

9. Modify backup file now copied to target system . Replace <SID> of the source system with
that of target system .

Use Vi editor with the global subs/replace command.
Esc :%s/<x>/<y>/g where x is the source <SID> and y is the target <SID>.

10. Now copy over the compressed Brbackup and SQL scripts from the source system
Login as ora<sid> user on the target system . Files should be owned by
[ora<sid> , dba]
Create Directory /oracle/<SID>/sapbackup/dbf/<logfile-filename>
Copy files from /oracle/<SID>/sapbackup/dbf/<filename-ref>/*.Z to the corresponding
directory on the Target server using ftp.


11. Clean-up Before Restore

a) Delete old DB

Remove any old data files, perhaps in the following fashion and with caution.
Login with ora<sid> and then only run this command.

find . -name "*data?" -type f | xargs -i{} rm {}

b) Delete Control Files

TARGET_# grep control_files dbs/initTGT.ora
control_files = ( /oracle/TGT/sapdata1/cntrl/cntrlTGT.dbf ,
/oracle/TGT/sapdata2/cntrl/cntrlTGT.dbf , /oracle/TGT/dbs/cntrlTGT.dbf )
TARGET_# rm /oracle/TGT/sapdata1/cntrl/cntrlTGT.dbf
/oracle/TGT/sapdata2/cntrl/cntrlTGT.dbf /oracle/TGT/dbs/cntrlTGT.dbf

c) Verify Backup Log back<sid>.log and brbackup <filename>.and ot .afd is correct and
permissions are appropriate.


Comment out any cron entries, such as backups that may impact on the restore!



!

All Rights Reserved.
Copyright 2001-2002. Page 3 of 3
Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant

12. Start Restore

Login as ora<sid> user on the target system .

TARGET:oratgt 15> brrestore -m full -b <filename>.afd or .and
BR401I BRRESTORE 4.5B (50)
BR405I Start of file restore: rdewpeiv.rsb 2001-03-14 19.01.17

BR454W Values of oracle_sid are different: current 'TGT', backup
bdewbawm.afd 'SRC'
BR455W Value 'TGT' of oracle_sid will be used for restore
BR454W Values of oracle_home are different: current '/oracle/TGT', backup
bdewbawm.afd '/oracle/SRC'
BR455W Value '/oracle/TGT' of oracle_home will be used for restore
BR454W Values of sapdata_home are different: current '/oracle/TGT', backup
bdewbawm.afd '/oracle/SRC'
BR455W Value '/oracle/TGT' of sapdata_home will be used for restore
BR280I Time stamp 2001-03-14 19.01.17
BR256I Please enter 'cont' to continue, 'stop' to cancel the program:

BR427I Files from the old sapdata_home /oracle/SRC will be restored into
the new sapdata_home /oracle/TGT
BR370I Directory /oracle/TGT/sapdata4/clud_1 created

BR428W File /oracle/TGT/mirrlogB/log_g4_m2.dbf will be overwritten
BR280I Time stamp 2001-03-14 19.02.01
BR256I Please enter 'cont' to continue, 'stop' to cancel the program:


13. Once the restore has completed successfully

Login as <sid>adm
Ensure ../cntrl directory exists in the path for the first Oracle Control file (Check all
directories) .

14. Run Control file Script

Login as ora<sid> .
Go to SVRMGRL and run the create control file script.

SVRMGR> @/oracle/TGT/saptrace/usertrace/create.sql
ORACLE instance started.
Total System Global Area 140381552 bytes
Fixed Size 60784 bytes
Variable Size 59604992 bytes
Database Buffers 80371712 bytes
Redo Buffers 344064 bytes
Statement processed.
SVRMGR>

All Rights Reserved.
Copyright 2001-2002. Page 4 of 4
Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant


15. Recover (For Online Backup)

If an online backup was used a recover will be required.
Copy and uncompress the required archive logs (any created between the start and stop time of the
backup listed in backSRC.log)

Rename the archive logs to have new SID in the name

TARGET:oratgt 15> ls | grep SRC | sed -e 's/SRC//' | awk '{print "mv SRC"
$1 " TGT" $1}' | ksh

Recover in the following fashion:
SVRMGR> recover database until cancel using backup controlfile;
ORA-00279: change 2474122161282 generated at 12/14/00 01:10:14 needed for
thread 1
ORA-00289: suggestion : /oracle/TGT/saparch/TGTarch1_12719.dbf
ORA-00280: change 2474122161282 for thread 1 is in sequence #12719
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO

ORA-00278: log file '/oracle/TGT/saparch/TGTarch1_12718.dbf' no longer
needed for this recovery
ORA-00308: cannot open archived log
'/oracle/TGT/saparch/TGTarch1_12719.dbf'
ORA-27037: unable to obtain file status
Digital Unix Error: 2: No such file or directory
Additional information: 3
SVRMGR> alter database open resetlogs;
Statement processed.

16. Start and verify Oracle is running at the OS level. Start Listener

ps ef | grep ora
lsnrctl start <SID>

17. Change passwords

Reset SYSTEM password in SVRMGRL.

In svrmgrl:

SVRMGRL> connect internal
SVRMGRL> alter user system identified by manager;
SVRMGRL> exit;

Use ./chdbpass which is in /oracle/TGT/sapreorg/chdbpass.
Connect with the ORACLE SYSTEM password and reset all passwords to the default. Then reset
passwords to what they were on the old database.
In SVRMGR check that the table OPS$SIDADM.SAPUSER exists, it should have one row which is the
SAPR3 user and the password.

Also check the password of user sapr3 . The standard Password should be sap . You can confirm
this by connecting with connect sapr3/sap . If it connect s that means the password is standard .



All Rights Reserved.
Copyright 2001-2002. Page 5 of 5
Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant

18. OPS$ users

Use server manager to remove old and create new OPS$ users. Drop the old ops$oratgt and the
ops$tgtadm users with the cascade option.

In svrmgrl:

SVRMGRL> connect internal
SVRMGRL> drop user ops$ora<tgt> cascade ;
SVRMGRL> drop user ops$<tgt>adm cascade ;


SVRMGRL> create user ops$ora<tgt> identified externally
default tablespace PSAPUSER1D
temporary tablespace PSAPTEMP;

SVRMGRL> create user ops$<tgt>adm identified externally
default tablespace PSAPUSER1D
temporary tablespace PSAPTEMP;

SVRMGRL> grant dba, connect, resource to ops$<tgt>adm;
SVRMGRL> grant dba, connect, resource to ops$ora<tgt>;
SVRMGTL> exit


At this point Stop and Re-start SAP/DB .


To check

SVRMGTL> select * from dba_role_privs where grantee like OPS$%;

19. Reapply SAP license

Install the correct SAP license and then start SAP. Delete the license for the host SID.

Customer id License key(s) Valid to Hardware key
1000010054 CRSYADHZTZ138NEQJQ7E7QAQ 31.12.9999 I2074845313

20. Start SAP

Start SAP, log onto SAP (password will be same as host system) and verify system with transaction
SICK

Phase 3 Post Migration Activities

Check and modify the system as follows:
SM50 to ensure processes are the same, if not change them
SM37 depending on user requirement. Either tell them the system is up and let them sort out
batch jobs, or, delete all scheduled jobs except system monitoring. If any are active they can be
'captured' and then deleted without core in SM50. RSBTCDEL is supposed to delete jobs.
SPAD change the server for all the printers;
Select utilities - for output device - assign server, then display list and finally convert
Reconfigure SE06
SP12 do a TemSe consistency check and delete all of the errors
SM12 delete old locks.
SM13 delete all failed updates.

All Rights Reserved.
Copyright 2001-2002. Page 6 of 6
Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant

Check Logon Groups with Transaction SMLG .
Adapt the RFC Destination tolls (SM59)
Clean the Transactional RFCs (SM58)
Include the SAP System in the TMS domain again.
Ensure the Database Check and Update Statistics are scheduled and working in the DBA
Planning calendar (DB13).
Delete Cancelled and Finished Jobs . Execute (SE38) ABAP Program RSBTCDEL ,marking the
field delete with forced mode.
Restore SAP System Users : Import the Transport requested which was generated when the
when users and roles was exported via client export . After that execute the Post Import Process
(Transaction SCC7)
Create New operation mode and adapt the Time Table (transaction SM63)
In RZ10 delete all of the old profiles and import the correct ones.
Delete all entries from Tables TPFET and TPFHT . These tables contains information about
changes made to the profile of the source system.
Delete all entries from following Tables : MONI,
PAHI,OSMON,DBSNP,SDBAH,SDBAD,SDBAP,SDBAR .
Delete all system from table TLOCK which holds the repair requests from the source system.
Update table E070L is necessary to update/set transport number range .

To remove unwanted database links, check the name of the link; select * from dba_db_links; to
remove any; drop public database link 'name of link;

12.1 Transport system

Configure the Workbench Organizer (Se06) with the option Database Copy . This Releases all
Transport , repair and Customizing requests that have not been released in the source system .

If we are to reset the transport and correction system log into SAP as SAP* client 000 and use SE06.
Set up the initial screen the same as it was and select CREATE. Provide the production and test sids.
Continue and then select 'FROM PROD TO TEST', confirm and yes. If all is OK Initialization complete
will be returned.

In the clients used for transports run the job RDDNEWPP, needs to be done as the DDIC user, so
password may need to be reset

Use server manager to reset the transport number on table SAPR3.E070L





All Rights Reserved.
Copyright 2001-2002. Page 7 of 7
Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant

Appendix 1 - Rollback segments

CREATE ROLLBACK SEGMENTS AND TABLESPACE

Go in sapdba -> Tablespace Administration and do the following:

b - New path: '/oracle/TGT/sapdata6/rollbig_1/rollbig.data1'
c - New size: 10000000 K

File system: `rzd9#sapdata6'
Free space: 6411033 K

d - Define more than one data file
e - Default storage parameters

f - Select new path from a list of file systems
r - Select new path from a list of raw devices
u - Autoextend: OFF

s - Start
q - Return

Please select ==> e

a - INITIAL 200000 K
b - NEXT 200000 K

c - MINEXTENTS 5
d - MAXEXTENTS 300

e - PCTINCREASE 0

q - Return

Please select ==>

After the above, put the following in a script, enter Server Manager and run script:

create rollback segment PRBS1 tablespace psaprollbig
storage (initial 200M next 200M minextents 5 maxextents 300 ) ;
create rollback segment PRBS2 tablespace psaprollbig
storage (initial 200M next 200M minextents 5 maxextents 300 ) ;
create rollback segment PRBS3 tablespace psaprollbig
storage (initial 200M next 200M minextents 5 maxextents 300 ) ;
create rollback segment PRBS4 tablespace psaprollbig
storage (initial 200M next 200M minextents 5 maxextents 300 ) ;
create rollback segment PRBS5 tablespace psaprollbig
storage (initial 200M next 200M minextents 5 maxextents 300 ) ;
create rollback segment PRBS6 tablespace psaprollbig
storage (initial 200M next 200M minextents 5 maxextents 300 ) ;
create rollback segment PRBS7 tablespace psaprollbig
storage (initial 200M next 200M minextents 5 maxextents 300 ) ;
create rollback segment PRBS8 tablespace psaprollbig
storage (initial 200M next 200M minextents 5 maxextents 300 ) ;

Alter /oracle/TGT/dbs/initTGT.ora to use the new rollback segs

All Rights Reserved.
Copyright 2001-2002. Page 8 of 8
Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant


rollback_segments = (PRBS1,PRBS2,PRBS3,PRBS4,PRBS5,PRBS6,PRBS7,PRBS8)

and ensure max_rollback_segments >= 8

Check rollback segments

Select status, segment_name from dba_rollback_segs ;

Appendix 2 - Add New Logfile Groups and Members

Go into Server Manager and run the following:

alter database add logfile group 1
('/oracle/TGT/origlogA/log_g1m1.dbf') size 50m ;
alter database add logfile group 2
('/oracle/TGT/origlogB/log_g2m1.dbf') size 50m ;
alter database add logfile group 3
('/oracle/TGT/origlogA/log_g3m1.dbf') size 50m ;
alter database add logfile group 4
('/oracle/TGT/origlogB/log_g4m1.dbf') size 50m ;
alter database add logfile group 5
('/oracle/TGT/origlogA/log_g5m1.dbf') size 50m ;
alter database add logfile group 6
('/oracle/TGT/origlogB/log_g6m1.dbf') size 50m ;
alter database add logfile group 7
('/oracle/TGT/origlogA/log_g7m1.dbf') size 50m ;
alter database add logfile group 8
('/oracle/TGT/origlogB/log_g8m1.dbf') size 50m ;
alter database add logfile group 9
('/oracle/TGT/origlogA/log_g9m1.dbf') size 50m ;
alter database add logfile group 10
('/oracle/TGT/origlogB/log_g10m1.dbf') size 50m ;
alter database add logfile group 11
('/oracle/TGT/origlogA/log_g11m1.dbf') size 50m ;
alter database add logfile group 12
('/oracle/TGT/origlogB/log_g12m1.dbf') size 50m ;

Mirror logs

ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogA/log_g1m2.dbf'
TO GROUP 1;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogB/log_g2m2.dbf'
TO GROUP 2;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogA/log_g3m2.dbf'
TO GROUP 3 ;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogB/log_g4m2.dbf'
TO GROUP 4 ;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogA/log_g5m2.dbf'
TO GROUP 5 ;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogB/log_g6m2.dbf'
TO GROUP 6 ;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogA/log_g7m2.dbf'
TO GROUP 7 ;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogB/log_g8m2.dbf'

All Rights Reserved.
Copyright 2001-2002. Page 9 of 9
Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant

TO GROUP 8 ;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogA/log_g9m2.dbf'
TO GROUP 9;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogB/log_g10m2.dbf'
TO GROUP 10;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogA/log_g11m2.dbf'
TO GROUP 11;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/TGT/mirrlogB/log_g12m2.dbf'
TO GROUP 12;

To check status of logs, do:

select * from v$log ;

To check status of members, do:

select * from v$logfile ;

NB. Never do any work on the current group switch to another group first with

alter system switch logfile ;

If this fails, do;

archive log next;

to send cycled redo log to archive.

Appendix 3 - Rdist

BASIC RDIST GUIDE

NB: In this document it is assumed that SORCE is the source server and TARGET the destination.

To obtain local IP details:

SORCE_# grep 362 /etc/hosts
159.244.138.53 SORCE IMX018 SORCE.ps.u1295.unilever.com
50.50.52.53 SORCE-bck

Source SORCE needs IP address of destination TARGET (use the bck address for backup lan) in its
/etc/hosts.

Destination TARGET needs IP address of source SORCE (use the bck address for backup lan) in its
/etc/hosts and an entry in its .rhosts (in roots home directory), to the effect:

SORCE root

This should be removed after the rdist.


All Rights Reserved.
Copyright 2001-2002. Page 10 of 10
The rdist command is run from root on source SORCE. The following example uses a prepared
instruction file, distfile3, which specifies the data to be copied. (Data does not have to be a mountpoint
or even a whole directory individual files could be specified):

Type Handbook Document
Area SAP Basis
Topic Cross Server Restore

Author Basis Consultant

rdist -f distfile3

Here is an example of distfile3:
OSTS = (TARGET) H
FILES = (/sapcd45 /usr/sap/TGT/trans)

${FILES} -> ${HOSTS} install -y;
except /mii/docs

In distfile3, different data areas are separated by spaces, and exceptions are specified using the
ries on SORCE specified in distfile3 must exist on destination TARGET, so

except command.
The source directo
ensure they are there on the latter using symbolic links if necessary.




All Rights Reserved.
Copyright 2001-2002. Page 11 of 11

Potrebbero piacerti anche