Saturday, July 20, 2013

How to be a tall person at work

A Post by Penelope Trunk
Link - http://www.networkedblogs.com/p6164476

The Institute of Social and Economic Research recently published a study about the connection between popularity in high school and earning power later in life. New York magazine, information source to the rich and popular, summarized the study like this: "This study may seem to burst our Revenge of the Nerds fantasies, but it's logical that people who are attractive, likable, and socially comfortable—the class officers, the cheerleaders—should get ahead in corporate settings."

There is absolutely irrefutable data to support the idea that good-looking people do better in life than everyone else. Gordon Patzer, in his book, Looks, draws from a wide body of research to describe the advantaged life of a good-looking person from the time they are a baby (good-looking babies get better parentings) to the time they are in sales (the whole sales team performs better if there are more good-looking people on the team.)

As a result, I have jumped on the plastic surgery bandwagon. Super-smarty Chelea Clinton got plastic surgery before she entered the work world. We should all do that. And while I haven't taken my own advice, I do find myself pinching and pulling at my nose to see what it would look like after at $10,000 investment.

But wait. Before you take out a loan to straighten your nose, maybe you should just start thinking like a tall person. Being good-looking means having the right mix of a lot of things, and for you, being tall might be the final keystone to hold it all in place. (Wondering if you're already tall? Fast Company has the answer: over 6'3" for men and over 5'9" for women, which, by the way, makes me half-an-inch into the land of the tall.)

