Oracle Data Pump - from local machine importing to remote server - datapump

I am connected to remote Oracle server from my local machine & dropped all the table in one of the db schema. Now I need to import a dmp file located in the same remote machine from my machine. How can I achieve that?
Note - RDC to the server its not an option.
I can't use impdp as that utility is not available in my local machine.
Please help

I achieved this by SSH. I configured a SSH server on the Oracle DB machine then from my local machine ran impdp command via ssh using paramiko client.
......................................................................................
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(server, username=username, password=password)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('<impdp command here>')
err = ssh_stderr.read()
print "err", err, len(err)
ssh.close()

Related

How to set up connection to AWS rds via ssh to server from python?

I have to access an aws rds from a remote server. So far I have had no problems accessing the mysql databases from the command line.
I ssh to the server like: ssh username#XX.XXX.XXXX.XX
Once I'm in the server I use mysql -hrds_host.amazonaws.com -uuser -ppassword
And then I am able to call sql queries for the different databases from my terminal.
I have been trying to set up this connection through python using an ssh tunnel but fail to do so successfully. I expect the code to look something like:
with SSHTunnelForwarder(
(server_host, 22),
ssh_username=username,
ssh_private_key=private_key,
remote_bind_address=(rds_host, 3306)
) as server:
conn = sql.connect(host=rds_host,
port=server.local_bind_port,
user=user,
passwd=password,
db=database)
I continuously get errors like:
Could not establish session to SSH gateway
or An error occurred while opening tunnels.
The logging level of my SSHTunnelForwardes always shows an error.
I have also been successful setting up a connection with a paramiko ssh.client, just not the tunnel to call queries.
conn = sql.connect(host=rds_host,
port=server.local_bind_port,
user=user,
Change this connection to localhost, it should work

SCP times out, but ssh connection works fine. Am I doing something wrong?

I'm trying to copy task1.zip from my desktop /Users/myname/desktop if I pwd, to a remote server. I'm connected to the remote server via ssh. I would like to copy the file to /its/home/jt463/task1(pwd path from the directory) on the remote server.
I have used the command below in the terminal when I'm connected to the server via ssh and tried it on the terminal on my machine:
scp Users/myname/desktop/task1.zip username#inf900179.inf.susx.ac.uk:its/home/username/task1
Error that I get when I try to use the terminal that's connected to the remote server:
Users/jonatantibarovsky/desktop/task1.zip: No such file or directory
Error that I get when I try to use my local terminal:
ssh: connect to host inf900179.inf.susx.ac.uk port 22: Operation timed out lost connection
First scp to the intermediate server, using your credentials. Then, you should be able to scp from that server to the target.

Mount a remote server with a proxy

I'm trying to mount a remote directory From a server B on my local machine.
The connection to server B is possible only from a server A ( I can connect to using ssh ).
It's like making the server A as a proxy for the server B.
So i'm asking if there is a way to do this ?
Thanks.
You can use a Proxy Jump.
For that you can add server B in your local machine's ssh config file:
Host ServerB
HostName serverb.adress
User usernameInServerB
ProxyJump server.a.adress
Then you can just use any usual ssh command on ServerB, for example:
ssh ServerB
or
sshfs ServerB:Path/To/Dir

Copy redis database (.rdb file) from a remote server to local

I was given a Redis server that is set up remotely.
I can access data in that and I can do CRUD operation with that server.
But I want the replica of the same database in my local.
I have Redis desktop manager setup in my local. And also redis-server setup running.
Things I have tried:
using SAVE command.
I have connected to the remote server and executed save command. It ran
successfully and created dump.rdb file on that server. But I can't access that file as I don't have permission for server FTP.
using BGSAVE
same scenario here also
using redis-cli command
redis-cli -h server ip -p 6379 save > \\local ip\dump.rdb
Here I got an error The network name cannot be found.
Can anyone please suggest me on how can I copy the .rdb file from the server to local?

shell script for copying from remote server to local computer using ssh tunneling - scp

I have managed to connect to a remote server through ssh tunneling. No how can I copy files from remote server to my local computer. Considering that I just want to do it from remote server to my local computer.
I dont know how to write this command
"scp file/I/want/to/copy localhost/home/folder"
thanks a lot
Example:
scp username#server:/home/username/file_name /home/local-username/file-name
check this:
http://www.garron.me/linux/scp-linux-mac-command-windows-copy-files-over-ssh.html
scp -r (source)hostname:/(location of the file to be copied)/(file name) (Destination)hostname:/(location of the folder where the file should be copied to)
For example:
scp -r ram.desktop.overflow.com:/home/Desktop/Ram/abcd.txt rajesh.desktop.overflow.com:/home/documents/