在很多大型企业级地理数据库的建设中,服务器一般都是Linux、AIX、Solaris等操作系统。通常,用户使用Windows终端访问这些操作系统,包括命令行。终端机、文件传输软件,常见的有Putty、SSH、Xmanager等,根据每个用户先入为主的想法,先学哪个软件,你就会比较习惯这个软件,但是到了以后情况往往不一样顾客。也许你已经习惯了。完全没有安装工具,遇到陌生的环境,只掌握一门技能显得捉襟见肘。这次我遇到了问题。我习惯使用putty+SSH之类的软件。我希望得到用户AIX操作系统导出的DMP文件,复制到我的Windows操作系统中测试,但是如果不是以Binary方式导出,DMP在我的操作系统中是无法使用的,只有Xmanager在用户端,我不习惯,所以使用FTP传输是一个很好的解决方案。使用FTP,可以直接设置以Binary的形式下载到用户本地,非常方便。1.确保操作系统安装VSFTPD可以使用以下命令行验证:[root@sdemachine3~]#cd/etc/vsftpd[root@sdemachine3vsftpd]#lsftpusersuser_listvsftpd.confvsftpd_conf_migrate.sh[root@sdemachine3vsftpd]#Ifnot安装好了,可以下载相关的Tar包安装即可,vsftpd.conf中包含了FTP服务配置参数的相关设置。2、确保服务器的FTP服务已开启[root@sdemachine3vsftpd]#servicevsftpdstatusvsftpdisstopped[root@sdemachine3vsftpd]#servicevsftpdstartStartingvsftpdforvsftpd:[OK]3:建议关闭服务器的防火墙或SELinux,或开放21端口.4:只需使用WindowsCMD通过FTP连接即可。FTP服务器IP地址:C:\Users\Administrator>ftp192.168.220.133连接到192.168.220.133。220(vsFTPd2.2.2)用户(192.168.220.133:(none)):root331请指定密码。密码:230登录成功。5:连接成功后,可以输入类似的命令ftp>help命令可能会略写。Thecommandis:!deleteliteralpromptsend?debuglsputstatusappenddirmdeletepwdtraceasciidisconnectmdirquittypebellgetmgetquoteuserbinaryglobmkdirrecvverbosebyehashmlsremotehelpcdhelpmputrenamecloselcdopenrmdirftp>dir200PORTcommandsuccessful.Considerusingntoestabli6.CommandintroductionAfterdisconnection,youcanusetheOpencommandtoreconnect,oryoucanusetheUsercommandtocontinueconnectingtotheIP.DIR命令类似于所有目录文件的DOS列表,类似于Linux的ls命令:ftp>dir远程主机关闭了连接。ftp>打开到192.168.220.133连接到192.168.220.133。220(vsFTPd2.2.2)用户(192.168.220.133:(none)):root331Pleasespecifythepassword.密码:230Loginsuccessful.ftp>dir200PORTcommandsuccessful.ConsiderusingPASV.150Herecomesthedirectorylisting.drwxr-xr-x2004096Aug292013Desktopdrwxr-xr-x2004096Aug292013Documentsdrwxr-xr-x2004096Aug292013Downloadsdrwxr-xr-x2004096Aug292013Musicdrwxr-xr-x2004096Aug292013Picturesdrwxr-xr-x2004096Aug292013Publicdrwxr-xr-x2004096Aug292013Templatesdrwxr-xr-x2004096Aug292013Videos-rw-------1003135Aug292013anaconda-ks.cfg-rw-r--r--1002062384Jan0205:54ceshi_ora_11016.trc-rw-r--r--10014415564Jan0206:51ceshi_ora_11620.trcdrwxr-xr-x18004096Mar0502:12gdal-1.9.2-rw-r--r--10011532797Mar0501:50gdal192.zip-rw-r--r--100598st10-rlog-9-r--100598st10-rlog-inr-inwst-rlogr20-1009548Aug292013install.log.syslogdrwxr-xr-x2004096Mar0602:44shp_data1-rwxr-xr-x100701Feb2703:34test.pl226DirectorysendOK.ftp:在0.06秒18.77秒内收到1164个字节查看状态Status,重点看ascii类型,即传输的数据是ascii码形式:ftp>status连接到192.168.220.133。类型:ascii;冗长的:开;铃声:关闭;提示:开;通配:调试:关闭;哈希标记打印:关闭。如果希望用户使用二进制的方式进行传输,比如在上面的dir之后,在root的根目录下有一个test.pl文件,希望使用二进制的形式传输到Windows终端。使用FTP使用get命令获取文件:ftp>binary200SwitchingtoBinarymode.ftp>gettest.pl200PORTcommandsuccessful.ConsiderusingPASV.150OpeningBINARYmodedataconnectionfortest.pl(701bytes).226Transfercomplete.ftp:Received701bytes,take0.00seconds701000.00kilobytes/second.mget命令一次获取多个远程文件。mget命令的一般格式为:mgetfilenamelist使用以空格分隔或通配符分隔的文件名列表来指定要获取的文件,需要用户确认是否传输每个文件。获取到的test.pl文件在默认的命令行输入文件夹下,即C:\Users\Administrator文件夹下。C:\Users\Administrator>ftp192.168.220.133使用send命令将本地文件传输到目标服务器:ftp>sendtest1.pl200PORTcommandsuccessful.ConsiderusingPASV.150Oktosenddata.226Transfercomplete.ftp:发送701字节,耗时0.00秒701.00千字节/秒。ftp>dir200PORTcommandsuccessful.ConsiderusingPASV.150Herecomesthedirectorylisting.drwxr-xr-x2004096Aug292013Desktopdrwxr-xr-x2004096Aug292013Documentsdrwxr-xr-x2004096Aug292013Downloadsdrwxr-xr-x2004096Aug292013Musicdrwxr-xr-x2004096Aug292013Picturesdrwxr-xr-x2004096Aug292013Publicdrwxr-xr-x2004096Aug292013Templatesdrwxr-xr-x2004096Aug292013Videos-rw-------1003135Aug292013anaconda-ks.cfg-rw-r--r--1002062384Jan0205:54ceshi_ora_11016.trc-rw-r--r--10014415564Jan0206:51ceshi_ora_11620.trcdrwxr-xr-x18000296-rdal--2.2Mar95--10011532797Mar0501:50gdal192.zip-rw-r--r--10059875Aug292013install.log-rw-r--r--1009548Aug292013install.log.syslogdrwxr-xr-x2004096Mar0602:44shp_data1-rwxr-xr-xr-x2004096Mar0602:44shp_rw-r-r-r--r--100701Apr1801:38test1.pl226DirectorysendOK.ftp:在0.01秒内以94.62kBytes/sec的速度接收到1230字节。您还可以使用类似于发送的Put命令。put和mput命令用于将文件发送到远程机器;Put命令的一般格式为:put文件名mput命令一次发送多个本地文件;mput命令的一般格式为:mputfilenamelist使用空格分隔或使用通配符文件名列表以指定要发送的文件。Foreachofthesefiles,theuserisaskedtoconfirmsending.使用cd命令切换目标服务器的目录:ftp>cd/home/oracle250Directorysuccessfullychanged.ftp>dir200PORTcommandsuccessful.ConsiderusingPASV.150Herecomesthedirectorylisting.-rw-r--r--15005011170432000Jan1401:01DBCGW.DMPdrwxrwxr-x95005014096Jan1401:07apache-tomcat-7.0.42drwxrwxr-x45005014096Sep092013app-rwxrwxr-x1500501493Jan1401:03export.log-rwxrwxr-x15005011402Jan1401:04import.logdrwxr-xr-x65005014096Nov2908:24sdeexe102226DirectorysendOK.ftp:收到411字节,用时0.01秒29.36千字节/秒。IfyoudonotwantthelocaldefaultpathtobeC:\Users\Administrator,butwanttochangeittoC:\asthedefaultpath,usethelcdcommandtomodifythecurrentlocaldirectoryC:\offtp>lcdc:\.Forothercommands,youcantestandlearnbyyourself!
