简体   繁体   中英

Convert .bak file into sql

I was export the database from SQL Server 2005, which is the format ".bak". I need to convert the .bak file into .sql file format. ie convert .bak file into SQL statements.

Because, i have a many bak files ( which are exported from various SQL Server versions). So, i need to convert the bak into sql.

Thanks in advance.

恢复备份,然后使用SQL发布向导将其编写为SQL语句。

Run the following command in your database environment, replace db_name with your database name, and change the paths accordingly.Hope it helps.

RESTORE DATABASE db_name
FROM DISK = '/home/ravi/Downloads/db_name.bak'
WITH MOVE 'db_name' TO '/var/opt/mssql/data/db_name.mdf',
MOVE 'db_name_log' TO '/var/opt/mssql/data/db_name.ldf'

restore database from .bak file. refer following link where generate script into sql file Get .sql file from SQL Server 2012 database

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM