Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 BCP headaches

Author  Topic 

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2012-02-14 : 10:36:35
I'm on a roll today.

I'm try9ing to BCP out some data. the bcp function reports it's running sucessfully, but i'm not seeing the output in any of the locations i'm specifying. The report provided looks thusly, but no data appears in the location:


*** Connected to DCSOSSCTS server MNI database.
*** Executing command:
EXEC master..xp_cmdshell 'bcp [MNI].[dbo].CFG_MNI_ID_TYPE format nul -n -x -S DCSOSSCTS -f C:\\CFG_MNI_ID_TYPE.xml -T -k'

*** Connected to DCSOSSCTS server MNI database.
*** Executing command:
EXEC master..xp_cmdshell 'bcp [MNI].[dbo].[CFG_MNI_ID_TYPE] out C:\\CFG_MNI_ID_TYPE.dat -n -k -T -f C:\\CFG_MNI_ID_TYPE.xml -S DCSOSSCTS'
Warning: -f overrides -n.

Starting copy...

3 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1 Average : (3000.00 rows per sec.)

ideas?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-14 : 10:40:38
is db installed on your machine? as per above statement file will be present in path C:\\CFG_MNI_ID_TYPE.xml of machine where SQL Server is installed

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2012-02-14 : 10:48:50
That's it. Thank u
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-14 : 10:52:56
welcome
if you want it to be saved to your machine specify UNC path like

\\yourmachinename\folder\...

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-14 : 10:59:44
It's better not to bcp out (or in) across a network

Or doing back up's and restores for that matter



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2012-02-14 : 11:31:29
for a number of less than exciting reasons, i am stuck doing these bcps from across the network. Some of them are taking some time to complete. While the resources of the box i'm running them from does not appear to be taxed, i would like to keep an eye on the server from which the data is being pulled. Is there any way for me to view the resource utilization on that source server without being able to install any convoluted 3rd party app on that server? Both are server 2008R2
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-14 : 11:50:55
I can tell you RIGHT Now..performance is bad BECAUSE of the Network

Is there any data in [MNI].[dbo].[CFG_MNI_ID_TYPE]

SELECT * FROM [MNI].[dbo].[CFG_MNI_ID_TYPE]

????

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2012-02-14 : 12:15:54
use perfmon to monitor resource utilization.

Network might be the problem, but can't say yet that it IS the problem.

What's the network speed? Measure the transfer rate with a file of known size.

When you say some take time, how much time? Have you checked for blocking on the SQL Server? Does the query execute fast in SSMS? How big is the file?
Go to Top of Page

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2012-02-14 : 12:30:01
Only three rows in that particular table, buy many more in the others. Since doing this across the network is the only option available to me, and they want this done, the other users are going to have to suck it while i get this done.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-14 : 13:16:52
Where are you running the bcp from? The server or your client?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-02-14 : 15:22:44
quote:
Since doing this across the network is the only option available to me
Not exactly. You can bcp to a local drive on the SQL Server and then ROBOCOPY the file to your UNC path. It's better to kick off robocopy from one of the machines involved in the copy. Robocopy is very fast, is kinder on network bandwidth, can do restartable copies, and has tons of other handy features. Learn it, your life will be better.

You can also zip the file before you copy it and save space that way. It may seem pointless for 3 row files, but it's almost required for files of 100 MB or more. 7zip is a freeware utility that gives excellent compression and has a free command line utility. Winzip and WinRar are not free, but they also have command line utilities.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-14 : 15:35:14
What he said..

Basically once you establish a methodology for a best practice, you will use it for everything and will take seconds in the future to set up



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -