SQL script file is too large to restore the database

Source: Internet
Author: User

SQL script too large directly in the database execution will prompt out of memory, we look at the generated script file will find that every 100 will have a go to separate, this is enough to say

After I have generated a script file Db.sql the structure of the database together with the data, I want to restore the database on another computer for programming testing. However, when I tried to execute the script on SQL Server Manager Studio, the other side told me that the file was too large to open. After a search, it is found that the following statements can be used by the command line, you can easily solve the problem. Note that if the script is too large, you can turn off the STDERR message to speed up execution.

Osql-u Sa-p-S (local) \sqlexpress-d trw-r-I Db.sql

Where SQLExpress is my local database server, TRW is the database name, and Db.sql is my script file. The command parameters for the osql tool are as follows:

osql [-u login ID] [-p password]
[-s server]           [-H host name] [-E Trusted Connection]
[-D using Database name]      [-L login Timeout value] [-t query timeout value]
[-H title]         [-S column delimiter] [-w Column Width]
[-A packet size]         [-e echo input] [-I allow quoted identifiers]
[-l list Servers]         [-C command end] [-D ODBC DSN name]
[-Q "Command-line query"] [-Q ' command-line query ' and exit]
[-N Delete Numbering method] [-m error level]
[-R message sent to STDERR] [-V Severity level]
[-I input file] [-O Output FILE]
[-P print statistics] [-B Abort batch On ERROR]
[-x[1] Disable command, [exit with warning]]
[-o Disable the following using the old ISQL behavior]
Batch Processing
Automatically adjust console width
Wide Message
Default error level is-1 and 1

Use command-line CMD to navigate to the script file storage path First

SQL script file is too large to restore the database

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.