Results 1 to 5 of 5

Thread: Dump script

  1. #1
    Join Date
    May 2009
    Posts
    43

    Unanswered: Dump script

    Hi,

    Does anybody have dump script which runs on the Windows opertaing system. The script shold email or alert for error messages.

    please revert me as soon as possible.

    Thanks,
    Vineela

  2. #2
    Join Date
    Mar 2009
    Location
    Sydney, Australia
    Posts
    258
    It might sound like a simple request, starting out, the kind of thing a non-technical user requests. On the technical side there are many considerations: where do you want the dump files to go; would you like stripes or compression; do you have the transaction log maintained or not; etc. How resilient do you want it to be, recover and escalate on errors, or just fold and die; do you want operators informed regardless. Sure, always send an email with the error, but to whom, a list ?

    Most DBAs have a set of daily scripts, not only for dumps, but update statistics and dbcc. Weekly, you have to reorg, in various flavours. We have a setp of scripts, for all these functions, with various configuration options; escalation; send email; log all activity (you want to be ale to find a specific backup). The update stats and reorg scripts are designed to figure out and execute the minimun, in order minimise the downtime window. As such they are commercial scripts, drop me an email if you are interested.

    Windows (BTW not an o/s, although it is commonly called that) is legless is many areas, certainly in scripting, in CMD or BAT files. Most people get cygwin, which provides an Unix shell capability, and gives Windoze one leg. Then you have decent scripting capability, the simple scripts are easy enough to write. You can alternately use perl. Over time you can extend them, as you find and fix errors, add functions, implement changes due to ASE version changes, etc, and they will become more mature and resilient.
    Regards
    Derek Asirvadem (Formerly DerekA)
    Information Architect / Senior Sybase DBA
    Copyright 2009 Software Gems Pty Ltd

    I answer questions from the Original Poster only. If you have a genuine question, as the moderators have requested, start a new thread.

    http://www.softwaregems.com.au

  3. #3
    Join Date
    May 2009
    Posts
    43
    Dear Derek,

    Thanks for the response and the information your provided. I have four experince as Sybase DBA on Unix os. (First time,from last week I started working as Sybase DBA on Windows operating system.)

    I have experience in unix shell scripting but when it comes to windows I don't know what commands to use for mailing, search and etc(For eg: commands like mailx,grep, echo $?, compress , etc )

    The existing batch file does
    taking the backup of database with dump command (dump database dbname to "path details"), it doesn't send any email or alert if this dump fails.
    Simply taking the backup, doesn't do any other things.

    Here are the technical considerations:
    1. After taking the dump, we are placing it on the device drive present on the windows box (where the sybase server was built)
    2. I need the script for both the cases (stripes and compression)
    3. We are maintaining the transaction log ( As mentioned above my dump command in the script, immediately after finishing this they are running dump tran command). To my knowledge, first we have to run the dump tran after that dump database. If we are taking the complete backup, after that why do we need to run the dump tran command. Please suggest me on this.
    4. Now I want to put dump tran and dump database in different scripts and also change the timings.
    5. Current script overwrite the previous db dump file and tran dump file.
    Now I want to maintain 5 days dump files and two weeks transaction log files. The files should generate with the date in the file name.
    6. Also I want and email alert if database dump or transaction dump fails.
    7. If there is any errors in the error log and backup log also it should alert me through an email.
    8. I am expecting a output log file from each script.
    9. I also need the scripts for reorg, dbcc and update stats and space usage (regular set of daily scripts) which runs on windows. If you have, please provide the same.
    10. Here we don't have cygwin.

    Please let me know how can I achieve the above.

    Once again thanks for your detailed email.

    Regards,
    Vineela

  4. #4
    Join Date
    May 2009
    Posts
    43

    Regular scripts works on windows

    Dear Derek,

    Thanks for the response and the information your provided. I have four experince as Sybase DBA on Unix os. (First time,from last week I started working as Sybase DBA on Windows operating system.)

    I have experience in unix shell scripting but when it comes to windows I don't know what commands to use for mailing, search and etc(For eg: commands like mailx,grep, echo $?, compress , etc )

    The existing batch file does
    taking the backup of database with dump command (dump database dbname to "path details"), it doesn't send any email or alert if this dump fails.
    Simply taking the backup, doesn't do any other things.

    Here are the technical considerations:
    1. After taking the dump, we are placing it on the device drive present on the windows box (where the sybase server was built)
    2. I need the script for both the cases (stripes and compression)
    3. We are maintaining the transaction log ( As mentioned above my dump command in the script, immediately after finishing this they are running dump tran command). To my knowledge, first we have to run the dump tran after that dump database. If we are taking the complete backup, after that why do we need to run the dump tran command. Please suggest me on this.
    4. Now I want to put dump tran and dump database in different scripts and also change the timings.
    5. Current script overwrite the previous db dump file and tran dump file.
    Now I want to maintain 5 days dump files and two weeks transaction log files. The files should generate with the date in the file name.
    6. Also I want and email alert if database dump or transaction dump fails.
    7. If there is any errors in the error log and backup log also it should alert me through an email.
    8. I am expecting a output log file from each script.
    9. I also need the scripts for reorg, dbcc and update stats and space usage (regular set of daily scripts) which runs on windows. If you have, please provide the same.
    10. Here we don't have cygwin.

    Please let me know how can I achieve the above.

    Once again thanks for your detailed email.

    Regards,
    Vineela

  5. #5
    Join Date
    Mar 2009
    Location
    Sydney, Australia
    Posts
    258
    1. After taking the dump, we are placing it on the device drive present on the windows box (where the sybase server was built)
    Fine, but you should move it off the box, onto somewhere more secure, where you can access it to recover the db if the box is dead. Offsite is even better. No point having the dump_file on the box that was dumped, if it cannot be accessed. Think about disk failures as well.

    2. I need the script for both the cases (stripes and compression)
    RTFM

    3. We are maintaining the transaction log
    How exactly are you doing that (other than the dump tran after the dump dba) ?

    > (As mentioned above my dump command in the script, immediately after finishing this they are running dump tran command). To my knowledge, first we have to run the dump tran after that dump database.
    That is correct, but that is not "maintenance". The reason for dump tran before dump db is, to truncate the active part of the log, thereby leaving a small active portion, which then is very fast to roll-forward roll-back. If the system or ASE crashes, when it comes up, it has to roll-forward/roll-back the log, we want that to be small and fast, not have to roll-forward/roll-back the entire days work.

    Second, in the event that the db_dump_file is loaded, you do not want to sit there waiting for a days worth of transactions to be rolled-forward/rolled-back. If the log is dumped before the db is dumped, there is none of that work to be done.

    > If we are taking the complete backup, after that why do we need to run the dump tran command. Please suggest me on this.
    You don't need to. The people were uneducated, since they did not know the recovery issue, and since they are probably dumping the tran log only daily, they stuck it in after the dump db.

    4. Now I want to put dump tran and dump database in different scripts and also change the timings.
    Definitely. The tran log should be maintained (dumped) via a threshold stored proc, not via scripts; it is far superior to scripts and eliminates DBA attendance which is demanded if the log fills up (unplanned). (The single dump tran just before the dump db, in the dump db script, is a different issue, for a different purpose as detailed above.)

    5. Current script overwrite the previous db dump file and tran dump file.
    A very stupid thing to do.

    > Now I want to maintain 5 days dump files and two weeks transaction log files. The files should generate with the date in the file name.
    Yes, good idea. Keep it somewhere off the box, see my answer to [1].

    6. Also I want and email alert if database dump or transaction dump fails.
    Yes, that is ordinary. The way I have it set up, the Operator get alerts for success and failure (if they do not get an email, they know the script did not run); the DBA and DBO get alerts for failure only.

    7. If there is any errors in the error log and backup log also it should alert me through an email.
    That is different altogether, do not couple that with the backup script. You are better off with a separate monitor script that keeps checking the errorlog, for all errors (filter out the noise such as connection broken, dbcc messages), not just for backup but all the time; and send an email or page if there is an error.

    8. I am expecting a output log file from each script.
    Of course. You should produce:
    - a detailed log (all output from the isql "dump tran/db"). This can get overwritten.
    - a summary log of one or two lines per db, one per execution of the script. (I use that for the alerts)
    - the summary log is appended to a history log
    - the history log must be in a secure location. You need to be able to go back and find a dump (when/where/path) if the user needs to recover the db or a table from the db as of say 3 weeks ago. You need that in the worst case, to fix corrupted or damaged tables.

    9. I also need the scripts for reorg, dbcc and update stats and space usage (regular set of daily scripts) which runs on windows. If you have, please provide the same.
    Yes, we have all of those, but they are a commercial product, I am happy to answer questions and provide guidance, but I cannot post them here. If you are interested, drop me an email (go to my profile).

    10. Here we don't have cygwin.
    Easy to download. Trying to do all this in Windoze BAT files is not worth it. Our Sybase Administration scripts consist of stored procs plus /bin/sh scripts; for Winded customers, we implement cygwin, and then install the sripts.
    Regards
    Derek Asirvadem (Formerly DerekA)
    Information Architect / Senior Sybase DBA
    Copyright 2009 Software Gems Pty Ltd

    I answer questions from the Original Poster only. If you have a genuine question, as the moderators have requested, start a new thread.

    http://www.softwaregems.com.au

Posting Permissions

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