Sumber Kode

Restore and Backup Database MSSQL Using Query

  • anonymous
  • Jul 31' 13
  • SQL
  • 1068
  • 9
  • United States

Database that has been in the full backup can be restored using 2 stages as below:

Step 1: See the logical file name of the database backup file.

RESTORE FILELISTONLY
FROM DISK='D:\BackuFileName.BAK'
Go

Step 2 :Use the logical name in the database to be used in the second stage.

Make Database to mode user single

ALTER DATABASE DatabaseName
SET SINGLE_USER 
WITH ROLLBACK IMMEDIATE

Restore Database

RESTORE DATABASE DatabaseName
FROM DISK = 'D:\DatabaseFileBackup.BAK'
WITH MOVE 'NameMDFLogicalFile' TO 'LocationFileMDF.MDF',
MOVE 'NameLDFDatabase' TO 'LocationFileLDF.LDF'

If an error occurs change to multi-user
ALTER DATABASE YourDB SET MULTI_USER
GO
Happy try :)

Share

  • Tags :
comments powered by Disqus

Kode Terkait

SQL Database backup using Query

Piramida bintang rata kanan

Program design Pot

Program piramida bintang rata kiri bawah

Piramida bintang rata kanan bawah

Piramida bintang bawah

Bintang piramida atas

Bintang piramida rata kiri

Program bintang piramida Love

Program Berat Badan



Kategori