Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2008
    Posts
    23

    Unanswered: Backup with current timestamp

    hi ppl. i will like to do a .sql file to allow backup with current date

    dump database dbname to "/servername_dbname_currentdate"

    Any 1 can enlighten me?

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Code:
    declare @dumpfile varchar(50)
    select @dumpfile='/tmp/master_'+convert(char(8),getdate(),112)+'.dmp'
    dump database master to @dumpfile

  3. #3
    Join Date
    Mar 2008
    Posts
    23
    hi..thanks for the reply. just 2 more things.

    how do i include the server hostname in as well.

    and i have ver 11 sybase which it seems that this sql command doesnt work. Any idea?

  4. #4
    Join Date
    Jan 2004
    Posts
    545
    Provided Answers: 4
    Code:
    declare @dumpfile varchar(50)
    select @dumpfile='/tmp/'+@@servername+'_master_'+convert(char(8),getdate(),112)+'.dmp'
    dump database master to @dumpfile
    I'm not crazy, I'm an aeroplane!

  5. #5
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Quote Originally Posted by cghcgh
    and i have ver 11 sybase which it seems that this sql command doesnt work. Any idea?
    What is the error you get.
    I don't have access to a version older than 11.9.2 and it tested OK

  6. #6
    Join Date
    Apr 2005
    Posts
    10
    hi to all,

    sir pdreyer what if want to include all databases?

    declare @dumpfile varchar(50)
    select @dumpfile='/tmp/master_'+convert(char(8),getdate(),112)+'.dmp'
    dump database master to @dumpfile

    Thanks & Best Regards,
    dennis

  7. #7
    Join Date
    Mar 2008
    Posts
    23
    hi guys,
    i will just ignore the ver 11 for now.
    i wanted to run a simple .sql file which will list all database and dump them in the format as specify earlier. anyone can help out on this?
    Being googling several days but in vain.

  8. #8
    Join Date
    May 2008
    Location
    Cambridge
    Posts
    26
    Unfortunately, this is not 'simple' task. If you want to dump multiple db's then you will need a loop, and since you ideally want a 'go' for each dump command and you can't put a 'go' in a loop then you really need to think about writing a shell script.

    Failing that, you would need one long .sql file with a dump command for each database you want to dump.

    BR

    Bob
    Bob Holmes
    Sybase ASE/Replication Server Administrator
    Digital Data Safe - managed database services
    Email: bob.holmes@ddsafe.co.uk

  9. #9
    Join Date
    Apr 2007
    Location
    hyderabad
    Posts
    4

    Hi

    If you like you can go for a shell script it will be easy to make for it .just take out all databases and loop it to dump with date time .

    Also try doing cursors to do it ???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •