Saturday, October 8, 2011

Keyboard shortcuts for Run Command -1

This will helps you to do something faster than now.

Shortcut Keys
Command
%appdata%
Application Data Folder
%homedrive%
Home Directory Drive
%homepath%
Home Directory
%homeshare%
Shared Home Directory
%programfiles%
Open Program Files folder
%systemdrive%
Windows Root Drive
%temp%
Temporary Folder
%windir%
Windows Root Directory
ac3filter.cpl
Opens AC3 Filter (If Installed)
access.cpl
Accessibility Controls
access.cpl
Accessibility Controls
appwiz.cpl
Add/Remove Programs
calc
Calculator
certmgr.msc
Certificate Manager
charmap
Character Map
chkdsk
Check Disk Utility
ciadv.msc
Indexing Service
cleanmgr
Disk Cleanup Utility
cliconfg
SQL Client Configuration
clipbrd
Clipboard Viewer
cmd
Command Prompt
compmgmt.msc
Computer Management
controladmintools
Administrative Tools
controlcolor
Display Properties
(w/Appearance Tab Preselected)
controldesktop
Display Properties
controlfolders
Folders Properties
controlfonts
Fonts
controlkeyboard
Keyboard Properties
controlmouse
Mouse Properties
controlnetconnections
Network Connections
controlpanel
Open Control Panel
controlprinters
Printers and Faxes
controlschedtasks
Scheduled Tasks
dcomcnfg
Component Services
ddeshare
DDE Shares
desk.cpl
Display Properties
devmgmt.msc
Device Manager
dfrg.msc
Disk Defragment
directx.cpl
Direct X Control Panel (If Installed)*
diskmgmt.msc
Disk Management
diskpart
Disk Partition Manager
drwtsn32
Dr. Watson System Troubleshooting
dxdiag
Direct X Troubleshooter
eudcedit
Private Character Editor
eventvwr.msc
Event Viewer
excel
Run Microsoft Excel (if installed)
findfast.cpl
Findfast
firefox
Run Firefox (if installed)
firewall.cpl
Windows Firewall
fonts
Fonts Folder
freecell
Free Cell
fsmgmt.msc
Shared Folders
fsquirt
Bluetooth Transfer Wizard
gpedit.msc
Group Policy Editor (XP Prof)
hdwwiz.cpl
Add Hardware Wizard
iexplore
Run Internet Explorer
iexpress
Iexpress Wizard
inetcpl.cpl
Internet Properties
intl.cpl
Regional Settings
ipconfig
IPConfiguration
(DisplayConnectionConfiguration)
ipconfig/all
IP Configuration
(Display Connection Configuration)
ipconfig/displaydns
IP Configuration
(Display DNS Cache Contents)
ipconfig/flushdns
IP Configuration
(Delete DNS Cache Contents)
ipconfig/registerdns
IP Configuration
(Refreshes DHCP & Re-Registers DNS)
ipconfig/release
IP Configuration
(Release All Connections)
ipconfig/renew
IP Configuration
(Renew All Connections)
ipconfig/setclassid
IP Configuration
(Modifies DHCP Class ID)
ipconfig/showclassid
IP Configuration
(Display DHCP Class ID)
javaws
Java Control Panel (If Installed)
joy.cpl
Game Controllers
jpicpl32.cpl
Java Control Panel (If Installed)
logoff
Log Off Windows
lusrmgr.msc
Local Users and Groups
magnify
Windows Magnifier
main.cpl
Mouse Properties
mmsys.cpl
Sounds and Audio
msconfig
System Configuration Utility
mshearts
Hearts Card
mspaint
MS-Paint
mstsc
Remote Desktop
ncpa.cpl
Network Connections
netsetup.cpl
Network Setup Wizard
notepad
Notepad
ntmsmgr.msc
Removable Storage
ntmsoprq.msc
Removable Storage Operator Requests
nusrmgr.cpl
User Account Management
nvtuicpl.cpl
Nview Desktop Manager (If Installed)
odbccp32.cpl
ODBC Data Source Administrator
osk
On Screen Keyboard
outlook
Run Microsoft Outlook (if installed)
packager
Object Packager
password.cpl
Password Properties
perfmon
Performance Monitor
perfmon.msc
Performance Monitor
powercfg.cpl
Power Configuration
printers
Printers Folder
QuickTime.cpl
Quicktime (If Installed)
regedit
Registry Editor
regedit32
Registry Editor
rsop.msc
Resultant Set of Policy
secpol.msc
Local Security Settings
services.msc
Services
sfc
SystemFileCheckerUtility
(ReturntoDefaultSetting)
sfc/cachesize=x
System File Checker Utility
(Set Cache Size to size x)
sfc/purgecache
System File Checker Utility
(Purge File Cache)
sfc/revert
System File Checker Utility
(Return to Default Setting)
sfc/scanboot
System File Checker Utility
(Scan On Every Boot)
sfc/scannow
System File Checker Utility
(Scan Immediately)
sfc/scanonce
System File Checker Utility
(Scan Once At Next Boot)
shutdown
Shutdown Windows
shutdown-r
Restart Windows
sigverif
File Signature Verification Tool
spider
Spider Solitare
sticpl.cpl
Scanners and Cameras
sysdm.cpl
System Properties
sysedit
System Configuration Editor
syskey
Windows System Security Tool
taskmgr
Task Manager
telephon.cpl
Phone and Modem Options
telnet
Telnet Client
timedate.cpl
Date and Time
tourstart
Windows XP Tour Wizard
utilman
Utility Manager
verifier
Driver Verifier Utility
winchat
Microsoft Chat
winmine
Minesweeper
winword
Run Microsoft Word
(if installed)
wmimgmt.msc
Windows Management
Infrastructure
wordpad
Run WordPad
write
WordPad
wscui.cpl
Security Center
wuaucpl.cpl
Automatic Updates
wupdmgr
Windows Update Launches
Source :
http://myshortcutkeys.com/keyboard-shortcuts-for-run-command

