the Database Backup and Restore document

advertisement
PROJECTIONS SUITE
DATABASE BACKUP AND
RESTORE: BEST PRACTICES
Why should you back up your database?
There are three primary reasons for performing a database backup. One is to protect your data.
As you go through the projections cycle, you will constantly be making changes to your data – importing
employment, variables, staffing patterns, and other data items; defining models for industry projections;
calculating industry and occupational projections; and making adjustments to projected values. If a
technical problem on your hard drive or network server causes the database to become corrupted, days
or even weeks of work can be wiped out.
Another reason for backing up your database is to provide a benchmark point during your
projections cycle. For example, once you have finished your industry projections, you might want to
make a backup copy of your database before beginning your occupational projections. If you get into
the occupational projections process and decide you want to start over, you have a copy of the database
as it existed before you started the occupational side of the cycle. Restoring the database from that
backup allows you to easily start the occupational projections again.
The final use of a backup is to serve as a “final” database for the projections cycle. You can back
up the database once this cycle is done, move the backup copy to another medium such as a backup
drive or server, and have a permanent copy of the results of the projections cycle.
When should you back up your database?
At the start of a projections cycle: This provides you a “baseline” point from which to start your
projections. If you experience severe data problems and want to “reboot” the process, this gives you an
easy way to do so.
Right after importing and pre-adjusting your employment and variable data: If you need to
restart the modeling process, you won’t have to go all the way back to the beginning and re-import the
data.
After industry projections are complete: There is a natural procedural dividing line between
industry and occupation projections. Backing up the database at this point allows for restarting the
occupation projections without going all the way back to the industry projections.
After occupation projections are complete: This backup should be done before sending
projections out for review or publication.
But most importantly….
Regardless of the above, you should back up your database any time you’ve completed a
significant task. Backing up the database helps you avoid having to do that task twice! (Projections
Suite can help you with this by allowing you to back up the database every time you exit the program.
More about this later.)
What is SQL Server Management Studio?
You’ll see references to this application every so often. SQL Server Management Studio is a free
download from Microsoft that allows users to directly manipulate their SQL Server installation. The
program allows you to create, change, and update databases, perform backups and restorations, and do
other maintenance tasks – assuming the user has the administrative rights to do so. It’s designed for IT
support people, but is relatively easy to use.
However, Management Studio can be dangerous to play around with. In particular, Projections
Suite users should NOT change or alter the Projections Suite database structure, tables, keys, or data in
any way. Doing so can cause Projections Suite to stop working completely. But as long as you’re only
using Management Studio for things like simple backups and restorations or nonintrusive data queries,
it’s quite safe.
What does the backup process do?
It creates a file that contains all the information needed to duplicate your SQL Server database
file in the directory you specify, and includes any system log files. The file name includes a “timestamp”
to identify when the backup was done. For example, the database file ProjectionsSuite.mdf, if backed
up on August 3, 2013, at 2 pm, would produce a backup file named
ProjectionsSuite.2013.08.03.14.00.00.sqldb.bak. The backup file is not itself usable as a database, but it
contains all the information necessary to recreate the database.
What does the restore process do?
It reads the backup file and creates a new version of the database on the SQL Server to which
you’re connected. If the old database still exists, it’s replaced. If the old database exists, but the backup
file wasn’t created from it, the restore won’t continue. (In other words, you can’t use the backup of one
database to replace a database on another machine somewhere.) However, if you’re using SQL Server
Management Studio, you can tell the restore process to rename the database as it’s being created. For
example, a backup of ProjectionsSuite could be used to create a database called ProjectionsSuite1.
However, you can’t do this when restoring with the database install tool.
What are the most important things to remember when backing up and
restoring my database?
If your database is on a network server, Projections Suite cannot perform the backup operation.
You must either (a) perform the backup yourself, using SQL Server Management Studio, or (b) have an IT
support person perform the backup. Option (a) assumes that you have the administrative rights to do
this task on a server in your state. This will not be the case in most states. Therefore you will want to
coordinate your database backups with your IT support – for example, setting up a regular schedule of
backups.
Projections Suite cannot restore the database from a backup. You must use the database install
tool for this task, or else SQL Server Management Studio. In any case, performing the restore may
require more permissions on the machine than you may have. Your SQL Server account must have the
“sysadmin” and “dbcreator” permissions, and you must be a “db_owner” for the Projections Suite
database. If you do not have these account settings, an IT support person will need to perform the
database restore, regardless of whether the database is on your own machine or a network server.
The number of backup copies kept in the backup folder is determined by a setting in Projections
Suite. The default number is 10, but you can change this through the Settings tab. As an example, if the
setting is 10, on the 11th backup the oldest version is “pushed out” and removed from the folder.
You won’t be able to rename your database when restoring it in the database install tool. Do
NOT try to rename the database in SQL Server Management Studio unless you are a VERY experienced
user of the tool! It can lead to problems, and your database may become unrecoverable.
How do I set the database backup path?
Use the option in the database install tool. (This option will be disabled if your database is on a
network server.)
Or, you can edit the DbBackupFolder entry in the ProjectionsSuiteSettings.ini file. BE VERY
CAREFUL to not disturb any of the other settings. You will find this file on the desktop.
How do I back up my database?
Use the Projections Suite menu item, if the database is on your machine. This option is on the
Utilities tab for both the Short Term and Long Term menus.
Just click on the menu item. The backup proceeds automatically. When finished, you will get a
message telling you of the successful completion.
If there was an error during the backup, you will get a message informing you.
You can also use the Projections Suite option to back up the database every time you exit the
program. If you click on the Settings tab, you’ll find options for backing up the database when the
program closes, as well as the number of backup copies to keep in the backup directory (the default
number is 10).
Optionally, use SQL Server Management Studio.
If the database is on a network server, an IT support person must do the backup, using SQL
Server Management Studio or some other database administration tool.
How do I restore my database?
Use the restore option in the database install tool, if the database is on your machine and you
have rights to use the tool. If you don’t have the rights, an IT support person must do this.
If the database is on a network server, an IT support person must do the restore, using SQL
Server Management Studio or some other database administration tool.
Where do I go to get answers to questions about backing up/restoring my
database?
If you have questions about which administrative rights you have on your computer, you should
contact the IT support unit for your department or agency. They will be able to assist you with this
information, and grant any rights you may need provided granting those rights falls within the
parameters of your state’s IT policies.
If you need help with questions about the Projections Suite database itself, or how to perform
the backup or restore process, you can contact any of the Projections Suite technical support staff in
Utah.
Download