Import .bak file to a database in SQL server

前端 未结 12 1772
悲哀的现实
悲哀的现实 2020-12-22 17:51

I have a file with .bak extension.

How can I import this date to a database in SQL Server?

12条回答
  •  萌比男神i
    2020-12-22 17:51

    You can use node package, if you often need to restore databases in development process.

    Install:

    npm install -g sql-bak-restore
    

    Usage:

    sql-bak-restore    
    

    Arguments:

    • bakpath, relative or absolute path to file
    • dbName, to which database to restore (!! database with this name will be deleted if exists !!)
    • oldDbName, database name (if you don't know, specify something and run, you will see available databases after run.)
    • owner, userName to make and give him db_owner privileges (password "1")

    !! sqlcmd command line utility should be in your PATH variable.

    https://github.com/vladimirbuskin/sql-bak-restore/

提交回复
热议问题