DB2 – How to pscp from the command line

25 August,2012 by Tom Collins

PSCP  is a command line secure file copy program. It’s part of the PuTTY suite of files, which also includes  PuTTY – a Telnet and SSH client.

Within the PuTTY suite is another program called : Plink – which is a command line interface to the PuTTY backend. The great thing about Plink is it can be used as part of a script for management of DB2 servers.  For example,  a script to log on securely to a server – run a series of commands. One of the limitation of Plink is you can’t download files. At this point PSCP is called in to play

An example of a command line of PSCP in a Powershell script on Windows. In this example, the   username, password and servername are passed to the command line. PSCP logs on to the server and downloads the files onto the local server. In this case , we’re downloading all files with a prefix “db2diag”  on the folder “\servername\tmp\”   onto the local server path “E:\DB2\logs”.  Contact me for any assistance


$un = “myName”
$pw = “myPW”
$servername = “myServerName”

E:\scripts\DB2\modules\pscp.exe -l $un -pw $pw -p $un@$($servername):/tmp/db2diag* E:\DB2\logs\  

 Related Posts

Plink and DB2

db2diag.log file delete on Linux and DB2

Author: Rambler(http://www.dba-db2.com)


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on DB2 – How to pscp from the command line

Comments are moderated, and will not appear until the author has approved them.

dba-db2.com | DB2 Performance Tuning | DBA DB2:Everything | FAQ | Contact | Copyright