It’s been a little while since I’ve been able to dig into Autodesk Vault, but just this week, I had to locate a script to defragment the Vault database.
The reason for a defragment is to make sure Vault performance doesn’t degrade when making database queries. For those of us not intimate with SQL, those are Vault Searches.
A manual defrag can be kicked off from the ADMS Console on your server at any time. All you have to do is right click on the database you want to defrag, and choose “Defragment Database”.
A manual defrag from the ADMS Console
But the next warning will give you an indication that this isn’t a small feat.
You should read and heed this message!
The database will lock during a defragment, and the users won’t be able to use it. As a rule, this is undesirable during working hours.
What would be better, is if we could run it during off hours when nobody is accessing the server.
A script can be used to make sure you, as a CAD Manager, don’t have to log in during the dead of night to execute the command yourself. The script is just a text string that runs the same function as the command shown above.
An example of the script in Notepad. Click to enlarge this image.
This can be set to run as a Window Scheduled Task. You can let the server run this at a time of your choosing.
First of all, the text for the script is listed below. You can type this in Notepad. Also, it’s all one line of text. Don’t let the wrapping below fool you.
“C:Program FilesAutodeskADMS Professional 2016ADMS ConsoleConnectivity.ADMSConsole.exe” -Odefragmentvault -NVault -VUAdministrator -VP -S
There’s a lot of geeky sort of words and phrases in this script. So let’s break it down a little bit.
C:Program FilesAutodeskADMS Professional 2016ADMS Console
This line just opens up the directory where the executable file to run thee script is located. Note that it’s version specific if you use the default location.
To make sure I’ve got it right, I copy and paste the location into Windows Explorer. If it opens up the folder location with the file, Connectivity.ADMSConsole.exe in it, congratulations, it’s right.
Go get yourself a cookie!
Speaking of Connectivity.ADMSConsole.exe.
This one is pretty simple, it’s the executable file that starts Vault commands. In effect, it’s starting the ADMS Console without the interface.
This is the switch that tells Vault that a defragment is being done. Different switches can get Vault to do different functions, such as backup.
This is important! The -N is a switch tells Vault which Vault database is going to be defragmented. For example -NOlympus would defragment the Vault database named “Olympus”.
Often the user “Administrator”, the -VU switch tells Vault which user the Vault is using to run the defragmentation. The user running the script isn’t important, but they must be a Vault user with administrative permissions.
-VP This is the password for the user identified by the -VU switch. In my sample, it’s blank because my administrator doesn’t have a password.
Yes I know, this is a terrible practice. Do as I recommend, not as I do! (cheeky grin).
-S This runs the script silently. That means that it won’t show you any dialog boxes and wait for you to hit “OK”. It’s just going to chug along.
Now that all that is been explained, you can save this script with a *.bat extension.
Now, set it up as a Windows Scheduled Task, and you should be off and running!
It’s hard to give a solid schedule to run a defrag on, but I usually run my tasks about every six months or so, but that’s just what works for me. You’ll have to keep an eye on your Vault and see how it performs. You may be able to go longer or shorter depending on your personal experience.
If you want, you can always check the ADMS Console, if it says “Defragmention Recommended”, it’s probably a good idea to run that defrag!
One more tip, but this is a big one. Always! Always! Always! Make sure you close the ADMS Console interface when you log off your machine!
Vault will only allow one instance of the ADMS Console to run at a time! If you forget this step, the script won’t be able start. That means that no backups, defrags, or anything else that runs off Connectivity.ADMSConsole.exe will work!
You don’t want to see this message
The last thing you want to see is this message when you need a backup, and one hasn’t been running for six months because you forgot to close the ADMS Console!
In conclusion, good use of batch scripts can be a boon to making sure your Vault runs efficiently. It can eliminate the need to constantly log into run maintenance processes. Instead, you can let them run on a schedule, and just monitor to make sure the finely tuned system is still finely tuned.
The defragmenting script is one, the backup script is another. But there is a lot more that can be done.
For a full reference, check out this link from Autodesk here!