• 数据库操作技巧


    //读出设备名字
    restore FILELISTONLY  from disk='D:\temp\databak'

    //还原数据库
    restore database singlepos from disk='D:\temp\databak'
    with move 'CHAIN_OL_DEV_Data' to 'E:\dev\single_data.mdf',
         move 'CHAIN_OL_DEV_Log' to 'E:\dev\single_log.ldf'


    --读出日志和数据文件
    RESTORE FILELISTONLY from disk='d:\lqbh.bak'
    --还原数据库
    restore database zybh from disk='d:\lqbh.bak'
    with move 'thbh_Data' to 'd:\MSSQL\zybh_data.mdf',
         move 'thbh_Log' to 'd:\MSSQL\zybh_log.ldf',
     move 'lqbh_1_Log' to 'd:\MSSQL\zybh_log_1.ldf'




     

    execute xp_shell 'nd d:\db'//新建文件夹


    //其他技巧
    //创建数据库
    create database jtms
    on primary (name='jtms_data',filename='F:\svn\工具\进销存\db\jtms_data.mdf')
    log on (name='jtms_log',filename='F:\svn\工具\进销存\db\jtms_log.ldf')
    //还原数据库
    restore database jtms from disk='F:\svn\工具\进销存\db\JTMS_2007-6-25'

    use master
    //分离数据库
    execute sp_detach_db jtms
    //附加数据库
    execute sp_attach_db 'jtms','F:\svn\工具\进销存\db\jtms_data.mdf','F:\svn\工具\进销存\db\jtms_log.ldf'

    ---------------------------------------------------

    //还原数据库
    create database sgmw
    on primary (name='sgmw_data',filename='/var/opt/mssql/data/sgmw_data.mdf')
    log on (name='sgmw_log',filename='/var/opt/mssql/data/sgmw_log.ldf')

    //查看备份文件信息
    RESTORE FILELISTONLY FROM DISK = '/var/opt/mssql/bak/sgmw.bak'

    //还原
    restore database sgmw from disk='/var/opt/mssql/bak/sgmw.bak'
    with move 'SGMW' to '/var/opt/mssql/data/sgmw_data.mdf',
    move 'SGMW_log' to '/var/opt/mssql/data/sgmw_log.ldf',STATS =10,REPLACE
  • 相关阅读:
    学习之spring属性文件注入
    学习之spring自带缓存
    FreeMarker语法
    spring mvc 拦截器
    spring mvc 全局异常处理
    spring mvc 多视图配置
    学习之spring注解DI疑惑
    @Transactional详解
    mybatis关联查询
    shiro 实现 用户 a 操作b 的权限 ,用户 b 能够及时获知。b不需要退出登陆 。 关闭鉴权缓存,或者不配置缓存
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/796155.html
Copyright © 2020-2023  润新知