exec sp_who2 select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid where d.name = 'DBNAME'
What's up!
Pyaarey Allah!
Wednesday, August 7, 2013
SQL Lookup logged in users
SQL Free up busy database resources
use master ALTER DATABASE im_test_restore SET SINGLE_USER WITH ROLLBACK IMMEDIATE use im_test_restore; go checkpoint; go use master; go ALTER DATABASE im_test_restore SET MULTI_USER
Friday, August 2, 2013
Rename a busy database in SQL Server
use master ALTER DATABASE YourDBName SET SINGLE_USER WITH ROLLBACK IMMEDIATE use YourDBName; go checkpoint; go use master; go alter database YourDBName modify name = YourDBNameNewName; go ALTER DATABASE YourDBName SET MULTI_USER
Subscribe to:
Posts (Atom)