Tall people make $789 more per inch per year, and are 90% more likely to ascend to the CEO chairs of Fortune 500 Companies, according to Arianne Cohen, author of The Tall Book. She scoured the sociology, psychology and workplace research to determine why tall people succeed (she herself is 6'3"). And Cohen discovered that the behaviors tall people display can be mimicked by anyone in order to get the career benefits of being tall.

Here's what Cohen says to do, based on the research she's gathered:
Be unforgettable
Due to evolutionary programming, when a tall guy walks into a meeting, everyone registers that he's there, and remembers what he says. This is a huge boon for someone who's also an ambitious, talented worker. So be noticeable. Figure out a way that when you walk in the room, everyone registers it. You can do that through interesting (but professional) clothing, cracking jokes when you walk in, etc.

Act like the boss
Tall children, from a very young age, are deemed the "leader" of their friends. Other little kids literally look up to them and often treat them as they would a slightly older child, and as a result, they're more likely to function as the leader for the rest of their life. Even as interns, other office workers give them the physical space and attention usually reserved for a leader. So act like a leader.

Find a way to look down on coworkers. Literally
An eye cast down is a really powerful behavior — it's the body's way of signaling a power imbalance in your favor, and you can create that power imbalance with some attention to your positioning. Thus, stand whenever you can when coworkers are sitting, and avoid walk-and-talks and casual standing around the office where coworkers are looking down at you.

Guard your personal space
Close friends hold conversations 18" apart; friends 2-3' apart, and bosses and employees four feet apart. coworkers naturally give tall people four-or-more feet, which means that from the beginning, they're treated with boss-like reverence. You can mimic this body language — simply send out the physical vibe of professionalism, not chumminess, even in casual conversation. You'll see that people step back, and give you more space.

Don't be shy
Tall people often build an oversize personality to fit their oversize bodies. In the workplace tall people are more likely to yell or make demands or pull off a tongue-in-cheek toast to the boss. Socially, they take chances, and those chances are rewarded.

Focus on image rather than competence
Tall people aren't actually better workers, but in surveys, their bosses think they are. Which means that though competence matters, the perception of competence matters much more. So stop spending so much time on your work, and start spending more time on this list of ways to look tall.

5 Ways to Manage Team Conflicts

Referred URL
http://www.pm4girls.elizabeth-harrin.com/2012/10/5-ways-to-manage-team-conflicts/


Photo credit: Ed Yourdon

This is a guest post by Daniel Raymond, marketing manager at Project-Management.com.

Team conflicts on projects are a part of life. In essence, you are bringing together people with different personalities, mindsets, and specialization and are asking them to work as one. It is very rare for projects to go smoothly. Even in simple, straightforward projects, conflict between people can rear its ugly head. The most common reasons for this include personality clashes, misunderstandings, disagreements about the work, and egos.
If you’re the project manager, your responsibility is to mediate between the parties involved. Take note that there are instances where conflicts cannot be resolved no matter what you do. The resentment between two people is just too deep. Don’t side with anyone. Your responsibility is to ensure that they can still work together as far as possible or to make alternative plans if they can’t.
Here are some guidelines on how you can resolve team conflicts.

1. Exercise an authoritarian approach

This must be done if there is intense pressure to finish within the deadline or if the due date is approaching. Just tell the group what the resolution should be. Emergency situations require unpopular decisions. The authoritarian approach is particularly effective if the project is nearing completion.

2. Avoidance

There are some cases where project managers avoid confrontation. They ignore team conflicts as if they don’t exist. If the issues between team members aren’t serious and if they can still work professionally, it may not require the attention of the project manager. It is still best for the manager to get involved though, if only to provide a better work environment for the team.

3. Sacrificing self-concerns

This entails yielding to another person, it may be quite difficult because of egos. Nevertheless, the approach can be effective when one person has a significant vested interest in the outcome because in those cases they are more willing to make concessions. When one person is clearly wrong, it may be a good idea to help him or her see the error using examples or proof.

4. Collaborating

Compromises and accommodation (sacrificing self-concerns) involve one or both parties giving in. In collaboration, there is an attempt to find a mutually satisfying outcome. This requires the effort of the team manager as well. It is important to sit down with the people who are in conflict and mediate the discussion to reach a collaborative conclusion.

5. Exchanging concessions

Taking the middle ground can be effective if a quick solution is required for a complex issue. This approach takes the opinions of different people into consideration quickly. The mediation should end by outlining the source of the conflict, gaining commitments from all parties, and setting up a follow-up session.
So, these are the top 5 ways to manage team conflicts in any project team. Look at the individual situation in your team and adopt the strategy that looks to you as if it will be the most likely to help resolve it.
It is important to keep in mind that when conflict starts, it is usually over a minor issue such as personality mismatch. But when dealing with the problem is postponed, you run the risk of there being a lot of annoyances that occurred in the meantime. Dealing with it early prevents personality clashes from becoming bigger issues.

About the author: Daniel Raymond is the Marketing Manager at Project-Management.com, a site for everything related to project management. They aim to provide a wide selection of project management articles, and detailed project management software reviews.
Photo credit: Ed Yourdon on Flickr

10 Tips for presenting information

Referred URL
http://www.pm4girls.elizabeth-harrin.com/2013/01/10-tips-for-presenting-information/
When presenting any kind of information to an audience, it’s always important to be as concise as possible, while putting a lot of thought into the preparation of how to best shape your content for an audience. At the same time, it’s worth considering how to use plain speech, repetition, body language, and other approaches to best engage an audience, and to make sure that your message is put across clearly, and in a way that can encourage later discussion.

1. Prepare

Knowing your information inside and out is one thing, but knowing how to shape that information for an audience is another. You need to think about what will be important to that audience, and how to best make your presentation interesting for them.

2. Keep things concise

20 minutes or so of talking is often enough to present information. Don’t let your presentation get bogged down in too many graphs and tables – focus on key case studies, and try to cut out anything that might be too distracting.

3. Avoid too many visual aids

Again, over reliance on PowerPoint can result in an audience losing interest is faced with table after table on the screen. Having a few choice images can, however, keep your presentation more varied, but don’t be tempted to bombard an audience with too much.

4. Speak plainly

Trying to make your presentation too technical will mean that most audiences will have a hard time staying focused for the whole time you’re talking. Provide the context, and offer the opportunity to share your more technical information later.

5. Repeat key points

It’s crucial to have a clear introduction and conclusion to any presentation. Moreover, repeat key points to make it clear what your argument is, even if it seems like you’re going over them too much – in most presentations, an audience will only take away one or two, so make sure they get through.

6. Make eye contact

It’s important to make eye contact during the course of a presentation, even at that means focusing on a few people around a room when talking.

7. Use body language well

If you’re standing behind a podium and reading off a script, you can end up making it easy for an audience to lose interest. Stand in front of the audience, and vary your body language to maintain their attention.

8. Have some handouts

If you don’t have time to cover every piece of information that you want to, have a few handouts that you can offer to people after the presentation. These handouts can include any data or case studies that expand on your points.

9. Prepare for questions

You never know exactly what people will ask, but if you know your topic, you’ll want to have a good discussion about your presentation, and shouldn’t feel under pressure to have all the answers.

10. Ask for feedback













Getting constructive feedback on your presentation skills, or even your topic, can be important, especially if there are areas that you’re unsure about.

Usefull Run Commands For Windows

Usefull Run Commands For Windows :
Here is a list of commands that you can run off from the Run Command Prompt:

Accessibility Controls = access.cpl
Accessibility Wizard = accwiz
Add Hardware Wizard = hdwwiz.cpl
Add/Remove Programs = appwiz.cpl
Administrative Tools = control admintools
Adobe Acrobat ( if installed ) = acrobat
Adobe Distiller ( if installed ) = acrodist
Adobe ImageReady ( if installed ) = imageready
Adobe Photoshop ( if installed ) = photoshop
Automatic Updates = wuaucpl.cpl
Basic Media Player = mplay32
Bluetooth Transfer Wizard = fsquirt
Calculator = calc
Ccleaner ( if installed ) = ccleaner
C: Drive = c:
Certificate Manager = cdrtmgr.msc
Character Map = charmap
Check Disk Utility = chkdsk
Clipboard Viewer = clipbrd
Command Prompt = cmd
Command Prompt = command
Component Services = dcomcnfg
Computer Management = compmgmt.msc
Compare Files = comp
Control Panel = control
Create a shared folder Wizard = shrpubw
Date and Time Properties = timedate.cpl
DDE Shares = ddeshare
Device Manager = devmgmt.msc
Direct X Control Panel ( if installed ) = directx.cpl
Direct X Troubleshooter = dxdiag
Disk Cleanup Utility = cleanmgr
Disk Defragment = dfrg.msc
Disk Partition Manager = diskmgmt.msc
Display Properties = control desktop
Display Properties = desk.cpl
Display Properties (w/Appearance Tab Preselected ) = control color
Dr. Watson System Troubleshooting Utility = drwtsn32
Driver Verifier Utility = verifier
Ethereal ( if installed ) = ethereal
Event Viewer = eventvwr.msc
Files and Settings Transfer Tool = migwiz
File Signature Verification Tool = sigverif
Findfast = findfast.cpl
Firefox = firefox
Folders Properties = control folders
Fonts = fonts
Fonts Folder = fonts
Free Cell Card Game = freecell
Game Controllers = joy.cpl
Group Policy Editor ( xp pro ) = gpedit.msc
Hearts Card Game = mshearts
Help and Support = helpctr
Hyperterminal = hypertrm
Hotline Client = hotlineclient
Iexpress Wizard = iexpress
Indexing Service = ciadv.msc
Internet Connection Wizard = icwonn1
Internet Properties = inetcpl.cpl
Internet Setup Wizard = inetwiz
IP Configuration (Display Connection Configuration) = ipconfig /all
IP Configuration (Display DNS Cache Contents) = ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents) = ipconfig /flushdns
IP Configuration (Release All Connections) = ipconfig /release
IP Configuration (Renew All Connections) = ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS) = ipconfig /registerdns
IP Configuration (Display DHCP Class ID) = ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID) = ipconfig /setclassid
Java Control Panel ( if installed ) = jpicpl32.cpl
Java Control Panel ( if installed ) = javaws
Keyboard Properties = control keyboard
Local Security Settings = secpol.msc
Local Users and Groups = lusrmgr.msc
Logs You Out of Windows = logoff
Malicious Software Removal Tool = mrt
Microsoft Access ( if installed ) = access.cpl
Microsoft Chat = winchat
Microsoft Excel ( if installed ) = excel
Microsoft Diskpart = diskpart
Microsoft Frontpage ( if installed ) = frontpg
Microsoft Movie Maker = moviemk
Microsoft Management Console = mmc
Microsoft Narrator = narrator
Microsoft Paint = mspaint
Microsoft Powerpoint = powerpnt
Microsoft Word ( if installed ) = winword
Microsoft Syncronization Tool = mobsync
Minesweeper Game = winmine
Mouse Properties = control mouse
Mouse Properties = main.cpl
MS-Dos Editor = edit
MS-Dos FTP = ftp
Nero ( if installed ) = nero
Netmeeting = conf
Network Connections = control netconnections
Network Connections = ncpa.cpl
Network Setup Wizard = netsetup.cpl
Notepad = notepad
Nview Desktop Manager ( if installed ) = nvtuicpl.cpl
Object Packager = packager
ODBC Data Source Administrator = odbccp32
ODBC Data Source Administrator = odbccp32.cpl
On Screen Keyboard = osk
Opens AC3 Filter ( if installed ) = ac3filter.cpl
Outlook Express = msimn
Paint = pbrush
Password Properties = password.cpl
Performance Monitor = perfmon.msc
Performance Monitor = perfmon
Phone and Modem Options = telephon.cpl
Phone Dialer = dialer
Pinball Game = pinball
Power Configuration = powercfg.cpl
Printers and Faxes = control printers
Printers Folder = printers
Private Characters Editor = eudcedit
Quicktime ( if installed ) = quicktime.cpl
Quicktime Player ( if installed ) = quicktimeplayer
Real Player ( if installed ) = realplay
Regional Settings = intl.cpl
Registry Editor = regedit
Registry Editor = regedit32
Remote Access Phonebook = rasphone
Remote Desktop = mstsc
Removable Storage = ntmsmgr.msc
Removable Storage Operator Requests = ntmsoprq.msc
Resultant Set of Policy ( xp pro ) = rsop.msc
Scanners and Cameras = sticpl.cpl
Scheduled Tasks = control schedtasks
Security Center = wscui.cpl
Services = services.msc
Shared Folders = fsmgmt.msc
Sharing Session = rtcshare
Shuts Down Windows = shutdown
Sounds Recorder = sndrec32
Sounds and Audio = mmsys.cpl
Spider Solitare Card Game = spider
SQL Client Configuration = clicongf
System Configuration Editor = sysedit
System Configuration Utility = msconfig
System File Checker Utility ( Scan Immediately ) = sfc /scannow
System File Checker Utility ( Scan Once At Next Boot ) = sfc /scanonce
System File Checker Utility ( Scan On Every Boot ) = sfc /scanboot
System File Checker Utility ( Return to Default Settings) = sfc /revert
System File Checker Utility ( Purge File Cache ) = sfc /purgecache
System File Checker Utility ( Set Cache Size to Size x ) = sfc /cachesize=x
System Information = msinfo32
System Properties = sysdm.cpl
Task Manager = taskmgr
TCP Tester = tcptest
Telnet Client = telnet
Tweak UI ( if installed ) = tweakui
User Account Management = nusrmgr.cpl
Utility Manager = utilman
Volume Serial Number for C: = label
Volume Control = sndvol32
Windows Address Book = wab
Windows Address Book Import Utility = wabmig
Windows Backup Utility ( if installed ) = ntbackup
Windows Explorer = explorer
Windows Firewall = firewall.cpl
Windows Installer Details = msiexec
Windows Magnifier = magnify
Windows Management Infrastructure = wmimgmt.msc
Windows Media Player = wmplayer
Windows Messenger = msnsgs
Windows Picture Import Wizard (Need camera connected) = wiaacmgr
Windows System Security Tool = syskey
Windows Script host settings = wscript
Widnows Update Launches = wupdmgr
Windows Version ( shows your windows version ) = winver
Windows XP Tour Wizard = tourstart
Wordpad = write
Zoom Utility = igfxzoom
If you found this list of Run Commands useful, please Like and Share to Everyone.!

Add the Quick Launch Bar to the Taskbar in Windows 7

Referred URL
http://www.howtogeek.com/howto/windows-7/add-the-quick-launch-bar-to-the-taskbar-in-windows-7/
Windows 7 with the Quick Launch bar
The above screenshot is the Windows 7 taskbar after changing back to XP/Vista mode, and adding the quick launch bar back. Looks just like Vista doesn’t it?
Adding the Quick Launch Bar Back to Windows 7
To add the toolbar back, you’ll want to right-click on an open area of the taskbar, and choose Toolbars \ New Toolbar from the menu. You should probably also unlock the taskbar at this point.
Windows 7 Taskbar Menu
Now’s the slightly tricky part… you’ll want to paste the following path into the location bar:
%appdata%\Microsoft\Internet Explorer\Quick Launch
Windows 7 Add Quick Launch
Make sure that the location bar shows the full path, like the next screenshot, before you choose the “Select Folder” button.
Windows 7 Quick Launch Full Path
You’ll immediately notice the Quick Launch toolbar on the taskbar, but it’s all the way over on the right, so you’ll want to click on the dotted lines and then drag the toolbar all the way to the left (which is slightly tricky sometimes). Note that you’ll need to right-click and unlock the taskbar before you can move the toolbar.
Windows 7 Quick Launch on Right
There we go, it’s over on the left… but now you’ll want to adjust the regular taskbar toolbar to be closer to the left, so use the dotted lines to drag it over as well.
Windows 7 Quick Launch on Left
The normal Quick Launch that we’re used to doesn’t have text, so right-click on the dotted lines and uncheck “Show Text” as well as “Show Title” from the menu.
Windows 7 Remove Text from Toolbar
Once you’re sure it’s the way you want it, you should check the “Lock the taskbar” again.
Windows 7 Quick Launch


















