环境:
解决问题的步骤:
执行以下命令:
restore database [065266F14D20] from disk = 'C:\Users\rforte\AppData\Local\Temp\nSpekSqlServerBackups\065266F14D20.bak'
with norecovery,
move 'nSpekServer' to 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESSSP2\MSSQL\DATA\065266F14D20.mdf',
move 'nSpekServer_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESSSP2\MSSQL\DATA\065266F14D20.ldf'
restore log [065266F14D20] from disk = 'C:\Users\rforte\AppData\Local\Temp\nSpekSqlServerBackups\065266F14D20.bak' with recovery
我收到以下消息:
Processed 3072 pages for database '065266F14D20', file 'nSpekServer' on file 1.
Processed 4 pages for database '065266F14D20', file 'nSpekServer_log' on file 1.
RESTORE DATABASE successfully processed 3076 pages in 0.581 seconds (41.350 MB/sec).
Processed 0 pages for database '065266F14D20', file 'nSpekServer' on file 1.
Processed 4 pages for database '065266F14D20', file 'nSpekServer_log' on file 1.
RESTORE LOG successfully processed 4 pages in 0.024 seconds (1.037 MB/sec).
表明一切顺利。事实上,我可以看到新恢复的数据库。
我执行:
use [065266F14D20]
我收到以下错误:
服务器主管" nSpekUser"无法访问数据库 " 065266F14D20"在当前的安全背景下。
问题在于,此序列通常是在客户所在地的安装过程中执行的,该过程没有具有sysadmin权限的帐户且无法访问sa帐户。因此,安装无法正常进行。
问题: 如何使用db_creator权限但不使用sysadmin还原数据库,并将dbo设置为从中还原数据库的帐户?
谢谢