Вы находитесь на странице: 1из 6

Type Handbook Document

Area SAP Basis


Topic System Copy on NT / MSSQL Platforms
Author Huseyin Bilgen

System Copy Guides

Volume 2

System Copy on NT/MSSQL Platforms

By

basisconsultant.com

All Rights Reserved.


Copyright 2001-2003.basisconsultant.com Page 1 of 1
Type Handbook Document
Area SAP Basis
Topic System Copy on NT / MSSQL Platforms
Author Huseyin Bilgen

Reasons for Copying a SAP System


SAP recommends that you make a system copy in order to build a test, demo, training or standby
system (Oracle and Informix: standby systems cannot be created with a system copy). You should
perform upgrades in a test system first. This way you can identify customer pecific problems which
might result from modifications. Thus, we can sort the general needs for a system copy as follow:

To create a new training system for end-user or project team education


To create a DEMO system
To create a Test system for upgrade or other purposes.
To recover a system on another machine with the same platform after a crash.
To copy large clients. If a client very large to export/import, it is better to do a system copy rather
than client transport.

If a system copy takes place between systems with same platform ( operating system and database
system ) , we call this HOMOGENEOUS SYSTEM COPY.

If The system copy takes place between systems with different platforms ( at least one of the
component must be different, OS or RDBMS ), we call this HETEROGENEOUS SYSTEM COPY.

System Copy on NT / MSSQL Platforms


An MSSQL database consists of a series of data and log files. R/3 databases obey certain rules in
their file structures:

Every data and log file is stored in a separate directory.


From the Systemid, the directory names set themselves together with the class of the directory
(DATA/LOG) and a number :

<SID>DATA (n = 1,2..) for data directories

<SID>LOG (n = 1,2..) for log directories

The names of the data files are composed of the directory name and the .mdf for the master data file
or .ndf for the additional data files. The master data file is generally located in <SID>DATA1. The
same applies to the log files: <SID>DATA.ldf.

Example:
The example database SRC consists of the data directories;
SRCDATA1 with master data file SRCDATA1.mdf
SRCDATA2 with secondary data file SRCDATA2.ndf

and the log directories;


SRCLOG1 with log file SRCLOG1.ldf

This guide is prepared for a Homogeneous System Copy using MSSQL Tools. Steps for this kind of
system copy are briefly as below:

Preparation of Target System


Stopping Source System and Preparing for Copy
Copying Data and Log Files to Target System.
Creating Target Database.
Starting Source and Target Systems.

Prerequisites
Following conditions must be provided to copy a system:

The target database can be located on the same server or on another machine.

All Rights Reserved.


Copyright 2001-2003.basisconsultant.com Page 2 of 2
Type Handbook Document
Area SAP Basis
Topic System Copy on NT / MSSQL Platforms
Author Huseyin Bilgen

The target database name can (in the case of the same server, it must) differ from the initial
database name.
Directory and file names should correspond to the R/3 nomenclature.
The directories <target SID>DATA and <target SID>LOG must be created.
Sufficient place must be available for the respective data/log files.

Procedure
1. Install MSSQL Server (Same Version as Source MSSQL Server) on Target System.
2. Install SP on Target System same as Source MSSQL SP level.
3. Install R/3 Central Instance on Target System.
4. Determine Source Database Structure. For this, use the following SQL command via Query
Analyzer:

use SRC
go
sp_helpfile

Output of this command will be as follow:

5. Create Data and Log directories on target system with the same or different name. For example,
in our example, we are going to copy SRC database on different machine with name TGT. So we
have to create following directories:

<DRIVE>:\TGTDATA1
<DRIVE>:\TGTDATA2
<DRIVE>:\TGTLOG1

You can create Data and Log directories different from source. For example you can create only 1
directory for all of the files as follow:

<DRIVE>:\TGTDB

or all Data's in one dir. And All Logs in one dir. as follow:

<DRIVE>:\TGTDATA
<DRIVE>:\TGTLOG

6. Stop Source R/3 System and Detach the Source Database for copying. The stored procedure
sp_detach_db separates a database from the SQL server. This corresponds to a deletion (Drop)
of the database without eliminating the respective files. The database can be attached again
later by means of sp_attach_db.
Connect yourself by means of the query analyzer as user sa. In the master database, carry out the
following command:

use master

All Rights Reserved.


Copyright 2001-2003.basisconsultant.com Page 3 of 3
Type Handbook Document
Area SAP Basis
Topic System Copy on NT / MSSQL Platforms
Author Huseyin Bilgen

sp_detach_db SRC, 'true'

The result of this command must be SUCCESSFULL as follow:

7. Copy Data and Log Files of SRC database on to the Target System into the corresponding target
directories. You can rename the file names for your Target Database.

Rename SRCDATA1.mdf TGTDATA1.mdf and copy to <DRIVE>:\TGTDATA1 directory.


