Register Login

Attach/Copy SAP Business One database into a new database.

Updated May 18, 2018

Solution Create a copy of SAP Business One database in the same SAP Business One Server. The database copy can be saved on the original database server or on a different server.

Two different methods can be used to solve the problem:

1. Backup the original database and restore it into a new database.

a) Backup the original database.

b) From the "Enterprise Manager" create a new database. Restore the backup into the new database you created.

c) Run SAP Business One.

d) From the "Choose Company" window, click the "Scan" pushbutton to display the new company database.

2. Copying the original database into a new database using the "Attach" function.

a) Stop all SQL users.

b) Stop SQL.

c) From the SQL Server database folder (the default is MSSQLDATA) copy the original database into a temporary folder. The database is represented by two files: "Databasename.mdf" and "databasename_log.ldf."

d) In the temporary folder, change the database name of both files into a new one ("newdatabasename.mdf" and "newdatabasename_log.ldf").

e) Copy both files from the temporary folder into the SQL Server database folder.

f) Start Microsoft SQL Server Service Manager.

g) Open the Enterprise Manager.

h) Expand the SQL Server Group.

i) Expand SAP Business One SQL Server.

j) Right click the "Databases" folder.

k) Select All Tasks => Attach.

l) Click the browse icon (...).

m) Select the "newdatabasename.mdf".

n) Click "OK".

o) In the "Current Files Location" field, change the original file name into the new database name. Make these changes to both MDF and LDF files.

p) In the field "Attach as", type the new database name .

q) Click "OK".

(NOTE: the Original file Names can not be change).

r) Run SAP Business One.

From "Choose Company" window,click the "Scan" pushbutton.

Creating a copy of SAP Business One database in a different SAP Business One Server. The steps mentioned above are relevant to this case except the points mentioned below:

    1. When using the backup and restore option, make sure you copy the original database backup into the new SAP Business One server.
    2. When using the "Attach" option, make sure you copy the MDF and LDF files into the new SAP Business One folder.
    3. You must not change the files names (unless a database with the same name as the original database name already exists).
    4. In the "Current Files Location", make sure that database path is compatible with the new SQL Server path. In case it is not, change it to the relevant path.
    5. After attaching the new database into the new server follow the steps asoutlined below:
      a) Expand the new database folder in the Enterprise Manager.
      b) Click the "Users" icon.
      c) Right click the "OBScommon" user (on the right-hand side of the window).
      d) Select "Delete".
      e) From the upper menu select "Action" => New Database User.
      f) In the "Login Name" field click on the drop down menu and select "OBScommon"
      g) In the "Permit In Database Role" list check the public and db_owner check box.