And there you are, the quick launch bar has returned and there’s virtually no way anybody would know this is Windows 7.

SQL Server performance tips

Does your SQL statement have a WHERE clause?
I know this sounds obvious, but don't retrieve more data than you need. However, less obvious is that even if your SELECT statement retrieves the same quantity of data without a WHERE clause, it may run faster with one.

Is SELECT DISTINCT being used properly?
Again, pretty obvious, but using SELECT DISTINCT where no duplicate records are being returned is an unnecessary performance hit. If you are getting duplicate records, first double check your table joins as this is often the cause and only use the DISTINCT clause if you really need it.

Are you using UNION instead of UNION ALL?
A UNION statement effectively does a SELECT DISTINCT on the results set. If you know that all the records returned are unique from your union, use UNION ALL instead, it is much quicker.

Are your stored procedures prefixed with 'sp_'?
Any stored procedures prefixed with 'sp_' are first searched for in the Master database rather than the one it is created in. This will cause a delay in the stored procedure being executed.

Are all stored procedures referred to as dbo.sprocname?
When calling a stored procedure you should include the owner name in the call, i.e. use EXEC dbo.spMyStoredProc instead of EXEC spMyStoredProc.

Prefixing the stored procedure with the owner when executing it will stop SQL Server from placing a COMPILE lock on the procedure while it determines if all objects referenced in the code have the same owners as the objects in the current cached procedure plan.

