--BACKUP
BACKUP DATABASE test TO DISK = 'G:\test.BAK'
--RESTORE
RESTORE DATABASE test1
FROM DISK='G:\test.BAK'
WITH MOVE 'test_data' TO 'G:\sqldata\test1_data.mdf',
MOVE 'test_log' TO 'L:\test1_log.ldf', REPLACE
GO
ALTER DATABASE test1
MODIFY FILE (NAME = 'test_data', NEWNAME = 'test1_data')
GO
ALTER DATABASE test1
MODIFY FILE (NAME = 'test_log', NEWNAME = 'test1_log')
GO
RESTORE DATABASE Test1
FROM DISK = 'c:\TEST.bak'
WITH MOVE 'Test' TO 'c:\test\test1.mdf',
MOVE 'Test1_log' TO 'c:\test\test1.ldf'