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


'DBCC' is not recognized as an internal or external command


'DBCC' is not recognized as an internal or external command

Author
Message
guzman_anthony
guzman_anthony
SSC-Enthusiastic
SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)

Group: General Forum Members
Points: 125 Visits: 35
thanks David,

correct me if i'm wrong. I have a batch file dbcc.bat (will .bat ok? as prerequisite to call in our third party software) with the DBCC script mentioned above will the following addition to the script. the dbcc.bat script now should look like this:

------------------------------------

-SQLservername -E -idbcc.sql -ooutput.txt

DBCC Shrinkfile('CCGA_CAS_log',EMPTYFILE )
DBCC Shrinkfile('Logging_log',EMPTYFILE )


-----------------------------------

i have tried this one, but i got the error message:

HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failu
re may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

****** SHOULD I JUST ENABLE SQL SERVER TO ALLOW REMOTE CONNECTIONS????

Thanks
David Webb-CDS
David Webb-CDS
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4008 Visits: 8586
No, the .bat file should only have the SQLCMD line in it. The actual DBCC commands should be in another file indicated by the -i filename on the SQLCMD command line.



And then again, I might be wrong ...
David Webb
David Webb-CDS
David Webb-CDS
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4008 Visits: 8586
Yes, the server should be set to allow remote connections. The -E will work if the id of the login you are running is set up as a windows authenticated login inside the server. You need the -U and -P if the id you are using to run the .bat file is set up as a SQL authenticated id inside the server. If neither is true, you need to have your DBA set up the id as one or the other before you can actually make the connection.



And then again, I might be wrong ...
David Webb
GilaMonster
GilaMonster
SSC Guru
SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)

Group: General Forum Members
Points: 220267 Visits: 46279
Also since you have not specified a server, that will attempt to connect to the default instance on the machine you are running it on. If that's not the correct server, you need to use -S to specify the correct server.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


guzman_anthony
guzman_anthony
SSC-Enthusiastic
SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)

Group: General Forum Members
Points: 125 Visits: 35
Hi,

i received this error message.

sqlcmd :'dbcc.bat': Invalid filename

thanks
David Webb-CDS
David Webb-CDS
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4008 Visits: 8586
That would indicate that you used the name of the batch file with the -i parameter rather than the name of the file that had the 2 DBCC commands in it (call it dbcc.sql). Since I can't really see what you're doing, that's just a guess.



And then again, I might be wrong ...
David Webb
guzman_anthony
guzman_anthony
SSC-Enthusiastic
SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)

Group: General Forum Members
Points: 125 Visits: 35
yes. i forgot to specify the location of the filename..i can call the dbcc.bat now with output.txt. this one WORKS OK NOW!!!!

but i still get the error below even if i am calling the script on the actual SQL Server.

HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establi
shing a connection to the server. When connecting to SQL Server 2005, this failu
re may be caused by the fact that under the default settings SQL Server does not
allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

I did check the remote connection and it is [u]set to ALLOW REMOTE CONNECTION.[u]

There is not point on setting up the firewall to accept the REMOTE Connection if I am calling the command on the actual SQL server? am i right?

any input? thanks
David Webb-CDS
David Webb-CDS
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4008 Visits: 8586
OK, so it looks like it's trying to get a named pipes connection. You need to have the dba make sure that the named pipes protocol is enabled, using SQL Server Configuration Manager. You also need to make sure that the server name you are using is correct. Is it a default instance or a named instance (when it was installed, was it given a specific name?).

You're close....



And then again, I might be wrong ...
David Webb
guzman_anthony
guzman_anthony
SSC-Enthusiastic
SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)

Group: General Forum Members
Points: 125 Visits: 35
Thanks David.

I've checked the Named Pipes and is ENABLED.

Want to make sure for this > Server Name = Computer Name?
And, you said - I need to have the DBA? how or can you elaborate further?

For, Default Instance or a Named Instance im not sure. I've checked SQL Server Configuration and i saw the name is was of our company looks like this ABCCOMPANYSERVERSQL. from there can you tell is a named instance..

Appreciated your time.
David Webb-CDS
David Webb-CDS
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4008 Visits: 8586
You might need to specify the server as:

computername\ABCCOMPANYSERVERSQL

in the -S parameter.



And then again, I might be wrong ...
David Webb
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