Move db2 from Windows to Linux - linux

I'm trying to move db2 db from windows to linux server. When I move data to linux db by this command:
db2move DBNAME load -lo REPLACE -u userID -p password > load_remote.txt
I had this error:
SQLCODE: -3126 - SQLSTATE:
SQL3126N Remote client requires absolute path for files and directories.
Thanks.

Do you mean to use the 'load client' syntax (instead of just load) ?
See the details in the documentation.
The LOAD command requires that the files to be loaded are already on the Db2-target-server.
The LOAD CLIENT alternative allows the files to be on a remotely connected Db2-client (or on your Windows Db2-server if that is the source machine).
You can also just copy the IXF files to the Linux Db2-server, and open an SSH session to that Linux environment and run the LOAD command there. Your choice.
As with the LOAD command, LOAD CLIENT operates on one file at a time (in your case, one file per table) unless using lobsinsepfiles option, or other special cases.

Related

Cannot Connect to Linux Oracle Databse with Perl Script after connecting with PuTTY

I have the following problem:
I currently connect to one of our Linux servers using PuTTY on my Windows 10 machine. If I use a ‘standard’ PuTTY connection I have no problem: I can log in and run my Perl script to access an Oracle database on the Linux server. However, recently I have set up a new PuTTY connection (I copied the original working copy used above). The only difference from the original is that I have entered the following in the section Connection->SSH->Remote command of the PuTTY configuration window:
cd ../home/code/project1/scripts/perl ; /bin/bash
(I have done this so I arrive directly in the folder containing all my scripts.)
I can still log into the server with no problems and it takes me straight to the folder that contains my Perl scripts. However, when I run the script to access the Oracle database I get the following error:
DBI connect('server1/dbname','username',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc. at PerlDBFile1.pl line 10.
impossible de se connecter à server1 / dbname at PerlDBFile1.pl line 10, <DATA> line 1.
In addition, if I run the env command on the server the variable $ORACLE_HOME is not listed (If I run the same env command on the server with the standard PuTTY connection the $ORACLE_HOME variable is present.)
Just to note: Running any other Perl script on the server (that does NOT access the Oracle database) through either of the PuTTY sessions I have created works with no problems.
Any help much appreciated.
When you set the remote command in PuTTY, it skips running of .bash_profile that is present in your default $HOME directory. This is why you are getting the error.
To resolve it, either place a copy of .bash_profile in your perl directory, or add a command to execute .bash_profile in remote command
OK, I have the solution!...Thanks to everyone who replied.
Basically, I originally had the command:
cd ../home/code/project1/scripts/perl ; /bin/bash (See original post)
To get it to work I replaced the above with
cd ../home/code/project1/scripts/perl; source ~/.bash_profile; /bin/bash
I also tried:
cd ../home/code/project1/scripts/perl; /bin/bash; source ~/.bash_profile
But that did NOT work.
Hope this helps someone.
Gauss76

How can we add an application to startup remotely (Linux)

I have an application which executes on a remote Linux system. How can I add this application to startup of that remote system from my local linux system. I know the path of executable (application) on remote system.
I searched a lot on different sources but didnt get any idea ?
Edit: What am I doing is:
I have developed a desktop-application (using qt).
I have loaded this application on remote system (using libssh).
I am able to execute this application remotely.
Now, I want to add this application to startup of that system remotely (stucked here).
Any Idea how to complete 4th step ??
Create Executable.desktop file (on local machine)
Open ssh connection and get remote machine root access
Copy this Executable.desktop file to "etc/xdg/autostart" on remote system (using ssh and commonds )
Reboot the remote system (using ssh and commonds )
Note: The solution will work if we know the location of executable/application on remote system

How can we set nodetool and cqlsh to be run from anywhere and by any user on linux server

I am trying to setup environment variables so that any user on a particular server can run commands like nodetool or cqlsh from any where in linux file system . The effort to traverse to bin directory everytime should be saved .
How can we achieve this ? My DSE 4.8 is a tarball install .
Nodetool is usually available to any user that has execution privileges in your linux boxes
For cqlsh, you can set any configuration inside the cqlshrc file (usually found in $HOME/.cassandra/cqlshrc; we have used to enable client-node encryption but has more configurable options
To setup environment variable just follow some steps from root user:
# vi /etc/profile.d/cassandra.sh
Add the following lines to the cassandra.sh file-
export CASSANDRA_HOME=/opt/apache-cassandra-3.0.8
export CASSANDRA_CONF_DIR=/opt/apache-cassandra-3.0.8/conf
Here /opt/ is my directory, where I've extracted my apache-cassandra-3.0.8-bin.tar.gz tarball.
After adding those lines to cassandra.sh, save and exit. Then-
# source /etc/profile.d/cassandra.sh

Sending .csv file from linux to windows

I want to send files (txt or csv) from linux to windows.
I already have a script to get information and put it into a .txt or .csv file, tried with many ways to send this file from linux to my computer.
there is a ping from server to my computer IP, but when i use below commands it gives:
ssh: connect to host 10.10.X.X port 22: Connection timed out
scp -r fname.lname#10.10.X.X:/home/ test.txt
or
scp test.txt fname.lname#10.10.X.X:/C:/Data
Please could you help, simply I wanna have a copy of file (that I have it in server) in my computer, to use it.
there is some similar questions with no answer here.
You need a ssh server installed on windows. Windows does not currently have out of the box ssh server. They are thinking of implementing OOB ssh servers in future releases of windows 10.
Have a look at this link https://winscp.net/eng/docs/guide_windows_openssh_server
Also, if the file transfer that you want is a one time transfer, you can use putty with a reverse scp to retrieve the file or you can use WINscp ( https://winscp.net/eng/download.php )
I usually use the command 'nc' for file transmission.
But since on Windows you have to install a cygwin to use nc, so I think the simplest solution may be like the following.
On linux, go to the directory of those files, and then type:
python -m SimpleHTTPServer 1234
Then on windows you can visit 10.10.X.X:1234 in your browser, and download those files.
Note that 1234 can be replaced by any other port which is not currently used on linux.

Using SCP command to download files from Linux server to client server

I'm creating files on a Linux server that I'm logged into and I'm adding the ability for the user to download these files from the Linux server on to the connecting computer. I'm writing a scrip and using the scp command to download these files:
scp data.txt user#usraddress:/home/usr
However, I don't want to specify "user#usraddress:/home/usr" to be just my computer. I want whoever is logged onto the linux server to be able do download these files. Is there a way to get the address of the connecting computer?
How would I do this?
Forgive me if this seems elementary, I'm very new to scripting.
When you open a remote session in a GNU/Linux machine, the ssh server sets the environment variable SSH_CONNECTION with some connection information. You can use this variable and the $USER variable to fill that parameters:
scp data.txt $USER#${SSH_CONNECTION%% *}:/home/$USER
Note that as far as I know you couldn't assume the client home directory is at /home. As said by chepner, you could omit the destination directory to use the default location, the home directory.
scp data.txt $USER#${SSH_CONNECTION%% *}:

Resources