1. 先执行RESTORE FILELISTONLY FROM DISK = ‘C:\Users\min\Desktop\2000wbak\shifenzheng.bak’, 得到了备份中的数据文件和日志文件的逻辑名称,分别是linshi和linshi_log。

2. 创建一个新的数据库SFZ,记下新数据库的数据文件和日志文件的物理地址。

3. 然后运行下面的命令,把bak文件恢复到新建的数据库:
RESTORE DATABASE SFZ FROM DISK = ‘C:\Users\min\Desktop\2000wbak\shifenzheng.bak’ with replace, move ‘linshi’ to ‘C:\Users\min\AppData\Local\Microsoft\VisualStudio\SSDT\sfz.mdf’, move ‘linshi_log’ to ‘C:\Users\min\AppData\Local\Microsoft\VisualStudio\SSDT\sfz.ldf’

4. 在姓名和身份证上建立索引:
create index ix_ctfid on cdsgus (ctfid)
create index ix_name on cdsgus (name)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.