DBA have seen many request for export import and data transfer. In most of the account DBA are depended on JUMP host for connectivity and its resources and we usually have
limited free spaces on our production servers for dumping of data.I have a one tricky and powerful way to accomplish this bulky task by which we can export and transfer file
in real time. All we need a jump host login and login on both host(source and destination)
3 simple steps:
Where: JumpHost DoWhat: setup passwordless connectivity
Where: Soucrce Server: DoWhat: Start export in a named pipe
Where: JumpHost: start transfer (SSH tunneling)(get from source and put into Destination)
Server1 (export running in pipe) -----> Jump+HOST ------> Server2(writting file on remote host)
You will see that export running on source server and dump is generating on Target
Steps with Example
• Add yourself to ~/.ssh/authorized_keys on hosts so you are not asked for passwords. Don’t forget to remove your keys afterwards.
It’s simple:
Login to OS user on jumphost
$cd .ssh
$ls Check if *.pub already there if not you can create it by yourself.
$ /usr/bin/ssh-keygen -t dsa
[USER@UNIX_SERVER .ssh]$ cat id_dsa.pub
ssh-dss AAAAB3NzaC1kc3MAAACBANLdz08XPOs5Sze9kl99d5teJi7Pin/JXK4oAuClq6Y6Az1M/LKRBEMIoBi5mjxNa9c++BPrtRyOwaVLQK1lVCmlN3XKdonk3xWWCcEqJVtYQOZt6l5Npf391N18eCx3eHJyK+Lt2Ch0rRzA+CK45387sNiFjL4n/P3qZj0g9y/VAAAAFQD9hBv955nffSGl1s6wO9L7qENFBwAAAIAbtEq2ktWQRQKQ+QxXLHfXHxIWsYfzgDuJlX07ZaKtISyii5Y/yuqt1C/4XjhGe4dm8cqTn40miTWmzBPGd8CUAsFm6kDz8UjXmDFlQ4aZLdgIUUI7iyTT7b96OBIgqrecJKhmJWgo60Ip9V88ZdBoLWcmO3DFTn7DsBJOQkIPgAAAIBdFwGXbHMO7HUatzagPhswUtY0yJzcEvgKPMVOlisNzRp/0FhTmzZcYp8qiW2q+SIuryWIQZXXCBUc1Y5x0URWPthGJ4aVS/OqBHigVBl8zOHo+2iP865YQx93PSskt/JDgkwGl1ZLNT2Rgkb0Ymx9FhDIQjkzYvbyYUDKySVpgQ==USERR@UNIX_SERVER.vodafone.com.au
opy this entry and add on both host. For example if you want to transfer data from SERVER1 to SERVER2. Add below entry Authorised keys
oracle@SERVER1-app$ls /vha/home/oracle/.ssh/authorized_keys
you can check by doing ssh to that host it will not ask for the password.
Sssh oracle@SERVER1
• Create named pipe.
On source create named pile on the place where you want to keep the EXPORT DUMP file.
$mknod mk p
Example: here is am taking export of 1 table and creating a named pipe name ‘fifo’ on mountpoint /mnpupgrade
SERVER1:MNP:/mnpupgrade> /sbin/mknod fifo p
SERVER1:MNP:/mnpupgrade>
• Start export into named pipe. Something like this:
nohup time exp "'/ as sysdba'" file=fifo log=log.log tables=mnp.xyz compress=n consistent=y direct=y recordlength=65535 statistics=none &
• Put transfer command into a script on jumphost. It’s something like this: SSH tunneling…
ssh -n oracle@SERVER1 'cat /whereverpipeis/fifo' | ssh oracle@SERVER2 'cat > /whereveritgoes/mnp.full.dmp
Please leme know if any clarification required. Any suggestion much appreciated.
Note: This can be used to transfer data across the network even it’s not a exp/imp
No comments:
Post a Comment