오늘 무엇을 도와드릴까요?

How to restore a database using TSQL commands

Issue
For use when a database needs to be restored via TSQL instead of via the graphical interface in SQL Server Management Studio.

Produce Line
Microsoft SQL Server

Environment
Microsoft SQL Server 2005
Microsoft SQL Server 2008
Microsoft SQL Server 2008 R2
Microsoft SQL Server 2012
Microsoft SQL Server 2012 R2

Cause
A database needs to be restored using the SQL Server Management Studio, but standard restore option is not functioning.

Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by
users familiar with SQL Server Management Studio. Databases should be backed up prior to
performing this procedure.*


The following query can be used to restore a database.

---------------------------------
Use Master
Go
RESTORE DATABASE YourDB
FROM DISK = 'C:\YourBackUpFile.bak'
WITH MOVE 'YourMDFLogicalName' TO 'D:\Data\YourMDFFile.mdf',
MOVE 'YourLDFLogicalName' TO 'D:\Data\YourLDFFile.ldf'
---------------------------------

YourDB -> The name of the database inside SQL Server. Examples are "ION_Data" or "SMS_System".

YourBackUpFile -> This will be the full path of the BAK file you are looking to restore.

YourMDFLogicalName -> The logical name of the database container (MDF file) must be known. To determine this information, open SQL Server Management Studio and connect to the instance the original database is attached to (this will be the database that was backed up to create the BAK file). Right-click on the database and select Properties>Files. There is a column named "Logical Name" that will provide the logical name of the database container. (See graphic below.)

YourMDFFile -> This is the path and file name of where you would like the MDF file to be located.

YourLDFLogicalName -> The logical name of the database transaction log (LDF file) must be known. To determine this information, open SQL Server Management Studio and connect to the instance the original database is attached to (this will be the database that was backed up to create the BAK file). Right-click on the database and select Properties>Files. There is a column named "Logical Name" that will provide the logical name of the database transaction log. (See graphic below.)

YourLDFFile -> This is the path and file name of where you would like the LDF file to be located.

How to restore a database using TSQL commands

슈나이더 일렉트릭 Korea

자세히 알아보기
제품군
자세히 알아보기
제품군

도움이 필요하신가요?

도움이 필요하신가요?

제품 선택기

제품 선택기

애플리케이션에 적합한 제품과 액세서리를 빠르고 쉽게 찾을 수 있습니다.

견적 받기

견적 받기

영업 관련하여 온라인으로 문의하시면 전문가가 연락드립니다.

구매처

구매처

해당 지역의 가장 가까운 슈나이더 일렉트릭 대리점을 쉽게 찾을 수 있습니다.

지원 센터

지원 센터

한 곳에서 모든 요구 사항에 대한 지원 리소스를 찾아보십시오.

  • 제품 문서
  • 소프트웨어 다운로드
  • 제품 선택기
  • 제품 대체 및 교체
  • 지원 및 연락처 센터
  • 영업소 검색
  • 견적 받기
  • 슈나이더 일렉트릭 커뮤니티
  • 채용
  • 회사 소개
  • 부정 행위 보고
  • 접근성
  • 뉴스룸
  • 투자자
  • Ecostruxure
  • 작업 검색
  • 블로그
  • 개인정보 취급방침
  • 쿠키 공지
  • 사용 약관
  • Change your cookie settings