SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Windows Utilities for the SQL Server DBA


Windows Utilities for the SQL Server DBA

Author
Message
cmille19
cmille19
Mr or Mrs. 500
Mr or Mrs. 500 (531 reputation)Mr or Mrs. 500 (531 reputation)Mr or Mrs. 500 (531 reputation)Mr or Mrs. 500 (531 reputation)Mr or Mrs. 500 (531 reputation)Mr or Mrs. 500 (531 reputation)Mr or Mrs. 500 (531 reputation)Mr or Mrs. 500 (531 reputation)

Group: General Forum Members
Points: 531 Visits: 724
Comments posted to this topic are about the content posted at temp



Ravi Prashanth Lobo-275382
Ravi Prashanth Lobo-275382
Valued Member
Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)

Group: General Forum Members
Points: 72 Visits: 1

Thank you Chad!

I liked the DELETE script for files. I was looking for the code for a long time. I had also posted it in forums. But could NOT get the code.

Can anyone tell me from where can I download forfiles.exe? I don’t have win2003 environment.


T_VR
T_VR
SSC-Addicted
SSC-Addicted (487 reputation)SSC-Addicted (487 reputation)SSC-Addicted (487 reputation)SSC-Addicted (487 reputation)SSC-Addicted (487 reputation)SSC-Addicted (487 reputation)SSC-Addicted (487 reputation)SSC-Addicted (487 reputation)

Group: General Forum Members
Points: 487 Visits: 1272
WOW! extremely usefull contribution - TX Chad!
This will save myself hours of work every month...



What's this "backup strategy" everyone is on about?


Ravi Prashanth Lobo-275382
Ravi Prashanth Lobo-275382
Valued Member
Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)

Group: General Forum Members
Points: 72 Visits: 1

Downloaded forfiles.exe!

Found some changes in following command ( I am using v 1.1 forfiles.exe),

for %I in (TRN sqb bak) do FORFILES /S /D -2 /M *.%I /C "cmd /c del @file"

-- @file is case sensitive, it should be @FILE

-- Better to use properties with “-“ tag than “/” because

forfiles.exe behaves differently with –M and /M

-- If you want a include the command in a .bat file, then replace %

with %%


EugeneZ-162636
EugeneZ-162636
SSC-Enthusiastic
SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)

Group: General Forum Members
Points: 140 Visits: 562

Good one

Not just for 'new SQL Server DBAs'


David Jackson
David Jackson
SSChasing Mays
SSChasing Mays (653 reputation)SSChasing Mays (653 reputation)SSChasing Mays (653 reputation)SSChasing Mays (653 reputation)SSChasing Mays (653 reputation)SSChasing Mays (653 reputation)SSChasing Mays (653 reputation)SSChasing Mays (653 reputation)

Group: General Forum Members
Points: 653 Visits: 1913

I fully agree with all of the above. cmd scripts, or batch files if you are 'old' school, still can be enormously useful.

Here's a tip I use from time to time if you cannot connect to a SQL server and you don't have TS Administrator handy.

Killing a TS Session via Query Analyser

Occasionally all the available connections will be used up. If you have Terminal Services Manager loaded you can easily close down a connection. If you don't (the case on my XP machine at home), Brian Knight pointed out a very nice trick you can use if it's a SQL box. To get all the active sessions, open Query Analyzer and run this:

master..XP_CMDSHELL 'QUERY SESSION'

-- You'll get back a resultset containing sessionname, username, id, and state. Pick the sessin ID of the connection you want to kill, then run this:

master..XP_CMDSHELL 'logoff sessionid'

If you get back a single row containing null, it worked and you should be able to get a connection.

Dave Jackson



http://glossopian.co.uk/
"I don't know what I don't know."
Robert Sterbal
Robert Sterbal
SSC-Enthusiastic
SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)

Group: General Forum Members
Points: 109 Visits: 1

I am looking for a replacement for ping, ideally it will do a continuous ping and keep a running tally of the longest n number of ping times.

C:\WINDOWS>ping www.yahoo.com -t

Pinging www.yahoo-ht2.akadns.net [209.73.186.238] with 32 bytes of data:

Reply from 209.73.186.238: bytes=32 time=20ms TTL=50
Reply from 209.73.186.238: bytes=32 time=20ms TTL=50
Reply from 209.73.186.238: bytes=32 time=20ms TTL=50
Reply from 209.73.186.238: bytes=32 time=20ms TTL=50
Reply from 209.73.186.238: bytes=32 time=20ms TTL=50
Reply from 209.73.186.238: bytes=32 time=20ms TTL=50
Reply from 209.73.186.238: bytes=32 time=19ms TTL=50

...

or maybe I should just write a script with a loops?

Any thoughts...


Indianrock
Indianrock
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2010 Visits: 2371

I'm going to take a slightly different approach in my comment here. Yes these are great utilities. What I would like to know is how many people acting as DBAs ( whether formally or not ) actually have local administrator or even domain administrator type rights.

In my case, and I suspect in many small to mid-size companies adopting sql server, the DBA role hasn't been formalized and many of us can only execute commands such as these if logged into a query window as sysadmin -- in other words you are doing xp_cmdshell work as if you were the sql service.

In my case I'm beginning to wonder if it's worth even pursuing this role until it is recognized that DBA work typically requires some form of administrator rights. You wind up with a situation where the systems group has the rights, but no knowledge of or desire to administer sql server, and others with knowledge and desire, but no rights other than sql sysadmin.

Picture fixing an out of sync log shipping plan by doing DOS commands via xp_cmdshell.





Ravi Prashanth Lobo-275382
Ravi Prashanth Lobo-275382
Valued Member
Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)

Group: General Forum Members
Points: 72 Visits: 1

This is another good tip. Thank you Dave !


chinn
chinn
SSC Veteran
SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)

Group: General Forum Members
Points: 212 Visits: 705

Chad,

Great Stuff!

Thanks,





Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search