|
|
|
Grasshopper
      
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
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 9:00 PM
Points: 825,
Visits: 5,698
|
|
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
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 9:00 PM
Points: 825,
Visits: 5,698
|
|
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
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 12:38 AM
Points: 37,724,
Visits: 29,981
|
|
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
|
|
|
|
|
Grasshopper
      
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
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 9:00 PM
Points: 825,
Visits: 5,698
|
|
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
|
|
|
|
|
Grasshopper
      
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
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 9:00 PM
Points: 825,
Visits: 5,698
|
|
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
|
|
|
|
|
Grasshopper
      
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.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 9:00 PM
Points: 825,
Visits: 5,698
|
|
You might need to specify the server as:
computername\ABCCOMPANYSERVERSQL
in the -S parameter.
And then again, I might be wrong ... David Webb
|
|
|
|