Thursday, October 6, 2011

Exclusive access could not be obtained because the database is in use

Well, after a few months of actually did some projects to complete at my deadline was successes, here I am back to blogging!

Actually This time i'm going to talk about the database restoring is not happening, it is because of the "database is in use".

Here's a common way of doing that:

1. Set the database in SINGLE_USER mode and forcibly terminate other connections:

USE [master]
ALTER DATABASE [DATABASE_NAME]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

The above command will set the database in SINGLE_USER MODE and additionally the ROLLBABK IMMEDIATE termination option will roll back all the incomplete transactions. It will also disconnect any other connections to the database.

*Note: After issuing the above command, you will only be able to use a single connection to the database. So, if you are already using a query window connected to the target database, either restore the database by using the RESTORE T-SQL command or close the query window and restore the target database by using the Restore Database Wizard from SQL Server Management Studio.

2. Restore the database.

3. Set the database back to MULTI_USER mode:

USE [master]
ALTER DATABASE [DATABASE_NAME]
SET MULTI_USER;

That's it! You have successfully restored the database!


And here's an alternative way (a little bit more complex):

1. If there are any SQL Server logins granted any access on the target database then disable them:

alter login [LOGIN_NAME] disable

*Note: Even though now you have disabled the login(s) there still might exist active connections to the database.

2. To find and terminate existing connections on the target database perform the following:

-- Query that returns all the SPIDs (process IDs)/sessions established to a given database:
SELECT spid,loginame,login_time,program_name
FROM [master]..sysprocesses
WHERE DBID=DB_ID('DATABASE_NAME')

By collecting the above SPIDs you get the sessions that must be forcibly terminated (be careful not to forcibly terminate your own session! :) By including the columns loginame, login_time and program_name in the above query, you are able to identify and exclude the spid that belongs to your session (that is, the DBA session).

You can terminate a session by executing the T-SQL Statement:

KILL @SPID

*Note 1: Replace @SPID with the appropriate SPID number.
*Note 2: You can even create a user-defined function undertaking this task.

3. Set the database in SINGLE_USER mode:

USE [master]
ALTER DATABASE [DATABASE_NAME]
SET SINGLE_USER;

*Note: After issuing the above command, you will only be able to use a single connection to the database. So, if you are already using a query window connected to the target database, either
restore the database by using the RESTORE T-SQL command or close the query window and restore the target database by using the Restore Database Wizard from SQL Server Management Studio.

4. Restore the database.

5. Set the database back to MULTI_USER mode:

USE [master]
ALTER DATABASE [DATABASE_NAME]
SET MULTI_USER;


Remarks and Considerations
------------------------------
In the case of a RESTORE operation I would personally prefer the first method as it is simpler. With a single T-SQL Statement you set the database in SINGLE_USER MODE and also terminate all the active connections immediately and roll back all the incomplete transactions.

The second method is more preferable in cases where more "elegant" session control is required. This method allows the DBA to terminate sessions one-by-one explicitly instead of the first method which massively terminates all connections.

Choosing one of the two ways I guess that relies to the urgency of the RESTORE operation, the judgment of the DBA and also any Business Policies that might stand for such cases.

Because both the abovementioned methodologies have to do with forcibly terminating connections to a database in SQL Server, you must be extremely careful when using them as you might accidentally cause severe data loss when applying them inappropriately and without the necessary authorization from the Mansgement.

Source: http://aartemiou.blogspot.com/2009/03/exclusive-access-could-not-be-obtained.html