takeown /F c:\Windows.old\* /R /A cacls c:\Windows.old\*.* /T /grant administrators:F rmdir /S /Q c:\Windows.old\ Zrodlo: https://social.technet.microsoft.com/Forums/windows/en-US/a88eca16-2cc6-421c-94fc-f444b9efa889/how-to-delete-windowsold-in-windows-7?forum=w7itproinstall
-
Usuniecie katalogu Windows.old po aktualizacji systemu
-
Rotacja logu błędów
sp_cycle_errorlog
-
Instalacja DLL do GAC w Windows Server 2012
Instalacja: Set-location "c:\Folder Path" [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") $publish = New-Object System.EnterpriseServices.Internal.Publish $publish.GacInstall("c:\Folder Path\DLL.dll") iisreset Kasowanie: Set-location "c:\Folder Path" [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") $publish = New-Object System.EnterpriseServices.Internal.Publish $publish.GacRemove("c:\Folder Path\DLL.dll") iisreset Źródło: http://social...
-
Zapytania wykorzystujące bazę tempdb
SELECT SPID = s.session_id, s.[host_name], s.[program_name], s.status, s.memory_usage, granted_memory = CONVERT(INT, r.granted_query_memory*8.00), t.text, sourcedb = DB_NAME(r.database_id), workdb = DB_NAME(dt.database_id), mg.*, su.* FROM sys.dm_exec_sessions s INNER JOIN sys.dm_db_session_space_usage su ON s.session_id = su.session_id AND su.database_id = DB_ID('tempdb') INNER JOIN sys.dm_exec_connections c ON s.session_id = c.most_recent_session_id LEFT OUTER JOIN sys.dm_exec_requests r ON r.session_id = s.session_id LEFT OUTER JOIN ( SELECT session_id, database_id FROM sys.dm_tran_session_transactions...
-
Dodawanie dodatkowego pliku do bazy tempdb
ALTER DATABASE tempdb ADD FILE ( name = tempdb_secondary, filename = 'X:\XXX\tempdb_secondary.ndf', size = 512 MB )
-
Zmiana schema obiektów w bazie danych
SELECT 'ALTER SCHEMA [NAZWABAZY] TRANSFER [' + s.Name + '].[' + o.Name + ']' FROM sys.Objects o INNER JOIN sys.Schemas s on o.schema_id = s.schema_id WHERE s.Name = 'grafnet' And (o.Type = 'U' Or o.Type = 'P' Or o.Type = 'V')
-
Sprawdzenie zajętości poszczególnych tabel w bazie MSSQL
SELECT t.NAME AS TableName, p.rows AS RowCounts, SUM(a.total_pages) * 8 AS TotalSpaceKB, SUM(a.used_pages) * 8 AS UsedSpaceKB, (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB FROM sys.tables t INNER JOIN sys.indexes i ON t.OBJECT_ID = i.object_id INNER JOIN sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id INNER JOIN sys.allocation_units a ON p.partition_id = a.container_id WHERE t.NAME NOT LIKE 'dt%' AND t.is_ms_shipped = 0 AND i.OBJECT_ID > 255 GROUP BY t.Name, p.Rows ORDER BY t.Name Źródło: http://stackoverflow.com/questions/7892334/get-size-of...
-
"Likwidowanie dziur" w identity dla SQL Server 2012
USE master; GO CREATE PROCEDURE sp_FixSeeds2012 AS BEGIN --foreach database DECLARE @DatabaseName varchar(255) DECLARE DatabasesCursor CURSOR READ_ONLY FOR SELECT name FROM sys.databases where name not in ('master','tempdb','model','msdb') and sys.databases.state_desc = 'online' OPEN DatabasesCursor FETCH NEXT FROM DatabasesCursor INTO @DatabaseName WHILE @@FETCH_STATUS = 0 BEGIN EXEC ('USE ['+@DatabaseName + '] --foreach identity column DECLARE @tableName varchar(255) DECLARE @columnName varchar(255) DECLARE @schemaName varchar(255) DECLARE IdentityColumnCursor CURSOR READ_ONLY FOR select TABLE_NAME...
-
Szukanie baz danych dostępnych dla 'guest'
SET NOCOUNT ON GO DECLARE @DBName VARCHAR(255) DECLARE @SQL VARCHAR(MAX) DECLARE @SQLEXEC VARCHAR(MAX) CREATE TABLE #TableVar (DatabaseName varchar(256), permission_name varchar(32), State_desc varchar(10)) DECLARE curDatabases CURSOR STATIC FOR SELECT [name] FROM master.sys.databases WHERE database_id > 4 ORDER BY [name] OPEN curDatabases FETCH NEXT FROM curDatabases INTO @DBName WHILE @@FETCH_STATUS = 0 BEGIN SET @SQL = 'insert into #TableVar SELECT DB_NAME() as DatabaseName,permission_name,state_desc FROM sys.database_permissions where grantee_principal_id = user_id(''''guest'''') AND state...
-
Kodowanie connectionString
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef "connectionStrings" "SCIEZKADOKATALOGUZPLIKIEMWEBCONFIG"