SQL Server network backup

Source: Internet
Author: User

 

 

 

SQL clearing Data Tables

Truncate table [tablename]
 

SQL reset primary key Seed

Dbcc checkident ([tbname], reseed, 0)

SQL Server network backup

To back up a database on the network to a local machine, you can use the following method:

Use Master
Go
-- MAP network drive

Exec XP_cmdShell 'net use z: http://www.cnblogs.com/moss_tan_jun/admin/file://garfield/temp "password"/user: garfield \ administrator'

Go

-- Backup database
Backup database pubs to disk = 'e: \ temp \ pubs. Bak'
Go

-- Copy backup
Exec xp_mongoshell 'Copy e: \ temp \ pubs. bak z: \ pubs. Bak'
Go

-- Delete backup
Exec XP_cmdShell 'del e: \ temp \ pubs. Bak'
Go

-- Delete network drive ing
Exec XP_cmdShell 'net use z:/delete'

Note: This method is mainly used to execute the command shell Stored Procedure xp_mongoshell in the master database. If the stored procedure is deleted or restricted, it cannot be completed. This also reminds us that, for database security, it is best to block this stored procedure.

It is also said on the network that the network drive can be backed up directly after ing, such as backup database pubs to disk = 'z: \ pubs. bak '.

 

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.