当前位置:数据库 > SYBASE >>

Sybase ASA数据库自动备份的简易实现


Sybase ASA数据库自动备份的简易实现
 
主要就是通过它的Event功能来实现,Event如同定时任务,到时间就触发,触发时你可以调用很多东西。  www.zzzyk.com  
看看下边两个简单示例:
看看下边的两个简单的例子:
1. 从第一个磁带开始自动备份,每天零晨1点开始自动执行。
Instruct the database server to carry out an automatic backup to tape using the first tape drive, every day at 1 A.M.  
  
CREATE EVENT DailyBackup  
SCHEDULE daily_backup  
START TIME '1:00AM' EVERY 24 HOURS  
HANDLER  
   BEGIN  
      BACKUP DATABASE TO '\\\\.\\tape0'  
      ATTENDED OFF  
   END;  
 
2. 每天8点到下午6点,每个小时做一次事务日志的自动备份,备份到目录c:\database\backup
Instruct the database server to carry out an automatic backup of the transaction log only, every hour, Monday to Friday between 8 A.M. and 6 P.M.  
  
CREATE EVENT HourlyLogBackup  
SCHEDULE hourly_log_backup  
BETWEEN '8:00AM' AND '6:00PM'  
EVERY 1 HOURS ON  
   ('Monday','Tuesday','Wednesday','Thursday','Friday')  
HANDLER  
   BEGIN  
      BACKUP DATABASE DIRECTORY 'c:\\database\\backup'  
      TRANSACTION LOG ONLY  
      TRANSACTION LOG RENAME  
   END;   
 
这个功能,相比其它数据库而言,真是非常强大而且方便。
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,