• 数据库操作技巧


    //读出设备名字
    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
  • 相关阅读:
    Joda-Time 简介
    SimpleDateFormat 的线程安全问题
    SimpleDateFormat 的线程安全问题
    自定义类加载器
    自定义类加载器
    javap与 i++,++i
    javap与 i++,++i
    I/O模型
    I/O模型
    逻辑运算符(上) ---没用
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/796155.html
Copyright © 2020-2023  润新知