我要实现的功能是每天晚上2点定时备份oracle数据库,以及可以随时进行恢复。
我准备用VC与一个程序实现该功能,我的思想是用exp进行备份,在VC中调用外部命令来实现备份。但有以下问题:
    VC下定时做事的方法如何实现,定时器只能定义间隔时间呀?请哪位达人详细讲解!

解决方案 »

  1.   

    设置定时器SetTimer
    加Dlg方法OnTimer  seesee MSDN
      

  2.   

    取得服务器上时间是用GetSystemTime,但如何判断呢,能否详细点。
      

  3.   

    我觉得你的这个问题用定时器的方法不好,
    同意 wuxuan(真心英雄) 的方法GetSystemTime
    The GetSystemTime function retrieves the current system date and time. The system time is expressed in Coordinated Universal Time (UTC). VOID GetSystemTime(
      LPSYSTEMTIME lpSystemTime   // address of system time structure
    );
     
    Parameters
    lpSystemTime 
    Pointer to a SYSTEMTIME structure to receive the current system date and time. 
    Return Values
    This function does not return a value. 
    SYSTEMTIME
    The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond. typedef struct _SYSTEMTIME {  // st 
        WORD wYear; 
        WORD wMonth; 
        WORD wDayOfWeek; 
        WORD wDay; 
        WORD wHour; 
        WORD wMinute; 
        WORD wSecond; 
        WORD wMilliseconds; 
    } SYSTEMTIME; 
     
      

  4.   

    怎么定义变量获取当前时间呢?
    我是这样定义的:
    SYSTEMTIME mm;
    GetSystemTime(mm);
    结果mm得出来的值好象不对,而且mm如何跟(02:00)进行比较呢?
    能否详细点,谢谢!
      

  5.   

    SYSTEMTIME mm;
    GetSystemTime(&mm);再试试
      

  6.   

    用定时器确实不好,OS是WIN2000吗?是的话,我就有好办法!!!!!!!!
    呵呵
      

  7.   

    你可以定义一个1分钟的定时器,每一分钟判断是不是到了指定的时间,取得当前的时间可以用
    GetSystemTime 或 CTime类.
      

  8.   

    呵呵,用windows的任务管理器,2点执行备份程序,然后退出。
    简单吧:)
      

  9.   

    算了;不卖关子了!!!!!!WinExec("cmd.exe \c AT 2:00 "C:\oracle\bin\exp.exe ")........
      

  10.   

    具体可到DOS窗口查看 AT 命令
      

  11.   

    用CreateWaitableTimer
    SetWaitableTimer等
      

  12.   

    nbgyf(梅花峰) ,好象有问题哦你的命令行不通,至少少了一个分号呀你再看看,写出完整的来,能用,就给分了。
      

  13.   

    我的备份数据库的命令是:
    exp yangfan/manager@multi file=ibms%date:~4,10%.dmp
    请问要如何用ShellExecute来写呢。