×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

My suggestion.

When you restore one database from server A to server B, the user ID in the restored database should already exist on the server B prior to the restoration, otherwise it will cause some security conflict. To solve this problem,

1. Use the sql server built in utility to generate the scripts about the login Id on server A and apply it on server B, then restore the database to server B.
But the passwords won't be transferred to server B , which means you have to add the passwords manually if you want to keep them .

2. If you don't care the difference of the security between two servers, you may use DTS to transfer the data only .

3. use system stored procedure sp_change_users_login to map the login id with the user id in the database.
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 在A电脑上backup一个SQL7数据库,将此备份文件restore到B电脑的SQL上,数据库中的login user会与B电脑SQL中建立的同名login user冲突。何解?或如何在两台电脑间备份恢复数据库?
    • 备份的数据库里会有login吗?
    • I am not sure about SQL Server, but same thing happened in Oracle usually lies in that the account has already some schema or data table in it.
      • 是啊,同一个server数据备份恢复自然没问题。不同server间相互进行备份就出现这个问题。可是,如果一个server彻底crash了,重新安装的server就不能把备份数据库装上了???
    • My suggestion.
      When you restore one database from server A to server B, the user ID in the restored database should already exist on the server B prior to the restoration, otherwise it will cause some security conflict. To solve this problem,

      1. Use the sql server built in utility to generate the scripts about the login Id on server A and apply it on server B, then restore the database to server B.
      But the passwords won't be transferred to server B , which means you have to add the passwords manually if you want to keep them .

      2. If you don't care the difference of the security between two servers, you may use DTS to transfer the data only .

      3. use system stored procedure sp_change_users_login to map the login id with the user id in the database.
      • 多谢。你的方法我一定会尝试。里面是对我的问题的简略表述,希望你看了能提出更多建议。
        1,此方法我一定要试,看起来好像能解决问题。
        2,你是指在B中import table from A?有两个问题,数据属性有变,例如talble里的缺省值居然不能传递,另外user procedures不能传递。
        3,在B中建立映射?不知道这样能否保证系统完整性?

        我的目的是做两套完全一样的整合了SQL数据库的web系统,手工地做成双机备份。因此要求两套系统的web内容,ODBC,SQL等必须绝
        对相同。
        在从live主机向backup主机传递SQL数据时,发现以上问题,原来一直
        是手工维护完整性的。现在希望能找到更professional的方案。
        • My suggestion again.
          When using DTS to move the data between two servers, please select the option "transferring objects (not just tables)", which will import both the data and the schema.

          The system stored procedure I mentioned is to map the login ID and the database user Id.

          If you want to set up the second server which is the standby one for the live server, you have two options:
          1)Replication.
          2)Log shipping.

          Both of them can synchronize two servers automatically with some specified delay.

          Thanks.
          • 同步数据库的建议很好。我准备用。DTS选择传送objects时从未成功过,总是报错,而且传送的tables不完整,丢失了缺省值,SQL居然还报告成功传送。
    • 我想你是不是应该也需要把MASTER数据也DUMP/RESTORE一下 ?