Documente Academic
Documente Profesional
Documente Cultură
The first step in creating a database is creating a plan that serves both as a guide to be used when implementing the database and as a functional specification for the database after it has been implemented. The complexity and detail of a database design is dictated by the complexity and size of the database application and also the user population. The nature and complexity of a database application, and also the process of planning it, can vary significantly. A database can be relatively simple and designed for use by a single person, or it can be large and complex and designed, for example, to handle all the banking transactions for thousands of clients. In the first case, the database design may be slightly more than a few notes on some scratch paper. In the latter case, the design may be a formal document hundreds of pages long that contains every possible detail about the database. In planning the database, regardless of its size and complexity, use the following basic steps: Gather information. Identify the objects. Model the objects. Identify the types of information for each object. Identify the relationships between objects.
Gathering Information
Before creating a database, you must have a good understanding of the job the database is expected to perform. If the database is to replace a paper-based or manually performed information system, the existing system will give you most of the information that you need. You should interview everyone involved in the system to determine what they do and what they need from the database. It is also important to identify what they want the new system to do, and also to identify the problems, limitations, and bottlenecks of any existing system. Collect copies of customer statements, inventory lists, management reports, and any other documents that are part of the existing system, because these will be useful to you in designing the database and the interfaces.
bicycle, the vendors that sell components used to manufacture the bicycle, the customers who buy them, and the sales transactions performed with the customers. Each of these objects is a table in the database.
2. Question: Ive been using database snapshots since SQL Server 2005 was released but recently Ive been having problems where the snapshot becomes unavailable because there isnt enough space. Ive read that a database snapshot reserves space when it is created, so how can it run out of space? Answer: Unfortunately what youve read is incorrect. A database snapshot does not reserve space when it is created so it is quite possible for it to run out of space (and hence become unusable). Database snapshots use NTFS sparse filesyou can have an arbitrarily large file that takes up very minimal space on disk. For instance, a 100GB sparse file that contains 2MB of data at offset zero in the file, and 3MB of data at offset 64MB in the file will only occupy 5MB of disk space instead of 100GB. NTFS keeps track of which offsets in the file contain data and stores all the data in a compacted form so that minimal space is required. This is the same concept as sparse arrays in programming languages.
effectively undermine the cluster's fault tolerant capabilities. Even if the storage system contained fully redundant hardware and was on a backup generator there are still things that could happen that would cause the storage system to fail. One example of such a situation is that the facility containing the storage system could be destroyed during a hurricane, fire, etc. A less dramatic, but equally disruptive situation involves database corruption. If the database were to suddenly become corrupt for some reason, the cluster would come to a grinding halt until you restored the database from backup. The point is that no matter how much work you put into planning a cluster, there are always going to be situations beyond your control that could theoretically cause the cluster to fail. Therefore one of the most important considerations in planning the cluster should be whether the cost of downtime warrants the cost of the cluster. I have been in IT for long enough to know that although the statement is sometimes unrealistic, no amount of downtime is acceptable. That being the case, what I'm about to tell you probably won't be very popular with most of you who are reading this. Even so, I firmly believe that it is very important to look at cluster implementation cost and the cost of downtime from a business standpoint, not just from the standpoint of some idiot manager who tells you that downtime is completely unacceptable.
Facility considerations
To see why this is the case, let's go back to my example in which a hurricane destroys the facility containing the cluster storage system. For enough money, you could create a backup storage system in another city (preferably away from the coast). You could also devise a method of keeping that backup storage system somewhat current, and automatically rerouting the cluster to use the backup storage system in the event that the primary storage system fails. Obviously, this type of failover system would cost a huge amount of money. Suppose however that the database application that the cluster is hosting is not something that's accessible over the Internet. Instead ,it hosts a business critical database that is only used internally by employees of your company. If all of your employees work in the same city as the primary storage system resides in, then having a backup storage system in another city is probably pointless. If the city were to be devastated by a hurricane, then what you think the chances are of the main office even having electricity? Even if you were to bring in generators and some of the computers were still functional, what do you think the odds are that employees will actually come into the office? If you have never been through a hurricane, I can tell you that the chances are of the employees coming to work are pretty much the row ,because mandatory evacuations. My point is that it is possible to spend a fortune on the underlying infrastructure that would make a cluster continue to function during times of crisis, but doing so is not always a wise investment. It does little good to spend good money ensuring that a cluster never fails if no one is even able to benefit from the cluster's availability in times of crisis.
in an effort to increase its performance and to provide a degree of fault tolerance. Let's also assume that users from other offices in other cities also use the database and that these users place a considerable strain on your WAN link by accessing the database application from a remote site. If that were the case, then it might seem logical to create a geographically dispersed cluster. By doing so, you can allow users to access the application from servers located within their own facility, thus improving the end user experience, and relieving the congestion on your WAN link. Forgetting about fault tolerant issues, the biggest problem with this particular deployment scenario would be the cost. First, you would have the expense of purchasing server hardware and software for each cluster node. The cost of server hardware and software would pale in comparison to the connectivity cost though. Even in a geographically dispersed cluster, all of the cluster nodes must maintain reliable, high-speed connectivity to the central data store. This means that you would have to construct a Storage Area Network(SAN) then it would be used to connect the various sites to each other. In addition, you would still need to keep your existing WAN links so that user sand remote sites would be able to access other types of data from servers locate data the corporate headquarters. What all this boils down to is the fact that you're going to have to make some big decisions weighing the cost of the cluster against its benefits. On one hand, creating this type of cluster would accomplish the goal of relieving the congestion on your WAN link and improving the end user experience. It would not however provide true fault tolerance to users in the remote locations. You could use redundant hardware to improve the fault tolerance level of cluster nodes in remote locations. That way, if a cluster node were to fail then another server in the remote location would continue to function, and the users would probably be none the wiser that a failure had occurred. The problem is that if the link between the remote site an data the corporate headquarters were to fail, then the cluster itself might as well have failed (at least from the perspective of users and the remote location). To provide true fault tolerance, you would need redundant SAN connectivity, which would increase the cost of the project exponentially.
a cluster is the ideal solution to an IT problem. In Part 2 of this article series, I will continue the discussion of planning a server cluster. DATABASE PROBLEMS AND SOLUTIONS
This week was a hard programming week at work and I had to reface the hardships of database programming in Java with JDBC. On Monday morning I decided to solve the quotes problem when inserting and updating into the database. As in most programming languages, SQL gets quite upset when certain special characters are used incorrectly. In SQL's case the single quote (') is the trouble maker because it has a special use to enclose a character / string value. If you've got a field and a user types in a single quote the single quote must first be "escaped" by inserting another quote, before adding it to the insert statement. So for example insert into remarks value ('I don't want to drive'); must become insert into remarks value ('I don''t want to drive');. My first attempt at solving this problem was to use the replace All() function in Java to replace all ' by '', for each field. This method is cumbersome and not very elegant, so I had to look for a better solution. The answer was to use the Prepared Statement object instead of the Statement object to update values in the database. Apart from solving the quotes problem the Prepared Statement precompiles the SQL statement passed as a parameter, thus making it faster than the normal statement. For more information of the usage of the Prepared Statement object see Sun's Java JDBC basic tutorial. While I was learning how to use the Prepared Statement object I stumbled across a new connection leakage error. The actual error was: ORA-01000 maximum open cursors exceeded. To help me analyse the fault better I found two SQL statements to document the number of open cursors in the database:SQL Statement 1: List of al open cursors, users and the SQL executed. select user_name, status, osuser, machine, a.sql_text from v$session b, v$open_cursor a where a.sid = b.sid; SQL Statement 2: The number of truly open cursors. select a.value, b.name from v$mystat a, v$statname b where a.statistic# = b.statistic# and a.statistic# = 3; The culprit for the error was that I was had an unclosed Prepared Statement well hidden inside a loop. Although it was not so difficult locating the error, the problem was not fixed immediately by changing the code, so I started going around in circles looking for problems that didn't exist. The reason for this was that Oracle frees the inactive connections every 15 minutes (this might be dependent on a database parameter [INITSID.ORA]), so the open cursors had to be freed before the code could work. This week I had very little time to experiment with common applications but I found a quick way to load Adobe Acrobat faster i.e. without loading the plug-ins. To do this all you've got to do is press [Shift] while the program is loading. Apparently this feature also works with other programs that load plug-ins.