Home
- Details
- Written by: po3dno
- Category: MSSQL
- Hits: 838
DBCC UPDATEUSAGE (0)
create table #t(name varchar(255), row varchar(255), reserved varchar(255), data varchar(255), inxex_size varchar(255), unused varchar(255))
insert into #t
exec sp_msforeachtable N'exec sp_spaceused ''?'''
select * from #t
drop table #t
- Details
- Written by: po3dno
- Category: Other
- Hits: 881
Reg add “\\computername\HKLM\SYSTEM\CurentControlSet\Control\Terminal Server” /v fDenyTSConnections /t REG_DWORD /d 0 /f
- Details
- Written by: po3dno
- Category: MSSQL
- Hits: 949
Источник:
http://support.microsoft.com/kb/918992
- На сервере A запустите SQL Server Management Studio и подключитесь к экземпляру SQL Server, из которого перемещена база данных.
- Details
- Written by: po3dno
- Category: MSSQL
- Hits: 880
SELECT DBS.Name, AGS.AvailabilityGroupName, AGS.PrimaryReplicaServerName
FROM sys.databases DBS
LEFT JOIN
(SELECT
dbcs.database_name AS [DatabaseName],
AG.name AS [AvailabilityGroupName],
agstates.primary_replica AS [PrimaryReplicaServerName]
FROM master.sys.availability_groups AS AG
LEFT OUTER JOIN master.sys.dm_hadr_availability_group_states as agstates
ON AG.group_id = agstates.group_id
INNER JOIN master.sys.availability_replicas AS AR
ON AG.group_id = AR.group_id
INNER JOIN master.sys.dm_hadr_availability_replica_states AS arstates
ON AR.replica_id = arstates.replica_id AND arstates.is_local = 1
INNER JOIN master.sys.dm_hadr_database_replica_cluster_states AS dbcs
ON arstates.replica_id = dbcs.replica_id
LEFT OUTER JOIN master.sys.dm_hadr_database_replica_states AS dbrs
ON dbcs.replica_id = dbrs.replica_id AND dbcs.group_database_id = dbrs.group_database_id
) as AGS
ON DBS.name = AGS.DatabaseName
Order by DBS.name
- Details
- Written by: po3dno
- Category: MSSQL
- Hits: 834
SELECT OBJECT_NAME(id) table_name, rows FROM sysindexes WHERE indid IN (0,1) order by rows desc