
The docs now make sense to me. I would need to code a simple backup
something like this:
To Baclkup from program:
! *** Remove old files using language:
! *** Connect to DBMS
! *** Set Current Database
USE MyDatabase
! *** Remove Old Backup devices in the event their location changed in the
ini file.
EXEC sp_dropdevice BackupDBDevice
EXEC sp_dropdevice BackupLOGDevice
! *** Create New Backup devices with current ini information
EXEC sp_addumpdevice 'disk', 'BackupDBDevice',
'\\MyServer\MyShare\MyDatabaseData.dat'
EXEC sp_addumpdevice 'disk', 'BackupLOGDevice',
'\\MyServer\MyShare\MyDatabaseLOG.ldf'
! *** Backup files
BACKUP DATABASE MyDatabase TO BackupDBDevice
BACKUP BACKUP LOG MyDatabase TO BackupLogDevice
To restore from program:
! *** Remove old Tail Log using language:
! *** Backup latest Tail Log
EXEC sp_dropdevice BackupTailLOGDevice
EXEC sp_addumpdevice 'disk', 'BackupTailLogDevice',
'\\MyServer\MyShare\MyDatabaseTail.ldf'
BACKUP LOG MyDatabase TO BackupTailLogDevice
! *** Restore Database
RESTORE DATABASE MyDatabase FROM BackupDBDevice WITH REPLACE
RESTORE LOG MyDatabase FROM BackupLogDevice WITH REPLACE
*Optionally, restore the tail log.
I read about the LSN and how it works. I mapped out a plan of how MS or
some enterprising 3rd party could solve this problem. After I did, I found
out some enterprising 3rd party already had.
http://www.red-gate.com/products/SQL_Log_Rescue/walkthrough.htm. The cost of
the product is chump-change for what it does for MSSQL. MS should buy the
company. If I hadn't found this product, you probably wouldn't have heard
from me for awhile because I didn't want to hurt anybody's feelings. Without
the recovery capability that RedGate brings, I couldn't entertain using MSSQL
in any game that matters. The DB doesn't need to be perfect, and I wish the
triggers were more flexible, but this type of recovery capability to me is as
basic as you need skates to play hockey. In a big company, a lot of
information gets changed and added the database every minute. When a
catastrophe strikes, I need to be able to change the apps password, and cut
their connections so they go splat like bugs on a windshield when they try to
reconnect, and be able to quickly resolve the issue without losing data.
The real reason for my level of interest is I've been CIO at 2 companies and
have written 2 ERP programs for automotive suppliers that are fully
integrated including QS 9000, quality, shop floor, EDI, and coil management.
One company has seen the huge mistake they made by buying the number one rate
product rather than what the saw from me. Some people of that company
recognized that and when they started their own company, they wanted me to
write one for them, and now I'm getting the request again from another who is
also dissatisfied with their decision. (I was in a couple of magazines) I
need to make a DB decision, and decided to look at MSSQL again because of
their competent query optimizer. 2008 has added some sorely needed data
types and improvements. If the RedGate product is real, it seals the deal
for me. I can always add sophistication and redundancy to a backup plan as
long it has the basic recovery capabilities, and when combined with the
RedGate product, it appears to have what I need.
If you look at the RedGate product, they don't explain what they mean by the
warnings and things that need to be handled manually. Here's the deal. In a
larger company with sophisticated apps, you will get these. These problems
were created by decisions made by programs because of the disaster. E.G.
lets say someone does a truncate table on you or wipes the rows of needed
information. A lot of well-written apps will post exceptions and create rows
where needed if the basic information can be calculated from other sources in
order to heal itself and keep the ball rolling. However, when you do the
restore, the log will attempt to insert those auto-created rows into the DB
AFTER they've already been restored. In a manual system they simply don't
post and give you an error log. In an automated system, you can see what
they are ahead of time and resolve them them manually. In most cases you
just don't let the subsequent ones restore, so even the simple system isn't
that bad. You still have a record of what went haywire if you need to fix
it. The RedGate method is the common major league method of dealing with
this issue.
Thanks HUGE for your help!