zoukankan      html  css  js  c++  java
  • sqlserver 2017 linux还原windows备份时的路径问题解决

    windows的备份由于路径问题,在Linux上会报错

    File 'YourDB_Product' cannot be restored to 'Z:Microsoft SQL ServerMSSQL11.GLOBALMSSQLDataYourDBYourDB_Product.ndf'. Use WITH MOVE to identify a valid location for the file.
    Msg 5133, Level 16, State 1, Server servername, Line 1
    Directory lookup for the file "Z:Microsoft SQL ServerMSSQL11.GLOBALMSSQLDataYourDBYourDB_Product.ndf" failed with the operating system error 2(The system cannot find the file specified.).

    此时需要设置还原后的文件存储路径,如下:

    RESTORE FILELISTONLY FROM DISK = '/var/opt/mssql/backup/YourDB.bak'
    GO
    
    LogicalName         PhysicalName                                                                 ..............
    ----------------------------------------------------------------------------------------------------------------------
    YourDB              Z:Microsoft SQL ServerMSSQL11.GLOBALMSSQLDataYourDBYourDB.mdf          ..............
    YourDB_Product      Z:Microsoft SQL ServerMSSQL11.GLOBALMSSQLDataYourDBYourDB_Product.ndf  ..............
    YourDB_Customer     Z:Microsoft SQL ServerMSSQL11.GLOBALMSSQLDataYourDBYourDB_Customer.ndf ..............
    YourDB_log          Z:Microsoft SQL ServerMSSQL11.GLOBALMSSQLDataYourDBYourDB_Log.ldf      ..............
    
    You can use this list to create MOVE clauses for the additional files. In this example, the RESTORE DATABASE is:
    
    RESTORE DATABASE YourDB
    FROM DISK = '/var/opt/mssql/backup/YourDB.bak'
    WITH MOVE 'YourDB' TO '/var/opt/mssql/data/YourDB.mdf',
    MOVE 'YourDB_Product' TO '/var/opt/mssql/data/YourDB_Product.ndf',
    MOVE 'YourDB_Customer' TO '/var/opt/mssql/data/YourDB_Customer.ndf',
    MOVE 'YourDB_Log' TO '/var/opt/mssql/data/YourDB_Log.ldf'
    GO

    参考:

    https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-migrate-restore-database?view=sql-server-2017

  • 相关阅读:
    django 添加字段, migrate时候生成一个默认值
    django 开发经验
    GeoIP2-python
    一些好用的django模块
    ubuntu linux samba
    动画工作室
    以太坊dApp全栈开发教程(引言)
    社交网络去中心化已成趋势,读懂核心底层技术选择和路线
    CryptoCurrency Security Standard (CCSS)
    HARNESS THE POWER OF DISTRIBUTED STORAGE IPFS AND SWARM IN ETHEREUM BLOCKCHAIN APPLICATIONS
  • 原文地址:https://www.cnblogs.com/wswind/p/10410399.html
Copyright © 2011-2022 走看看