Are you using temporary tables when you don't need to?
Although there is sometimes a benefit of using temporary tables, generally they are best eliminated from your stored procedure. Don't assume that retrieving data multiple times is always less efficient than getting the data once and storing it in temporary table as often it isn't. Consider using a sub-query or derived table instead of a temporary table (see examples below). If you are using a temporary table in lots of JOINS in you stored procedure and it contains loads of data, it might be beneficial to add an index to your temporary table as this may also improve performance.

An example of a derived table instead of a temporary table
SELECT COLUMN1, COLUMN2, COUNTOFCOL3
FROM A_TABLE A
INNER JOIN (SELECT COUNT(COLUMN3) AS COUNTOFCOL3, COLUMN2
FROM B_TABLE B
INNER JOIN C_TABLE C ON B.ID = C.ID) ON A.ID = B.ID

Are you using Cursors when you don't need to?
Cursors of any kind slow down SQL Server's performance. While in some cases they are unavoidable, often there are ways to remove them from your code.

Consider using any of these options instead of using a cursor as they are all faster:
•Derived tables
•Sub-queries
•CASE statements
•Multiple queries
•Temporary tables

Are your Transactions being kept as short as possible?
If you are use SQL transactions, try to keep them as short as possible. This will help db performance by reducing the number of locks. Remove anything that doesn't specifically need to be within the transaction like setting variables, select statements etc.

