SQL Server database backup and Restoration

Source: Internet
Author: User
SQL Server restoration options:

-- Create a backup device
Sp_addumpdevice ' Disk ' , Jasonbak, ' C: \ Jason. Bak '
-- Backup
Backup   Database Northwind To Jasonbak
With Noinit -- (Additional, default when no parameter is added)
With Init -- (Rewrite the backup device content)
With Format -- (Re-format the backup device and use it)

-- Restore
Restore Filelistonly From Jasonbak
-- View the file list (only the first backup content can be seen)
Restore Headeronly From A]
-- View device content
Restore Verifyonly From A
-- Verification

 
Restore   Database Pubs From Jasonbak
Restore   Database Northwind From Jasonbak With   File = 2

Restore   Database Northwind From Jasonbak With Norecovery
Restore   Log Northwind From Jasonbak With   File = 2  


-- Changed to simple after modifying the recovery model, you must back up the database completely.
Backup   Database Northwind To Jasonbak With Format
-- Change back to full
Create   Table Jason2 (IDD Int )
Backup   Log Northwind To Jasonbak
Restore Verifyonly From Jasonbak
Drop   Database Northwind

Restore   Database Northwind From Jasonbak With Norecovery
Restore   Log Northwind From Jasonbak With   File = 2

-- Full backup NW
-- Create Table1, write down the time
-- Create Table2, write down the time
-- Backup log
-- Drop NW
-- Recover NW
-- Recover Table1, no Table2

Backup   Database Northwind To Jasonbak With Format
Create   Table Table1 (IDD Int ) -- 21.13.26
Create   Table Table2 (IDD Int ) -- 21.13.35
Backup   Log Northwind To Jasonbak
Restore Northwind From Jasonbak With Stopat = ""
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.