Show TOC

Moving SAP Database Files to New DisksLocate this document in the navigation structure

Use

If your SAP database or log files are running out of disk space, you have to add new disks to the file system. Depending on the disk configuration currently in use, two different approaches are possible:

  • You might be able to add new disks to an existing device, (RAID array, SAN or NAS storage, etc.)

    Some systems allow you to add disks online. If this is not possible, you first have to backup the existing database, then re-create the device and, in a final step, restore the database. When the device has been re-created, the additional space on the new disks is accessible for the operating system and can be used by the SQL Server.

    For instructions on how to reconfigure your devices to include new disks, refer to the documentation provided by your disk vendor.

  • If an existing device cannot be extended, you have to add an entire new device to your system. In this case, you first have to configure the new device as an NTFS partition. Then you have to move existing SAP database files have to the new device by detaching from and re-attaching the database to the SQL Server.

The following describes the procedure for moving files to a new disk device. It assumes that you have already configured the device as an NTFS partition according to the instructions provided by the disk vendor.

Procedure

  1. Before you begin with the procedure it is strongly recommended that you back up the <SAPSID> and master database.
  2. In the SQL Server Management Studio right-click the <SAPSID> database and choose Tasks → Detach…..

    The Detach Database dialog box appears.

  3. Choose OK to detach the database.

    The SAP database is detached from the SQL Server and is no longer visible in the SQL Server Management Studio.

  4. Switch to the Windows Explorer and copy the SAP database files to the newly configured disk device as required.
  5. In the SQL Server Management Studio, expand the server, right-click Databases and choose Attach….

    The Attach Database dialog box appears.

  6. Specify the mdf file of the <SAPSID> database by choosing the Add button.

    All the files belonging to the <SAPSID> database are listed under Original File Name.

  7. If for any of the files the Message column shows 'Not found', enter the correct location.
  8. Choose OK to attach the database.

    The SAP database reappears in the database list of the SQL Server Management Studio and is again visible and accessible for the SQL Server. The SQL Server can now use the newly configured disk device.

    Note

    Alternatively to using the graphical interface of the SQL Server Management Studio, you can detach and attach the database by running stored procedures in a query window.

    To detach the database enter:sp_detach_db <SAPSID>

    To attach the database enter:

    sp_attach_db <SAPSID>, '<full path to and name of the MDF file>', '<full path to and name of the next datafile (NDF)>', '<etc>', '<full path to and name of the log file (LDF)>'