Microsoft SQL (MSSQL) query for active session
Howto see active sessions in a mssql. Its pretty easy just make a new query, and run sp_who or sp_who2. sp_who shows whitch active sessions there are, and sp_who2 shows more information about the...
View ArticleHowto shrink / truncate SQL transaction log file in SQL Server 2005
USE <databasename> GO DBCC SHRINKFILE(‘<logfilename-logical name>’, 1) BACKUP LOG <databasename> WITH TRUNCATE_ONLY DBCC SHRINKFILE(‘<logfilename-logical name>’, 1) GO Share this:
View ArticleLimit SQL Server maximum memory SQL of WSUS
Start SQL Server Management Studio Connect to \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query Start a “New Query” And then put this into you SQLQuery1.sql window sp_configure ‘show advanced options’,1...
View ArticleLimit SQL Server maximum memory SQL instance
Start SQL Server Management Studio Connect to you SQL server instance Start a “New Query” And then put this into you SQLQuery1.sql window sp_configure ‘show advanced options’,1 reconfigure with...
View ArticleAhsay restore Microsoft SQL (MSSQL) server database
If you want to restore a Microsoft SQL database, from a fuld backup, and put some transaction log file into it. (This backup has backup by ahsay) This is the why to do it:...
View ArticleBackup msSQL server – Operating system error 5(error not found).
If you want to take a backup from Microsoft SQL Server management Studio, and get this error: Operating system error 5(error not found), then the problems is that the user running SQL Server services...
View ArticleGet SQL Collation and Version
SQL Query: SELECT @@version as 'server version' Select SERVERPROPERTY('COLLATION') as 'server collation' Share this:
View ArticleChange SQL Collation
Steps for chaning Collation: Take backup of Databases and logins. Detach all databases execpt system databases. (All users databases) Find the SQL server installation path (Root of the CD) Run this...
View ArticleUsername in MSSQL is not mapped to real username
After a migration of a database, the mapping of username is lost. You can rejoin the username in database security with the “real” username with this commands: [crayon-55ef8393b5914418487966/] Share this:
View ArticleShring SQL log file
USE [TestDb] GO ALTER DATABASE [TestDb] SET RECOVERY SIMPLE WITH NO_WAIT DBCC SHRINKFILE([TestDb_Log], 1) ALTER DATABASE [TestDb] SET RECOVERY FULL WITH NO_WAIT GO Where TestDB, is the database name,...
View ArticleMSSQL: Whitch database used most memory
With this query, you can see whitch database that is using most memory
View ArticleMSSQL How long will data be in cache/buffer
How fast is data leving the cache, when it not access again. With this query, you can see how fast data will get expire, and overwritten by new data in the cache. Witch the...
View ArticlemsSQL Session running on database
To see witch session id, that run command against a database, you can run this:
View ArticleMonitoring a Automatic Seeding in msSQL Always on Availability Groups
This command, can be run on both the primary and secondary node.
View Articlemssql get the backup information with copy_only information.
I need to find a way to see if the backup chain where broken. On my search I found this could script, created by “hot2use”I have found this script on a...
View ArticleImplement SQL Server Agent Jobs with AlwaysOn Availability Groups
The function I use fn_hadr_group_is_primary from this post is a UDF (User Defined Function) that we create in the master database. The function gets an Availability Group name as an input parameter and...
View ArticleMSSQL – check that the Agent Job have been run as Schedule
I have this problems, that if a schedule inside a Agent job, have not been started for some reason, there will be no errors about this problem. So Í have created this script, that...
View ArticleMSSQL database roles get all securables – Full script out the Database Roles
Thanks for the script to John Eisbrener – Check for new version here: https://dbaeyes.wordpress.com/2013/04/19/fully-script-out-a-mssql-database-role/
View ArticleSQL – Check with statements that are blocked
You can check which statements are blocked by running this
View ArticleMSSQL Backup History Query
To see MSSQL history Query, run this SQL query. It will show all backups between the 1 january 2021 and 1 february 2021, order by Database and then Last backup time. It will also...
View Article