#!/usr/bin/env python
# -*- coding:utf-8 -*-
import paramiko
import time
mydate = time.strftime("%Y%m%d")
hostname="192.168.56.56"
hostname=‘%s‘ %hostname
port=22
port=int(port)
username="oracle"
username=‘%s‘ %username
password="oracle"
password=‘%s‘ %password
transport = paramiko.Transport((hostname,port))
transport.connect(username=username,password=password)
sftp = paramiko.SFTPClient.from_transport(transport)
remotefile=‘/data/db_bak/expdp_‘+mydate+‘.dmp‘
localfile=‘/tmp/expdp_‘+mydate+‘.dmp‘
sftp.get(remotefile,localfile)
transport.close()
时间: 2024-10-19 12:17:07