Is SET NO COUNT ON being used?
By default, every time a stored procedure is executed, a message is sent from the server to the client indicating the number of rows that were affected by the stored procedure. You can reduce network traffic between the server and the client if you don't need this feature by adding SET NO COUNT ON at the beginning of your stored procedure.

Are you using IN or NOT IN when you should be using EXISTS or NOT EXISTS?
If you are using IN or NOT IN in a WHERE clause that contains a sub-query you should re-write it to use either EXISTS, NOT EXISTS or perform a LEFT OUTER JOIN. This is because particularly the NOT IN statement offers really poor performance. The example below probably better explains what I mean:

e.g. This SQL statement:

SELECT A_TABLE.COLUMN1
FROM A_TABLE
WHERE A_TABLE.COLUMN2 NOT IN (SELECT A_TABLE2.COLUMN2
FROM A_TABLE2)

Could be re-written like this:
SELECT A_TABLE.COLUMN1
FROM A_TABLE
WHERE NOT EXISTS (SELECT A_TABLE2.COLUMN2
FROM A_TABLE2
WHERE A_TABLE.COLUMN2 = A_TABLE2.COLUMN2)

Do you have a function that acts directly on a column used in a WHERE clause?
If you apply a function to a column used in the WHERE clause of your SQL statement, it is unlikely that the SQL statement will be able to make use of any indexes applied to that column.

e.g.
SELECT A_TABLE.LASTNAME
FROM A_TABLE
WHERE SUBSTRING (FIRSTNAME,1,1) = 'm'

Could be re-written:
SELECT A_TABLE.LASTNAME
FROM A_TABLE
WHERE FIRSTNAME LIKE = 'm%'

Where you have a choice of using the IN or BETWEEN clauses
Use the BETWEEN clause as it is much more efficient

e.g. This SQL statement:

SELECT A_TABLE.NAME
FROM A_TABLE
WHERE A_TABLE.NUMBER IN (100, 101, 102, 103)

Should be re-written like this:
SELECT A_TABLE.NAME
FROM A_TABLE
WHERE A_TABLE.NUMBER BETWEEN 100 AND 103



SQL Server performance tuning can consume a considerable amount of time and effort. The following list is a quick guideline that you should keep in mind when designing and developing SQL Server database applications:

User Defined Functions (UDF)
Refrain from using user defined functions (UDF) in a select statement that may potentially return many records. UDFs are executed as many times as there are rows in a returned result. A query that returns 100,000 rows calls the UDF 100,000 times.

SQL Server table indexes
Create SQL statements that utilize defined table indexes. Using indexes minimizes the amount of table scan which in most cases will be much slower than an index scan.

Multiple disks
The single best performance increase on a SQL Server computer comes from spreading I/O among multiple drives. Adding memory is a close second. Having many smaller drives is better than having one large drive for SQL Server machines. Even though the seek time is faster in larger drives, you will still get a tremendous performance improvement by spreading files, tables, and logs among more than one drive.

Disk controllers
Different disk controllers and drivers use different amounts of CPU time to perform disk I/O. Efficient controllers and drivers use less time, leaving more processing time available for user applications and increasing overall throughput.

SQL Server foreign keys
Ensure that all your tables are linked with foreign keys. foreign keys enhance the performance of queries with joins. Database tables inside each application are naturally related. Islands of tables are rarely needed if your application's business logic is well defined.

SQL Server primary keys
Ensure that every table has a primary key. if you can't find a natural set of columns to serve as a primary key, create a new column and make it a primary key on the table.

Processor (CPU)
When you examine processor usage, consider the type of work the instance of SQL Server is performing. If SQL Server is performing a lot of calculations, such as queries involving aggregates or memory-bound queries that require no disk I/O, 100 percent of the processor's time can be used. If this causes the performance of other applications to suffer, try changing the workload of the queries with aggregates.

Are you doing excessive string concatenation in your stored procedure?
Where possible, avoid doing loads of string concatenation as it is not a fast process in SQL Server.

