|
||||
|
|
Friday, November 05, 2004Analyzing, Repairing, and Archiving Visual SourceSafe
One thing you want to do regularly is analyze your Visual SourceSafe database for errors. You should also back it up periodically. What most people don't know is that VSS comes with utilities that make repair & backups a snap, as long as you wrap them in a few handy batch/script files. These scripts assume you're running Norton Antivirus and that your sourcesafe database is in the default "C:\Program Files\Microsoft Visual Studio\Common\VSS\data" location.
Here's an example of a script you can run to analyze your SourceSafe database for errors. It can't repair the errors, because you have to kick people out & lock the database in order to fix errors or back it up. But it can't hurt if you're wondering how badly corrupted your db is. ===interactive_analyze_vss.bat=== Here's a script that will lock the database and repair any errors. You may have to run it a few times in a row to clean up the last of the errors. ===offline_analyze_and_fix_vss.bat=== Here's a script that will back up your database to a flat file. You can then stick this file onto tape or CD for archiving, or use it to restore your database in case of total corruption. You can also use this file to restore your database onto a different machine in case you want to move your sourcesafe database. ===offline_backup_vss.bat=== Lastly, here's a script that will tell you the "real" filename for each of the files within the SourceSafe data directory. When your VSS database gets corrupted and you're having trouble with a certain file, you can use the PHYSICAL.TXT file that this script generates to determine where to look. e.g. myfunctions.cs is corrupted, and PHYSICAL.TXT tells you that "IVHAAAAAA == myfunctions.cs", then you can look in the VSS data directory for files starting with "IVHAAAAAA", open them in notepad, & maybe salvage myfunctions.cs from the info within. Conversely, if VSS analysis tells you that IVHAAAAAA is having serious issues, you'll know that myfunctions.cs is impacted, and take appropriate action (shrug your shoulders, freak out, etc.). ===list_physical_files.vss=== These scripts came in handy one day when we had problems with our VSS box. A developer went to check in his work and got an error, and found that not only did he lose his local copy, but the version in sourcesafe was corrupt as well. Zero kb, and unable to get previous versions. Days of work potentially lost. We ran the analyze&fix job a few times to no avail. So then we ran list_physical_files & found out which VSS data file contained his code (e.g. "ismaaaaa"), then looked into VSS's data directory & saw ismaaaaa, ismaaaaa.a, and ismaaaaa.b. We open each of those in notepad & saw that ismaaaaa.a contained his latest code. We then copied the contents of ismaaaaa.a into a new file, renamed that to the source code file he was working on, checked that back into sourcesafe, and the day was saved. The moral of the story: use the above scripts as a starting point to troubleshooting, repairing, and archiving your SourceSafe databases. Update: just read something that implies running "net stop server /y" will kick off users. So until I get a chance to update (and test) the scripts, try sticking "net stop server /y" before the "lock vss" step, and "net start server" after the "unlock vss" steps. What's the worst that can happen? :)
view current posts
Comments:
You can also check out some VSS restore scripts at http://www.developmentnow.com/blog/2004/12/sourcesafe-restoration-with.html
Post a Comment
Archives September 2004 October 2004 November 2004 December 2004 January 2005 February 2005 March 2005 April 2005 |
|||
| ||||