zoukankan      html  css  js  c++  java
  • 使用Python备份数据库(Oracle)

    Read The Code!


    #!/usr/bin/python
    #coding=utf-8
    
    import threading
    import os
    import time
    
    #用户名
    user = 'username'
    #密码
    passwd = 'password'
    #备份保存路径
    savepath = '/home/oracle/orcl_bak/'
    #要备份的表
    tables = ' tables=department,employee'
    #备份周期
    circle = 2.0
    
    #备份命令
    global bak_command
    
    bak_command = 'exp '+user+'/'+passwd + ' file=' + savepath
    
    def orclBak():
    	now = time.strftime('%Y-%m-%d %H:%M:%S')
    	command = bak_command + now + '.dmp' + tables
    	print command
    	if os.system(command) == 0:
    		print '备份成功'
    	else:
    		print '备份失败'
    
    	global t
    	t = threading.Timer(circle, orclBak)
    	t.start()
    
    t = threading.Timer(circle, orclBak)
    t.start()
    

      

  • 相关阅读:
    IO流
    异常,File,递归,IO流
    Collection接口 map
    使用canvas画出的时钟
    js对象2
    js对象
    js 猜数游戏、斗地主发牌、伪数字
    js函数2
    js函数
    js矩形,数组,杨辉三角
  • 原文地址:https://www.cnblogs.com/localhost/p/2727476.html
Copyright © 2011-2022 走看看