Have you checked the order of WHERE clauses when using AND?
If you have a WHERE clause that includes expressions connected by two or more AND operators, SQL Server will evaluate them from left to right in the order they are written (assuming that no parenthesis have been used to change the order of execution). You may want to consider one of the following when using AND:
•Locate the least likely true AND expression first. This way, if the AND expression is false, the clause will end immediately, saving time.
•If both parts of an AND expression are equally likely being false, put the least complex AND expression first. This way, if it is false, less work will have to be done to evaluate the expression.

Have you checked that you are using the most efficient operators?
Often you don't have much of a choice of which operator you use in your SQL statement. However, sometimes there is an alternative way to re-write your SQL statement to use a more efficient operator. Below is a list of operators in their order of performance (with the most efficient first).
•=
•>, >=, <, <=
•LIKE
•<>

TempDB Deleted Accidentally


Referred URL
http://www.sqlservercentral.com/articles/Administration/72835/
In famous sci-fi Iron Man series Justin Hammer said "I love peace, but we live in a world of grave threats. Threats that Mr. Stark will not always be able to foresee." The statement is so true for the DBA's world where there are potential threats to data security. There is a constant fear of losing data because of the mistakes of some developer or support person.
This is a scenario I encountered recently and I thought of documenting it. This is a rare situation but we must be ready to face it if it occurs. I had to move the user database files for my TestDB to a new partition on the G:\ drive and I decided to also move tempdb to the G:\ drive at the same time. I used the code below to move the following files.
For TestDB:
Alter Database Testdb Modify File (Name=TestDB, FileName ='G:\Data\TESTDB.MDF')
Alter Database Testdb Modify File (Name=TestDB_log, FileName ='G:\Data\TestDB_log.ldf')

The output of the this code is shown in the screen shot below:

Zoom in  |  Open in new window
For tempdb I executed:
Alter Database tempdb Modify File (Name=tempdev, FileName ='G:\Data\tempdb.mdf')
Alter Database tempdb Modify File (Name=templog, FileName ='G:\Data\templog.ldf')

The output of the that code is shown in the screen shot below:

Zoom in  |  Open in new window
The SQL Server instance was stopped and the files for the user database (TestDB ) were physically moved to the new directory (G:\Data). The tempdb database files are created every time the SQL Server is restarted so there was no need to move those database files. The SQL Server instance was started and then a query was executed on the TestDB as written below.
select name,address into #table from dbo.contact
select * from #table 

The output of the code above is shown in the screen shot below:

Zoom in  |  Open in new window
I had an issue one fine day when I realized that I had run out of space on my workstation's C:\ drive. I went to the Disk Management utility and deleted the G: partition to free up space. I then extended the C: partition. I then tried to open SSMS and found that the SQL Server was not started. I opened up SQL Server Configuration Manager to see the state of the SQL Server. The server was in auto start mode, but it was not running. I tried to start the server, and it did not show any error, but the server did not start. I went to the Windows error log and found the error shown below.
CREATE FILE encountered operating system error 3(The system cannot find the path specified.) while attempting to open or create the physical file 'G:\Data\tempdb.mdf'.
The issue was tempdb database files had been moved to G:\Data\ and that did not exist anymore. When SQL Server tried to restart and create tempdb, it failed. Now I had to bring the SQL Server up somehow and change the file path of tempdb to its default path. To do this, I had to start the SQL Server in single user mode and then make the changes. I stopped the SQL Server Agent from the configuration manager. I opened a command prompt and ran the code below to switch on the SQL Server with minimal configuration.
cd C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn
sqlservr.exe -f
This started the SQL Server in the minimal configuration single user mode as is shown in the screen shot below.

This started SQL Server in single user mode. I opened a new query window in SSMS and connected to the master database and then altered tempdb to point to a physically existing disk folder as shown below.
alter database tempdb move file (filename=tempdev, FileName ='C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\tempdb.mdf')
alter database tempdb move file (filename=templog, FileName ='C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\templog.ldf')

I got the message that the tempdb has been re-configured and that the change will take place when SQL Server is restarted as shown in the screen shot.

Zoom in  |  Open in new window
I closed the query window and the command line that was still running. I started the SQL Server instance again and this time it worked. After the server came up I restored the user database from a backup file using SSMS and executed the same query on the database to find the same result as shown below.






























Zoom in  |  Open in new window