MSSQL_SERVER
期待着2013
个人一直做数据库方面的工作
展开
-
SQL_SERVER 解锁
查看被锁表: select spId from master..SysProcesses where db_Name(dbID) = '数据库名称' and spId <> @@SpId and dbID <> 0 解除锁: exec ('Kill '+cast(@spid as varchar)) 查看被锁表 select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tabl原创 2020-07-15 17:20:28 · 220 阅读 · 0 评论 -
sql_server 维护
https://ola.hallengren.com/原创 2020-07-15 14:32:09 · 151 阅读 · 0 评论 -
查看SQLSERVER数据库收缩进度
--查询当前数据库备份进度 SELECTDB_NAME(er.[database_id]) [DatabaseName],er.[command] AS [CommandType],er.[percent_complete] ,er.start_time,CONVERT(DECIMAL(5, 2) , er.[percent_complete]) AS [Complete_Percent...原创 2020-05-05 08:37:47 · 2071 阅读 · 0 评论 -
SQL_SERVER Lockrequesttimeoutperiodexceeded MicrosoftSQLServer,错误:1222
Lockrequesttimeoutperiodexceeded.(MicrosoftSQLServer,错误:1222) (2018-05-08 17:46:30) 转载▼ select * from master..SysProcesses where db_Name(dbID) = 'DM_CRS' and spId &...转载 2020-03-13 14:08:51 · 813 阅读 · 0 评论 -
sql_server2016全备脚本
declare @bak_sql varchar(2000) set @bak_sql ='BACKUP DATABASE '+'['+'db_name'+']'+' TO DISK = N'+''''+'F:\db_bak\db_name\db_name_fullbak'+ convert(varchar, getdate(), 112) +replace(convert(varchar,g...原创 2019-04-16 19:33:48 · 315 阅读 · 0 评论 -
MSSQL_server 创建只读帐号
--创建登陆帐户(create login) create login sp_read with password='sp_password', default_database=master --为登陆账户创建数据库用户(create user),在mydb数据库中的security中的user下可以找到新创建sp_read create user sp_read for logi原创 2017-11-21 15:27:35 · 1288 阅读 · 1 评论