To start with, it seems necessary to set the scene. After that a technique will be described.
"What is a personal computer ?" - The short answer is that it is some
hardware.
There are a minimum of four parts to that Hardware:-
- A monitor, that is a screen to let human beings receive communications from the computer;
- A keyboard, a typewriter like thing to let human beings send communications to the computer;
- A mouse, a pointing device to let human beings send communications to the computer;
- The 'Box', that is to say the computer itself - the thing that does the computing !
"What makes the computer work ?" - a piece of software, a program called
an Operating System.
There are several choices of Operating System, of which two are Major:-
- Linux and its derivatives;
- Microsoft Windows.
"What is a server ?" - lots of folks will tell you that it is a different type of computer.
I am sorry to tell you that that does not have to be true. A personal computer with a piece of software,
a program called a Server Program can be called a server. So your Desktop or Laptop computer
can be a Server (as well as doing all of the other things that Personal Computers do do).
Server Software is a program that delivers information in a manner that can allow it to be displayed
in an Internet Browser.
There are several choices of server programs available for Microsoft Windows, of which two are Major:-
- The Apache Server Program;
- Internet Information Server (IIS) - from Microsoft (often supplied as an integral part of the Microsoft Windows Operating System.
"What is data ?" - in a computer, there are various types of data storage devices. Some of the devices are detachable - for example: floppy discs, CDs, memory sticks. Providing security for data on removable devices is a straightforward matter of physical storage arrangements which is not the concern of this WebPage.
The devices that are not easily removable are the hard discs. Hard discs contain files. The data held in these files is able to been divided into three groups for ease of consideration in this page:-
- Permanent-ish file, once on the disk, very unlikely to change
for example Program files - widely available if they should be lost from your PC; - Unchanging file being constantly added
picture files, sound files, EMails; - Dynamically changing files that are continually being updated by Real Time Transactions
Such files are likely to be Database tables.
The second Group can and should be covered by an 'As-You-Go' backup. There are many such products Autosave - Distributed by www.guildsoft.co.uk
The third Group is the one that this page is produced to cover.
Such data would normally be held in one or more databases.
The content of databases is normally protected by a technique called Mirroring.
"What are Databases ?" - they are special types of files held on a computer that can easily be 'added to', 'deleted from', 'modified' and 'read from'.
There are hundreds of different types of Database
For my own use and product development, I use three types of database regularly
they are :-
I have also used Oracle databases, but not recently.
"What is Mirroring ?" - it is a technique that uses a set of identical databases on a different computer. The other computer would normally in a completely physically different location. Imagine (heaven forbid) that the place where your computer holding the databases is completely wiped out by fire - if both the primary and the mirror computer were both in the same place, the effort involved in doing the mirroring would have been wasted.
The technique involves using software that watched all modifications to the primary database and replicates those modifications on the mirror databases.
The are several types of mirroring software available
AND/BUT
I find them to bit a expensive and a bit complex to set up.
So I developed my own !!
"What is Peter Byers' method of Mirroring ?"
A database must contain one or more tables.
I use something called SQL (Structured Query Language) to update tables in databases. (and something similar to it for XML files).
In the programs (or Active Server Pages - ASP) there are two distinct steps or lines in the program code / ASP script:-
- construct the SQL instruction string - for example, something like:
UPDATE telephone_table SET phone_no = '1235' WHERE full_name = 'Peter Byers'
- and then execute the SQL instruction string
That is it, that is all that is needed to update a database on a personal computer.
To look after Mirroring, I created a new database and table called datalog
The following fields are in that new table:-
- SQL instruction string;
- Database and table name;
- Name of the Computer on which the Mirror copies are held;
- Type of entry - there are three types;
- Update entry
- Start of Transaction
- End of Transaction If the Transaction does not complete satisfactorily, the Mirror database will not be updated
- Unique Transaction Ref;
- various other adminitration fields;
Next I decide on on or more computers on which the Mirror databases are to be held.
Copies of the Databases are installed on the Mirror computers.
Back to the primary computer.
I have written a function that writes entries to the datalog table, it is in an 'include' file that is included in all of my programs / ASP scripts.
Now there is an extra step in the code/scripts that update the primary database/tables, it now looks like:-
UPDATE telephone_table SET phone_no = '1235' WHERE full_name = 'Peter Byers'
For the purposes of demonstration, I have created four Web Pages:-
- A web page that manipulates and manages a Demo database/table on a public internet site;
- A web page that, once started, runs forever looking for and copying entries from the primary DataLog database/tables to the mirror DataLog database/table;
- A web page that, once started, runs forever looking for entries in the mirror DataLog database/table and updating the other mirror databases/tables
- A web page that looks at the contents of the mirror Demo database/table
You may be curious about why the second and third pages in the list have not been combined into one page.
It has been found that sometimes the working (that is all except DataLog) mirror databases/tables
need to be taken out of service for some reason, that is OK
BUT
it is important that the transfer of data to the mirror database/table should not be unnecessarily
interupted.
You may be interested to know that the second and third web pages are not used other than for demonstration - they have been replaced by background programs that are launched when the computer it powered up.
I probably do not need to tell you because it is obvious
BUT
I will tell you anyway - if you imagine that the mirror databases/tables are local ones and that the tables can be updated locally or on a primary computer on a public or other network. You will be pleased to know that the transfer of information between the DataLogs can be bi-directional.
If you want to talk about these techniques or see demonstrations of them, please feel free to contact me by EMail or Skype (pbyers) and we wil see what can be done.
Hopefully this page will have been interesting, maybe even useful.