Using SMO to copy a database and data

后端 未结 4 1020
陌清茗
陌清茗 2021-01-31 18:49

I am trying to make a copy of a database to a new database on the same server. The server is my local computer running SQL 2008 Express under Windows XP. Doing this should be q

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 19:21

    Try setting SetDefaultInitFields to true on the Server object.

    I had the same issue with the SMO database object running slowly. I guess this is because sql server doesn't like to retrieve entire objects and collections at once, instead lazy loading everything, causing a round-trip for each field, which for an entire database is pretty inefficient.

提交回复
热议问题