Move the SQL .mdf and .ldf files to another location


ALTER DATABASE DB
MODIFY FILE (name='DB_FILE', filename='E:\SQL\DB.mdf');

Set the database offline


ALTER DATABASE DB SET OFFLINE WITH ROLLBACK IMMEDIATE;

Bring the database online


ALTER DATABASE DB SET ONLINE;