Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««1234»»»

'DBCC' is not recognized as an internal or external command Expand / Collapse
Author
Message
Posted Tuesday, October 16, 2012 10:49 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, October 22, 2012 1:11 PM
Points: 15, Visits: 34
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


Post #1373402
Posted Tuesday, October 16, 2012 10:59 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 3:25 PM
Points: 902, Visits: 7,238
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
Post #1373412
Posted Tuesday, October 16, 2012 11:05 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 3:25 PM
Points: 902, Visits: 7,238
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
Post #1373414
Posted Tuesday, October 16, 2012 11:07 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:30 AM
Points: 43,010, Visits: 36,169
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 2008, MVP
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

Post #1373415
Posted Tuesday, October 16, 2012 12:50 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, October 22, 2012 1:11 PM
Points: 15, Visits: 34
Hi,

i received this error message.

sqlcmd :'dbcc.bat': Invalid filename

thanks
Post #1373477
Posted Tuesday, October 16, 2012 1:49 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 3:25 PM
Points: 902, Visits: 7,238
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
Post #1373508
Posted Tuesday, October 16, 2012 2:22 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, October 22, 2012 1:11 PM
Points: 15, Visits: 34

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
Post #1373524
Posted Tuesday, October 16, 2012 2:40 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 3:25 PM
Points: 902, Visits: 7,238
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
Post #1373531
Posted Wednesday, October 17, 2012 8:34 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, October 22, 2012 1:11 PM
Points: 15, Visits: 34
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.
Post #1373842
Posted Wednesday, October 17, 2012 9:04 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 3:25 PM
Points: 902, Visits: 7,238
You might need to specify the server as:

computername\ABCCOMPANYSERVERSQL

in the -S parameter.




And then again, I might be wrong ...
David Webb
Post #1373875
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse