Professional Documents
Culture Documents
Practical:-2 Study and Usage of Backup and Recovery Technique. Backup
Practical:-2 Study and Usage of Backup and Recovery Technique. Backup
BACKUP:- Copies the data or log records from a SQL Server database or its
transaction log to a backup device, such as a disk, to create a data backup or log
backup. A copy of SQL Server data that can be used to restore and recover the data
after a failure. A backup of SQL Server data is created at the level of a database or
one or more of its files or filegroups. Table-level backups cannot be created. In
addition to data backups, the full recovery model requires creating backups of the
transaction log.
TYPES OF BACKUP:-
1. Cold backup:-
If your database is in noarchive log mode, then you can go with cold backup. for taking cold
backup follow the given steps to perform successful backup:
Sql>shutdown immediate;
Manually copy the data files, control files and redolog files to your desired destination.
Page 1
RDBMS-2 1504763
Sql>startup;
2. Hot backup:-
If your database is in archive log mode, then you can go with hot backup without any database
outage.
Execute the following command if you want to get the logs for hot backup in separate
logfile.
Manually copy data files, control files and redo log files to your desired destination
without shutting down the database.
3. RMAN Backup:-
Page 2
RDBMS-2 1504763
Figure1:- in below shows the start backup using RMAN. In below shows the information
About database.
Figure2:- in below shows all information about all RAMN configuration parameters.
Page 3
RDBMS-2 1504763
Figure3:-
Page 4
RDBMS-2 1504763
Page 5
RDBMS-2 1504763
Page 6
RDBMS-2 1504763
Page 7
RDBMS-2 1504763
Page 8
RDBMS-2 1504763
Copy the following command to connect to the target database without recovery catalog.
After connecting to the target or auxiliary database you will have the SYSDBA privilege.
RMAN>backup database;
Page 9
RDBMS-2 1504763
Rman>list backupset;
2.Its not possible to retrieve the data from the backup set. Therefore, you need to validate
the backup set.
To check whether the backup set is valid or not, copy the following command.
Shutdown the database and put in the mount mode to recover the database.
Rman>recover database;
Data guard is the new feature in Oracle 10g that let you transfer data from one location to
another at high speed.
Export Utility
Import Utility
1. Export utility: It is used to store the database objects in the storage media like disks outside
the database.
Page 10
RDBMS-2 1504763
2. Import Utility: It is used to load the objects to the database from the storage media.
Export operation:-
C:\>mkdir c:\backup
But if you faced the data loss issue and dont have a proper backup then in order to recover the
data you can go with Oracle Database Repair Tool but before getting into the recovery option
you must know the common oracle errors.
Flashback
Oracle Flashback Drop reverses the effects of a DROP TABLE operation. It can be used to recover
after the accidental drop of a table. Flashback Drop is substantially faster than other recovery
mechanisms that can be used in this situation, such as point-in-time recovery, and does not lead
to any loss of recent transactions or downtime.
Page 11
RDBMS-2 1504763
When you drop a table, the database does not immediately remove the space associated with the
table. Instead, the table is renamed and, along with any associated objects, it is placed in the
Recycle Bin of the database. The Flashback Drop operation recovers the table from the recycle
bin.
To understand how to use Oracle Flashback Drop, you must also understand how the recycle bin
works, and how to access and manage its contents.
Figure:- in below figure shows, if we delete any table from database and commit operation is
performed. And after few time in future if we need that table then we can recover that table using
timestamp of that table. Cmd is given below in below figure.
Page 12
RDBMS-2 1504763
Figure:- In below figure shows the example of recovery if any table is droped and we wants to
access that table then by using object_name and drop_time of that table will findout and select
Page 13
RDBMS-2 1504763
cmd is performed using that object_name of that table in the place of table_name. it will shoe
that droped table.
Figure:- Another way to get back your table back using Flashback table cmd before
droped the table.
Page 14
RDBMS-2 1504763
Figure:- if any table is delete from the database the commit operation is performed then (using
alter table tablename enable movement cmd if any error is there )
Page 15
RDBMS-2 1504763
Page 16
RDBMS-2 1504763
Page 17
RDBMS-2 1504763
CONTROL FILE:-
Every Oracle Database has a control file, which is a small binary file that records the physical
structure of the database. The control file includes:
Checkpoint information
TABLESPACES:-
The control file must be available for writing by the Oracle Database server whenever the
database is open. Without the control file, the database cannot be mounted and recovery is
difficult.
The control file of an Oracle Database is created at the same time as the database. By default, at
least one copy of the control file is created during database creation. On some operating systems
the default is to create multiple copies. You should create two or more copies of the control file
during database creation. You can also create control files later, if you lose control files or want
to change particular settings in the control files.
A database is divided into one or more logical storage units called tablespaces. Tablespaces are
divided into logical units of storage called segments, which are further divided into extents.
Extents are a collection of contiguous blocks.
Page 18
RDBMS-2 1504763
Bigfile Tablespaces
Undo Tablespaces
Read-Only Tablespaces
Page 19
RDBMS-2 1504763
DATA FILE:-
A tablespace in an Oracle database consists of one or more physical datafiles. A datafile can be
associated with only one tablespace and only one database.
Oracle creates a datafile for a tablespace by allocating the specified amount of disk space plus
the overhead required for the file header. When a datafile is created, the operating system under
which Oracle runs is responsible for clearing old information and authorizations from a file
before allocating it to Oracle. If the file is large, this process can take a significant amount of
time. The first tablespace in any database is always the SYSTEM tablespace, so Oracle
automatically allocates the first datafiles of any database for the SYSTEM tablespace during
database creation.
Size of Datafiles
Offline Datafiles
Temporary Datafiles
Page 20
RDBMS-2 1504763
LOG FILE:-
A file that lists actions that have occurred. For example, Web servers maintain log files listing
every request made to the server. With log file analysis tools, it's possible to get a good idea of
where visitors are coming from, how often they return, and how they navigate through a site.
Using cookies enables Webmasters to log even more detailed information about how individual
users are accessing a site.
DATABASE MODES:-
Non-Archive Log
Archive Log
Non-Archive Log
In NOARCHIVELOG mode, the filled redo log groups that become inactive can be
reused. This mode protects the database against instance failure, but not against
media failure.
Archive Log
In ARCHIVELOG mode, filled groups of redo logs are archived. This mode protects the
database from both instance and media failure, but may require additional hardware
resources.
Page 21
RDBMS-2 1504763
Practical 3
Study of Web Databases
3.1 Introduction
A web database is a system for storing information that can then be accessed via a website. For
example, an online community may have a database that stores the username, password, and
other details of all its members. The most commonly used database system for the internet is
MySQL due to its integration with PHP one of the most widely used server side programming
languages.
At its most simple level, a web database is a set of one or more tables that contain data. Each
table has different fields for storing information of various types. These tables can then be linked
together in order to manipulate data in useful or interesting ways. In many cases, a table will use
aprimary key, which must be unique for each entry and allows for unambiguous selection of
data.
A web database can be used for a range of different purposes. Each field in a table has to have a
defined data type. For example, numbers, strings, and dates can all be inserted into a web
database. Proper database design involves choosing the correct data type for each field in order
to reduce memory consumption and increase the speed of access. Although for small databases
this often isn't so important, big web databases can grow to millions of entries and need to be
well designed to work effectively.
Content management systems commonly use web databases to store information such as posts,
usernames, and comments. Using a database allows the website to be updated easily and without
the need to edit the HTML code for each individual page. Not only is this a much more efficient
way of creating and updating a website, but it also makes the process more accessible to people
who aren't fluent in the programming languages of the Internet.
An example of where a web database may be used is for an online forum. Forum software often
creates a database with a number of tables, including one for users, posts, and settings. It is
important for the relationships between the database tables to be properly set and defined so that
posts and users can be linked together easily.
Page 22
RDBMS-2 1504763
In some cases, web databases can be bought with information already included. For example, a
database could include a list of all the dentists in the US along with state and address. These
databases are commonly integrated into related websites using PHP and HTML, along with
additional content.
Analytic databases (a.k.a. OLAP- On Line Analytical Processing) are primarily static, read-only
databases which store archived, historical data used for analysis. For example, a company might
store sales records over the last ten years in an analytic database and use that database to analyze
marketing strategies in relationship to demographics.
On the web, you will often see analytic databases in the form of inventory catalogs such as the
one shown previously from Amazon.com. An inventory catalog analytical database usually holds
descriptive information about all available products in the inventory.
Web pages are generated dynamically by querying the list of available products in the inventory
against some search parameters. The dynamically-generated page will display the information
about each item (such as title, author, ISBN) which is stored in the database.
Operational databases (a.k.a. OLTP On Line Transaction Processing), on the other hand, are used
to manage more dynamic bits of data. These types of databases allow you to do more than simply
view archived data. Operational databases allow you to modify that data (add, change or delete
data).
These types of databases are usually used to track real-time information. For example, a
company might have an operational database used to track warehouse/stock quantities. As
customers order products from an online web store, an operational database can be used to keep
track of how many items have been sold and when the company will need to reorder stock.
As its name implies, the Hierarchical Database Model defines hierarchically-arranged data.
Page 23
RDBMS-2 1504763
Perhaps the most intuitive way to visualize this type of relationship is by visualizing an upside
down tree of data. In this tree, a single table acts as the "root" of the database from which other
tables "branch" out.
You will be instantly familiar with this relationship because that is how all windows-based
directory management systems (like Windows Explorer) work these days.
Relationships in such a system are thought of in terms of children and parents such that a child
may only have one parent but a parent can have multiple children. Parents and children are tied
together by links called "pointers" (perhaps physical addresses inside the file system). A parent
will have a list of pointers to each of their children.
This child/parent rule assures that data is systematically accessible. To get to a low-level table,
you start at the root and work your way down through the tree until you reach your target. Of
course, as you might imagine, one problem with this system is that the user must know how the
tree is structured in order to find anything!
The hierarchical model however, is much more efficient than the flat-file model we discussed
earlier because there is not as much need for redundant data. If a change in the data is necessary,
the change might only need to be processed once. Consider the student flatfile database example
from our discussion of what databases are:
As we mentioned before, this flatfile database would store an excessive amount of redundant
data. If we implemented this in a hierarchical database model, we would get much less redundant
data. Consider the following hierarchical database scheme:
Page 24
RDBMS-2 1504763
However, as you can imagine, the hierarchical database model has some serious problems. For
one, you cannot add a record to a child table until it has already been incorporated into the parent
table. This might be troublesome if, for example, you wanted to add a student who had not yet
signed up for any courses.
Worse, yet, the hierarchical database model still creates repetition of data within the database.
You might imagine that in the database system shown above, there may be a higher level that
includes multiple course. In this case, there could be redundancy because students would be
enrolled in several courses and thus each "course tree" would have redundant student
information.
Redundancy would occur because hierarchical databases handle one-to-many relationships well
but do not handle many-to-many relationships well. This is because a child may only have one
parent. However, in many cases you will want to have the child be related to more than one
parent. For instance, the relationship between student and class is a "many-to-many". Not only
can a student take many subjects but a subject may also be taken by many students. How would
you model this relationship simply and efficiently using a hierarchical database? The answer is
that you wouldn't.
Though this problem can be solved with multiple databases creating logical links between
children, the fix is very kludgy and awkward.
Faced with these serious problems, the computer brains of the world got together and came up
with the network model.
In many ways, the Network Database model was designed to solve some of the more serious
problems with the Hierarchical Database Model. Specifically, the Network model solves the
Page 25
RDBMS-2 1504763
problem of data redundancy by representing relationships in terms of sets rather than hierarchy.
The model had its origins in the Conference on Data Systems Languages (CODASYL) which
had created the Data Base Task Group to explore and design a method to replace the hierarchical
model.
The network model is very similar to the hierarchical model actually. In fact, the hierarchical
model is a subset of the network model. However, instead of using a single-parent tree hierarchy,
the network model uses set theory to provide a tree-like hierarchy with the exception that child
tables were allowed to have more than one parent. This allowed the network model to support
many-to-many relationships.
Visually, a Network Database looks like a hierarchical Database in that you can see it as a type of
tree. However, in the case of a Network Database, the look is more like several trees which share
branches. Thus, children can have multiple parents and parents can have multiple children.
Nevertheless, though it was a dramatic improvement, the network model was far from perfect.
Most profoundly, the model was difficult to implement and maintain. Most implementations of
the network model were used by computer programmers rather than real users. What was needed
was a simple model which could be used by real end users to solve real problems.
If your site requires updates and feeding information, a web Database Synchronization is the
solution. In short, this applies to Web sites that handle online products, news feed, members-
based subscription and other functions as well. Not only could a database facilitate access to
information but also to automate most of your daily tasks. For example, use a library mass
requires efforts in compiling and updating. However, if you have a database to play around, you
can connect your book online with your local brick and mortar shop. Get a couple of scanning
equipment and PC, updating your bookstore can never be easier than scanning bar codes!
Page 26
RDBMS-2 1504763
Of course; you can create your own web database, if you know a little about programming. It is
mainly working with tons of programming to do and not difficult provided you have an adequate
level of programming. One thing to note is: your database solid database requires security
measures to be implemented. For those who are determined to give it a shot, there are many
online forums that offer advice and support in the database construction.
The Database Synchronization is a development solution to provide high levels of data integrity
and security to facilitate efficient and reliable integration with the applications of the project. The
process of database development begins with the analysis made by analysts of customer needs
and requirements for determining the capability in planning and architecture solutions
accordingly. The design of a database depends on how data is stored and how they are linked.
Data modeling is done to decide how the future will be to manage database solutions. Specialists
of the DB (database) of logical patterns, relations between the entities and the DB modules to
ensure reliability and the strengthening of DB level of performance.
Although the design of a database of actions that the future DB solution perform are taken into
account. The amount of users and their types is decided. DB Database designers develop levels,
user roles andpermissions assigned to them according to the needs of clients and the database
logic. The database is designed with an eye on future prospects. It is well known that the
database of any application is developed as data processing increases. A good database is built on
the strategy which includes a good use of space to accommodate ever more data, watch for
possible applications, adding various features and options to optimize performance.
There are many languages web database to choose for your website, SQL Server, Access and
MySQL are the most popular. Each web language has its own strengths and limitations. A
popular choice is the language of the MySQL database is also a language of origin.
Page 27
RDBMS-2 1504763
Online - As the name suggests, an online database can be accessed from a web browser from
anywhere in the world. With Cloud Computing coming to the foreground, it is much easier to
host an online database in an elastic public cloud making it more scalable and secure.
Elasticity - A web-based-database can hold infinite data and is totally elastic in nature.
Whenever there is a surge in data flow, more storage space can be allocated and scaled up and
down based on requirement.
Multi-tenancy - A public cloud database is generally multi-tenant in nature. This means the
same database can be used by multiple customers on a shared model where you pay only for the
space you use.
Pay-Per-Use - Monthly subscription based pay-per-use model makes online databases look quite
lucrative where you do not need to invest a huge Cap-Ex on licensed software.
Security - One of the gravest concerns of using a web-database is security. With not many
security standards available in the Cloud Computing model, most of the users are worried about
putting their financial data online.
Switching - Another concern when selecting an online database is switching. Different databases
support different formats and switching from one to another becomes a pain thereby increasing
switching cost.
Downtime - There are times when the server can be down because of multiple reasons which can
lead to huge data loss and inaccessibility thereby causing great losses to customers.
The Oracle RDBMS stores data logically in the form of tablespaces and physically in the form of
data files ("datafiles"). Tablespaces can contain various types of memory segments, such as Data
Segments, Index Segments, etc. Segments in turn comprise one or more extents. Extents
comprise groups of contiguous data blocks. Data blocks form the basic units of data storage.
A DBA can impose maximum quotas on storage per user within each tablespace. Oracle is a
popular database software for database-driven web sites with high traffic.
Page 28
RDBMS-2 1504763
Oracle is a very powerful, robust and full featured SQL database system.
3.5.2 MySQL-
The worlds most popular open source database works on a relational database management
system (RDBMS) has source code available under the terms of the GNU General Public License.
MySQL is the most popular databases for web applications, and the most important ingredient of
a central component called LAMP also known as open source web application software where
LAMP is an acronym for Linux, Apache, MySQL, Perl/PHP/Python. which is and open source
projects that require a full-featured database management system MySQL hosting for web
applications.
3.5.3 PostgreSQL-
PostgreSQL is developed by the PostgreSQL Global Development Group. A database server with
object-relational database management system (ORDBMS) highlighting extensibility and
standards-compliance. From its different functions its primary job is to store data securely with
best practices to retrieve it later, as requested by applications. PostgreSQL is a cross-platform
database designed to run on many operating systems like Linux, FreeBSD, Solaris, and
Microsoft Windows. It is a standard default database server for Mac OS X.
3.5.4 MSSQL-
3.5.5 SQLite-
3.5.6 MS Access-
Page 29
RDBMS-2 1504763
A database management system from Microsoft MS Access (Microsoft Access) is the first
choice of Software developers, data architects to develop application software because it
supports different objects, including DAO (Data Access Objects), ActiveX Data Objects, and
many other ActiveX components. MS Access has relation with Microsoft Jet Database Engine to
deploy a graphical user interface. It stores data in its own format based on the Access Jet
Database Engine. It can also import or link directly to data stored in other applications and
databases.
Page 30