Copy database via backup and restore
2016-03-10 11:20
477 查看
When copying the database using wizard in SQL server is failed, I use the following method to copy the database successfully.
the logical names are for the data files, that can be used with the
to restore the database to a new location.
http://stackoverflow.com/questions/1360529/how-do-you-backup-and-restore-a-database-as-a-copy-on-the-same-server?lq=1
--backup the database backup database test1 to disk='c:\test1_full.bak' -- use the filelistonly command to work out what the logical names -- are to use in the MOVE commands. the logical name needs to -- stay the same, the physical name can change restore filelistonly from disk='c:\test1_full.bak' -------------------------------------------------- | LogicalName | PhysicalName | -------------------------------------------------- | test1 | C:\mssql\data\test1.mdf | | test1_log | C:\mssql\data\test1_log.ldf | ------------------------------------------------- restore database test2 from disk='c:\test1_full.bak' with move 'test1' to 'C:\mssql\data\test2.mdf', move 'test1_log' to 'C:\mssql\data\test2.ldf'
RESTORE FILELISTONLYis an informational command and is not required to perform a restore. A user can use this to figure out what
the logical names are for the data files, that can be used with the
MOVEcommands
to restore the database to a new location.
http://stackoverflow.com/questions/1360529/how-do-you-backup-and-restore-a-database-as-a-copy-on-the-same-server?lq=1
相关文章推荐
- mysql database manual(mysql数据库手册)
- CodeIgniter配置之database.php用法实例分析
- 什么是DAO Database Access Object
- Oracle创建Database Link的两种方式详解
- 在数据库‘master’中拒绝CREATE DATABASE权限问题的解决方法
- Sample script that deletes a SQL Server database
- linux whatis与whatis database 使用及查询方法(man使用实例)
- Oracle DATABASE LINK(DBLINK)创建与删除方法
- 用MyEclipse配置DataBase Explorer(图示)
- 11. Laravel 4 结构生成器 Schema
- jfinal-flyway 数据脚本升级插件,伴随应用的升级自动升级或回滚数据库
- 使用flyway-maven-plugin,执行数据库初始化sql文件,和sql数据库升级
- 如何用Go语言打造一个高性能MySQL Proxy
- 基于spark1.3.1的spark-sql实战-01
- 聊聊数据权限哪些事儿
- python使用pyodbc,freetds连接azure数据库
- 【转】mysql ERROR 1049 (42000): Unknown database '******' ”错误处理办法
- MySQL机sqlserver注射和php注入
- 未处理sqlException解决办法
- zabbix安装配置