如何设置sql server2005的数据库系统时间:

--修改前时间
 select getdate()

--打开高级系统控制选项
EXEC master.dbo.sp_configure 'show advanced options', 1 RECONFIGURE

--修改执行权限,这样就可以执行修改时间的命令了
EXEC master.dbo.sp_configure 'xp_cmdshell', 1 RECONFIGURE

--修改系统时间
--exec master..xp_cmdshell 'date 2008-10-23'
exec master..xp_cmdshell 'time 11:30:15'

--修改后时间
select getdate()

--与数据库所在计算机的时间同步
exec master.dbo.xp_cmdshell 'net time \\localhost /set  /Y' 

--同步后时间
select getdate() 

要主意,修改系统时间的时候,会连sql server所在计算机的时间一起修改了,所以如果想要变回准确的时间,需要先用计算机的时间同步更新功能更新一下时间,然后在把sql server的时间和计算机时间同步. 但反过来,如果用双击时间出现的"日期和时间属性面板"中修改了计算机时间,是不会修改到sql server时间的

 

posted on 2009-03-16 11:36 aisoft 阅读(2005) 评论(0)  编辑  收藏 所属分类: 系统维护

只有注册用户登录后才能发表评论。


网站导航:
 
<2024年3月>
252627282912
3456789
10111213141516
17181920212223
24252627282930
31123456

随笔档案(2)

文章分类(12)

文章档案(12)

收藏夹

搜索

  •  

最新评论