Back up
1,右鍵選中須要備份的數據庫,Tasks-->Backupsql
2.General中,Destination,先remove掉以前的,而後再Add數據庫
須要注意的是,add的文件,必需要以.bak爲後綴名,不然後面restore的話,不會顯示出備份的文件服務器
Restore
1.在數據庫服務器的Databases上右鍵,選擇Restore Databaseide
1.1 General選項卡post
1.1.1選擇Device進行瀏覽,找到以前備份的文件。在查看文件的時候,默認是查看.bak文件。 spa
不過也能夠選擇all files,那樣能夠看到全部的文件rest
1.1.2 General裏面,Destination中的Database須要起一個不一樣的名字,這個名字是顯示在ManagementStudio中的code
選擇路徑以後,點擊刷新的圖標,而後下方會自動篩選server
能夠同時添加多個備份數據庫,可是每個數據庫的restore plan是須要切換選項卡來進行獨立設置的blog
1.2 Files選項卡
在General中,每切換一個數據庫,Files選項卡中都須要獨立配置一下
Logical File中的Rows Data和Log,都須要進行重命名,確保不重名。Restored as 這個列的裏面的數據須要重命名
1.3 Options選項卡
取消勾選Tail-log backup
Restore failed
Restore failed
TITLE: Microsoft SQL Server Management Studio
------------------------------
Restore of database 'd_lisa_Program_dev01_v5000' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)
------------------------------
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The tail of the log for the database "d_lisa_Program_dev01_v5000" has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log. (Microsoft.SqlServer.SmoExtended)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=12.0.6024.0+((SQL14_PCU_Main).180907-0056)&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
https://stackoverflow.com/questions/12370944/the-tail-of-the-log-for-the-database-dbname-has-not-been-backed-up
The error message you are getting tells you exactly what you need to do if you don't care about the existing database or log.
RESTORE DATABASE DAtabaseName FROM DISK = 'C:\DBName-Full Database Backup' WITH REPLACE
In SQL Server Management Studio (Tasks > Restore), you can add the WITH REPLACE
option by opening the page "Options" on the left side and ticking "Overwrite the existing database".
官方文檔
https://msdn.microsoft.com/en-us/library/ms187510(v=sql.110).aspx 僅針對於SQL Server 2012
https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/create-a-full-database-backup-sql-server 針對於SQLServer 2016