Use sqlcmd, osql, and iSQL backup and restoration of sqlserver

Source: Internet
Author: User
Tags sql server books

Use sqlcmd, osql, and iSQL backup and restoration of sqlserver

-- Sqlcmd, new sql2005 Tool
1. Backup
"C:/program files/Microsoft SQL Server/90/tools/binn/sqlcmd. EXE "-S. /sqlexpress-U sa-P 000000-D master-Q "backup database test to disk = 'C:/AA/AAA. bak '"

The database 'test' and the file 'test' (located on file 2) processed page 176.
The database is 'test', and the file 'test _ log' (located on file 2) processes one page.
The backup database successfully processes 177 pages and takes 1.207 seconds (1.201 MB/second ).

2. Restore
"C:/program files/Microsoft SQL Server/90/tools/binn/sqlcmd. EXE "-S. /sqlexpress-U sa-P 000000-D master-Q "Restore database test from disk = 'C:/AA/AAA. bak '"

3. Help
C:/Documents and Settings/xuysh> "C:/program files/Microsoft SQL Server/90/tools/
Binn/sqlcmd. EXE "-?
Microsoft (r) SQL server command line tool
Version 9.00.1399.06 nt Intel x86
Copyright (c) Microsoft Corporation. All rights reserved.

Usage: sqlcmd [-u logon id] [-P Password]
[-S server] [-H host name] [-e trusted connection]
[-D use the database name] [-l logon timeout value] [-T query timeout value]
[-H title] [-s column separator] [-W screen width]
[-A packet size] [-e echo input] [-I allows a quoted identifier]
[-C command end] [-L [c] list servers [clear output]
[-Q "command line query"] [-Q "command line query" and exit]
[-M error level] [-V severity level] [-W deleting trailing spaces]
[-U Unicode output] [-R [0 | 1] Message sent to stderr]
[-I input file] [-O output file] [-Z New Password]
[-F <code page> | I: <code page> [, O: <code page>] [-Z: Create a password and exit]
[-K [1 | 2] Delete [Replace] control character]
[-Y variable length type display width]
[-Y fixed length type display width]
[-P [1] print statistics [colon format]
[-R use client region settings]
[-B abort batch processing when an error occurs]
[-V variable = "value"...] [-a dedicated management connection]
[-X [1] disabling commands, startup scripts, and environment variables [and exiting]
[-X variable disabling]
[-? Show syntax Summary]

 

-- Both osql SQL2000 and sql2005 have
-- 1. Backup
"C:/program files/Microsoft SQL Server/90/tools/binn/osql. EXE "-S. /sqlexpress-U sa-P 000000-D master-Q "backup database test to disk = 'C:/AA/AAA. bak '"

The database 'test' and the file 'test' (located on file 3) processed page 176.
The database is 'test', and the file 'test _ log' (located on file 3) processes one page.
The backup database successfully processes 177 pages and takes 0.531 seconds (2.730 MB/second ).

2. Restore
"C:/program files/Microsoft SQL Server/90/tools/binn/osql. EXE "-S. /sqlexpress-U sa-P 000000-D master-Q "Restore database test from disk = 'C:/AA/AAA. bak '"

The database 'test' and the file 'test' (located on file 1) have processed page 176.
The database 'test' and the file 'test _ log' (located on file 1) are processed on two pages.
The Restore database successfully processes 178 pages and takes 0.200 seconds (7.255 MB/second ).

3. Help
C:/Documents and Settings/xuysh> "C:/program files/Microsoft SQL Server/90/tools/
Binn/osql. EXE "/?
Microsoft (r) SQL server command line tool
Version 9.00.1399.06 nt Intel x86
Copyright (c) Microsoft Corporation. All rights reserved.

Note: osql does not support all functions of SQL Server 2005.
Use sqlcmd. For more information, see SQL Server books online.

Usage: osql [-u logon id] [-P Password]
[-S server] [-H host name] [-e trusted connection]
[-D use the database name] [-l logon timeout value] [-T query timeout value]
[-H title] [-s column separator] [-W column width]
[-A packet size] [-e echo input] [-I allows a quoted identifier]
[-L list servers] [-C command end] [-d odbc dsn name]
[-Q "command line query"] [-Q "command line query" and exit]
[-N delete number method] [-M error level]
[-R messages sent to stderr] [-V severity level]
[-I input file] [-O output file]
[-P print statistics] [abort batch processing when a-B error occurs]
[-X [1] disable command, [display a warning when exiting]
[-O use the old iSQL to disable the following items]
<EOF> Batch Processing
Auto Adjust console width
Wide message
The default error levels are-1 and 1.
[-? Show syntax Summary]

 

-- ISQL, SQL2000 tool, not in 2005
-- 1. Backup
"C:/program files/Microsoft SQL Server/80/tools/binn/iSQL. EXE "-S. /sqlexpress-U sa-P 000000-D master-Q "backup database test to disk = 'C:/AA/AAA. bak '"

The database 'test' and the file 'test' (located on file 3) processed page 176.
The database is 'test', and the file 'test _ log' (located on file 3) processes one page.
The backup database successfully processes 177 pages and takes 0.531 seconds (2.730 MB/second ).

2. Restore
"C:/program files/Microsoft SQL Server/80/tools/binn/iSQL. EXE "-S. /sqlexpress-U sa-P 000000-D master-Q "Restore database test from disk = 'C:/AA/AAA. bak '"

The database 'test' and the file 'test' (located on file 1) have processed page 176.
The database 'test' and the file 'test _ log' (located on file 1) are processed on two pages.
The Restore database successfully processes 178 pages and takes 0.200 seconds (7.255 MB/second ).

3. Help
Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:/Documents and Settings/xuysh> "C:/program files/Microsoft SQL Server/80/tools/
Binn/iSQL. EXE "/?
ISQL: Unknown option?
Usage: iSQL [-u Login ID] [-P Password]
[-S server] [-H hostname] [-e trusted connection]
[-D use database name] [-l login timeout] [-T query timeout]
[-H headers] [-s colseparator] [-W columnwidth]
[-A packetsize] [-e echo input] [-x max text size]
[-L list servers] [-C cmdend]
[-Q "Explain line query"] [-Q "Explain line query" and exit]
[-N remove numbering] [-M errorlevel]
[-R msgs to stderr]
[-I inputfile] [-O outputfile]
[-P print statistics] [-B on error batch abort]
[-O use old iSQL behavior disables the following]
<EOF> Batch Processing
Auto console width Scaling
Wide messages
Default errorlevel is-1 vs 1
[-? Show syntax Summary (this screen)]

 

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.