Rename SRCDATA2.ndf TGTDATA2.ndf and copy to <DRIVE>:\TGTDATA1 directory.
Rename SRCLOG1.ldf TGTLOG1.ldf and copy to <DRIVE>:\TGTDATA1 directory.

8. Re-Attach Source Database by means of sp_attach_db, and the source database is made
available again. sp_attach_db expects the name of the database and a list of physical file names
(complete path names) as a parameter. The list must contain the master data file and all files
whose physical location or name were changed. Thus, for the source database, it is only required
to call sp_attach_db with the name of the outbound database and the complete path name of the
master data file.

9. Create Target Systems Database.The creation/attachment of the target database can be carried
out by means of sp_attach_db or CREATE DATABASE FOR ATTACH. Sp_attach_db supports
only up to 16 data/log files. Thus, if the database consists of more than 16 files, CREATE
DATABASE FOR ATTACH must be used for the reapplication. The FOR ATTACH option for the
CREATE DATABASE permits the generation of a database from a quantity of already existing
files. Analogously to sp_attach_db, the master data file and all files with changed physical
addresses must be entered. Unlike sp_attach_db, the logical names of the files can also be
specified.

use master
go
sp_attach_db @dbname= N'SRC',
@filename1 = N'c:\SRCDATA1\SRCDATA1.mdf',
@filename2 = N'c:\SRCDATA2\SRCDATA2.ndf',
@filename3 = N'c:\SRCLOG1\SRCLOG1.ldf'

The result of this command must be SUCCESSFULL.

All Rights Reserved.


Copyright 2001-2003.basisconsultant.com Page 4 of 4
Type Handbook Document
Area SAP Basis
Topic System Copy on NT / MSSQL Platforms
Author Huseyin Bilgen

10. Completing Post-Processings.


The reprocessing includes the creation of the Logins for the R/3 database (user sapr3 with SQL
server authentification for 3.* and 4.* systems, <sid>adm and SAPService<SID> with NT
authentification for 4.* systems), the licensing of the R/3 system, the correction of the database
(from the point of view of R/3), the configuration of the database, setting up the Backup/Update
statistics/... jobs for the database, the setup of the R/3 jobs, and so on.

If your Target System has no R/3 systems before this copy, then you have to complete SAP
Database Installation phases. You have to use DATABASE.R3S templete file for SAP Database
Instance installation. This file contains the following phases in 4.6C SR2. This file is usually same
in most releases. This ifle must be edited befure running with R3SETUP. Here all the phases.
Phases marked with BOLD-RED are not necessary and MUST NOT BE RUNNED. You have to
put "STATUS=OK" line at the end of all these phases by using R3EDIT, SAPPAD or NOTEPAD.

10=DATABASEINSTANCE_NT_MSS
20=DBCOMMONDBENV_NT_MSS
30=CALCRAM_NT_MSS
40=CDSERVERBASE_NT_MSS
50=OSGROUPSAPLOCAL_NT_IND
60=OSGROUPSAPLOCALADMIN_NT_IND
70=OSGROUPSAPGLOBAL_NT_IND
80=OSUSERSIDADM_NT_IND
90=OSUSERSIDADMPASSWD_NT_IND
100=OSUSERSIDADMRIGHTS_NT_IND
110=DBOSUSERMSSXP_NT_MSS
120=DBOSUSERMSSXPPASSWD_NT_MSS
130=GETDBSIZEKEYS_IND_IND
140=DBBUILDTEMPDB_NT_MSS
150=DBBUILD_NT_MSS
160=DBPOSTBUILD_NT_MSS
170=DBPRELOAD_NT_MSS
180=DBMULTISCHEMA_NT_MSS
190=DBDBSLTESTCONNECT_NT_IND
200=DBR3LOADEXECDUMMY_IND_IND
210=DBR3LOADEXEC_NT_MSS
220=DBR3LOADVIEWDUMMY_IND_IND
230=DBR3LOADVIEW_NT_IND
240=DBPOSTLOAD_NT_MSS
250=DBCONFIGURATION_NT_MSS
260=DBPROCEDURES_NT_MSS
270=DBR3LICENSECREATE_NT_MSS
280=DIPGNTAB_NT_IND
290=EXITMNLSSTARTR3_NT_IND
300=RFCRSWBOINI_IND_IND
310=RFCRADDBDIF_IND_IND
320=QUERIESFINISHED_NT_IND

All Rights Reserved.


Copyright 2001-2003.basisconsultant.com Page 5 of 5
Type Handbook Document
Area SAP Basis
Topic System Copy on NT / MSSQL Platforms
Author Huseyin Bilgen

After finishing Database Instance installation, you have get a new license and install onto Target
System.

Also goto SE06 and select "Database Copy or Migration" and execute "Postprocessing...".

After all, configure codepage and other settings such as default client, buffer params and so on.

11. You have completed copying an R/3 system running on NT / MSSQL platform.

All Rights Reserved.


Copyright 2001-2003.basisconsultant.com Page 6 of 6

Вам также может понравиться