SCP is not working but just showing the usage - ssh

scp -r /Users/localusername/Desktop/test hostname#ipaddress/Users/hostname/Desktop
usage: scp [-346BCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file]
[-J destination] [-l limit] [-o ssh_option] [-P port]
[-S program] source ... target
I try to upload a folder called “test” from a local PC to the host PC using SCP via ssh, but it always shows the usage without transferring the folder. Can anyone let me know how to fix the problem?

Related

ssh using # without a username

Im doing some setup via the following guide,
https://www.ovirt.org/develop/dev-process/working-with-gerrit.html
Theres a step to verify the ssh config but it involves doing
ssh #gerrit.ovirt.org
This looks like a typo, don't we need a user for the # part. If no user, no # is my understanding?
[root#dub-svrfarm27 ~]# ssh #gerrit.ovirt.org
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-J [user#]host[:port]] [-L address] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]
[-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
[user#]hostname [command]
This being said...the final bit of my id_rsa.pub has this
71MgP8w== root#
So maybe there is method to this, im not sure.
It's a typo. Look again at the usage message:
[user#]hostname
The # is legal if, and only if, a user name is supplied in addition to the required host name.

Bcp command is getting error Out

I need to export the Json data into a text file, but it is getting error out.
EXEC xp_cmdshell 'bcp "SELECT Formdata fldr.FormInstanceDataMap WHERE
FormInstanceID=127432" queryout "D:\Import\Test.txt" -
STMGVM021\deBenefitSync_Web_DEV -T -c -Usa -Psa#123 '
Getting error Out. Output is
Copy direction must be either 'in' or 'out'. Syntax Error in
'queryout'. usage: bcp [[db_name.]owner.]table_name[:slice_num]
[partition pname] {in | out} [filename] [-m maxerrors] [-f
formatfile] [-e errfile] [-d discardfileprefix] [-F firstrow] [-L
lastrow] [-b batchsize] [-n] [-c] [-t field_terminator] [-r
row_terminator] [-U username] [-P password] [-I interfaces_file] [-S
server] [-a display_charset] [-z language] [-v] [-i input_file] [-o
output_file] [-A packet size] [-J client character set] [-T text or
image size] [-E] [-g id_start_value] [-N] [-W] [-X] [-M LabelName
LabelValue] [-labeled] [-K keytab_file] [-R remote_server_principal]
[-C] [-V [security_options]] [-Z security_mechanism] [-Q] [-Y] [-y
sybase directory] [-x trusted.txt_file] [--clienterr errfile]
[--maxconn maximum_connections] [--show-fi] [--hide-vcc] [--colpasswd
[[[db_name.[owner].]table_name.]column_name [password]]] [--keypasswd
[[db_name.[owner].]key_name [password]]] [--initstring ASE
initialization string] [--quoted-fname] NULL
I could find two changes in your query.
When -T (windows authentication) option is added, no need to specify the SQL credentials.
You did not specify the DB name. Unless the needed DB is specified as default in your login, then probably you might end up with error.
Thanks,
Ananda Kumar J.

Why not execute scp command on centos 6?

my server ip 192.168.3.247
I want use scp.
and I try
scp root#192.168.3.248:/root/disk.image/newversion/
but not execute scp
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user#]host1:]file1 ... [[user#]host2:]file2
why not execute scp command on centos 6?
use it like:
scp -r root#192.168.3.248:/root/disk.image/newversion/ .
Directories need to be copied recursively and you also need a target

Can't makes BCP to export data from view to csv

Thanks to domenicr now I see, that bcp keys are case sensetive. But another problem appears - bcp asks me about type of the field to write in file each time i run script - is it possible to automate that?
Enter the file storage type of field Employee_ID [char]:
I need to export data from view to csv file. The easiest way, as it seems to me is BCP. I tried to read MSDN https://msdn.microsoft.com/en-us/library/ms162802.aspx for syntax help, but I can't makes bcp to create file cause of error (running bcp from cmd). Thanks in advance for any help with syntacsis.
bcp [base_name].[dbo].[all_users_for_ad] out 1.csv -t -c -u mylogin -p mypassword -s mysever
bcp: unknown option u
usage: bcp {dbtable | query} {in | out | queryout | format} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n native type] [-c character type] [-w wide character type]
[-N keep non-text native] [-V file format version] [-q quoted identifier]
[-C code page specifier] [-t field terminator] [-r row terminator]
[-i inputfile] [-o outfile] [-a packetsize]
[-S server name] [-U username] [-P password]
[-T trusted connection] [-v version] [-R regional enable]
[-k keep null values] [-E keep identity values]
[-h "load hints"] [-x generate xml format file]
BCP command arguments are case sensitive. Should be -T and -S. For trusted connections, no need to pass user and password.
Use -c to specify character data type or supply a format file with -f argument
Refer to this on how to create a format file. https://msdn.microsoft.com/en-CA/library/ms191516.aspx

Executing of large script in SQL Server 2008

I have a really big script (about 1GB) with UPDATE statements. Something like
UPDATE Table1 SET Col1 = 'Some text 1' WHERE ID = 1
UPDATE Table1 SET Col1 = 'Some text 2' WHERE ID = 2
-- and so on
What is the best way to execute this script? I suppose that I can't simply open it at text editor and run query...
Thanks in additional.
UPDATED
I need to run this script on remote SQL Server instance.
execute it wih the osql utility Reference
Example:
osql -E -i C:\MyFolder\MyScript.sql -o C:\MyFolder\MyOutput.rpt
you can also type for reference:
osql -?
usage: osql [-U login id] [-P password]
[-S server] [-H hostname] [-E trusted connection]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w columnwidth]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-L list servers] [-c cmdend] [-D ODBC DSN name]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-n remove numbering] [-m errorlevel]
[-r msgs to stderr] [-V severitylevel]
[-i inputfile] [-o outputfile]
[-p print statistics] [-b On error batch abort]
[-X[1] disable commands [and exit with warning]]
[-O use Old ISQL behavior disables the following]
<EOF> batch processing
Auto console width scaling
Wide messages
default errorlevel is -1 vs 1
[-? show syntax summary]
For remote server but you need the sql utility installed on the machine you run this.
osql -S <instance name> -U <username> -P <password> -i C:\MyFolder\MyScript.sql -o C:\MyFolder\MyOutput.rpt
this is will help you, it's worked very good for me
Bulk Update Data