Moving SAP Database Files to New Disks

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 a new disk to an existing RAID array.
Some RAID controllers allow you to add a disk online. However, normally, you have to recreate the RAID system to include the new disk. To do this, you first have to backup the existing database, then re-create the RAID system and, in a final step, restore the database. When the array has been re-created, the additional space on the new disk will be accessible for the operating system and can be utilized by the SQL Server.

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

·        If an existing RAID system cannot be extended, you have to add an entire new disk array to your system. In this case, it is necessary to first configure the new array as an NTFS partition. Then existing SAP database files have to be moved to the new disk in a process that involves detaching and re-attaching the database from the SQL Server.

The following describes the procedure for moving files to a new disk array. It assumes that you have already configured the array 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 Enterprise Manager select the <SAPSID> database and choose Action ® All Tasks ® Detach Database.

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 Enterprise Manager when the display has been refreshed.

       4.      Switch to the Windows Explorer and copy the SAP database files to the newly configured disk drive as required.

       5.      In the Enterprise Manager, expand the server, select Databases and choose Action ® All Tasks ® Attach Database.

The Attach Database dialog box appears.

       6.      Specify the mdffile of the <SAPSID> database. You can click the button beside the dropdown box to browse for the file.

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

       7.      If any of the files in the list are marked with a red cross, enter the correct location.

       8.      Choose OK to attach the database.

The SAP database reappears in the database list of the Enterprise Manager and is again visible and accessible for the SQL Server. The SQL Server can now use the newly configured disk array.

Alternatively to using options in the Enterprise Manger, you can detach and attach the database by running stored procedures in the Query Analyzer.

To detach the database enter:
sp_attach_db <SAPSID>, '<filename>', '<filename>'...

To attach the database enter:

sp_attach_db PRD, 'D:\PRDDATA1\PRDDATA1.mdf', 'N:\PRDDATA2\PRDDATA2.ndf', 'N:\PRDDATA3\PRDDATA3.ndf', 'L:\PRDLOG1\PRDLOG1.ldf'