The difference between an ORACLE instance and a database

People who are new to ORACLE will definitely be confused about instances and databases. What exactly does an instance represent? Why does this concept appear?
ORACLE instance = process + memory used by the process (SGA)
instance is a temporary thing, you can also think that it represents the state of the database at a certain moment!
Database = Redo File + Control File + Data File + Temporary File The
database is permanent and is a collection of files. The relationship between the
ORACLE instance and the database 1.
Temporary
and permanent ) and open (alter database open) a database 4. A database can be loaded and opened by many instances at the same time (ie RAC), the role of the instance in the RAC environment can be fully reflected! The following is a detailed explanation of the instance and database: There are two words in the Oracle field that are easily confused, which are "instance" and "database". As Oracle terms, these two terms are defined as follows: q Database (database): A collection of physical operating system files or disks. When using Oracle 10g's Automatic Storage Management (ASM) or RAW partitions, the database may not be a separate file in the operating system, but the definition remains the same. q












Instance (instance): A set of Oracle background processes/threads and a shared memory area shared by threads/processes running on the same computer. Volatile, non-persistent content can be maintained here (some can flush output to disk). A database instance can exist even without disk storage. Instances may not be the most useful thing in the world, but you can think of them as the most useful thing, which helps to draw the line between instances and databases.
The two terms are sometimes used interchangeably, but they have completely different concepts. The relationship between an instance and a database is that a database can be loaded and opened by multiple instances, and an instance can load and open a database at any point in time. In fact, an instance can mount and open at most one database during its entire lifetime, to be precise! An example of this will be presented later.
Are you more confused? We'll explain further, which should help you understand these concepts. An instance is a set of operating system processes (or a multithreaded process) and some memory. These processes can operate on the database; the database is just a collection of files (including data files, temporary files, redo log files, and control files). An instance can only have one set of related files (associated with one database) at any one time. In most cases, the reverse is also true: only one instance on a database operates on it. The exception, however, is Oracle's Real Application Clusters (RAC), an option provided by Oracle that allows operation on multiple machines in a clustered environment, so that multiple instances can be mounted and one open at the same time. Database (on a set of shared physical disks). From this, we can access this database from many different computers at the same time. Oracle RAC supports highly available systems and can be used to build extremely scalable solutions.


An instance can mount and open at most one database during its lifetime. To reopen this (or other) database, the instance must be dropped and a new one created.
To reiterate:

an instance is a set of background processes and shared memory.

A database is a collection of data stored on disk.

Instance "lifetime" can only mount and open one database.

Databases can be mounted and opened by one or more instances (using RAC).
As mentioned earlier, in most cases, there is a one-to-one relationship between the instance and the database. Perhaps because of this, it is easy to confuse the two. From the experience of most people, the database is the instance, and the instance is the database.
However, in many test environments this is not the case. On my disk, there can be 5 different databases. There is only one Oracle instance running on the test host at any point in time, but the database it accesses can vary from day to day (or even hourly) depending on my needs. As long as there are different configuration files, I can load and open either database. In this case I only have one "instance" at any time, but multiple databases, only one of which can be accessed at any point in time.
So, you should know by now that if someone talks about instances, he's referring to Oracle's processes and memory. When referring to a database, we mean the physical file that holds the data. A database can be accessed from multiple instances, but only one database can be accessed by an instance at a time.


1. In the oracle database system, can the DBMS manage multiple database instances? Or do I need an oracle service to manage an instance?

A database system in oracle can have multiple instances. You can run dbca, and in the interface you can see that you can create new instances, but in most cases, oracle just creates an instance.

2 It is possible to establish two dbs for educational affairs database and financial database

, but the usual practice is to build two more users on different tablespaces. One user stores the table data of the educational affairs database, and the other stores the table data of the financial database.

3. Which level does the schema in Oracle belong to?
In simple terms, schema can be understood as a user and all objects owned by the user. In fact, it is equivalent to the sqlserver library.

4.oracle to do so.
create user Test;
grant [connect,...]to Test;
create table...
Create tables and other objects belonging to this user, can this number of users be represented as an application db?

Like 3, you can understand that a user and all the objects under the user are actually the db in the sqlserver. In the actual production environment, in order to reduce costs and make full use of the resources of the oracle database, we are one project, one user, one Apply a user, and then create corresponding tables, views, stored procedures, stored functions, sequences, etc. under different users.

Let's look at a simple example. Suppose we just installed Oracle 10g10.1.0.3. We perform a pure software installation, excluding the initial "startup" database, with nothing but software.

The current working directory can be known through the pwd command (this example uses a Linux platform computer). Our current directory is dbs (or database directory if on Windows platform). Executing the ls -l command shows that this directory is "empty". There is no init.ora file, nor any stored parameter file (SPFILE); stored parameter files are discussed in detail in Chapter 3.

The difference between an Oracle instance and a database - ly - ly's blog

Using ps (process status) command, you can see all the processes run by the user ora10g, assuming that ora10g is the owner of the Oracle software. There are no Oracle database processes at this point.

The difference between an Oracle instance and a database - ly - ly's Blog

Then use the ipcs command, this UNIX command can be used to display inter-process communication devices such as shared memory, semaphores, etc. No communication equipment is currently used in the system.

The difference between an ORACLE instance and a database - ly - ly's blog

Then start SQL*Plus (Oracle's command line interface) and connect as SYSDBA (the SYSDBA account can do anything in the database). After a successful connection, SQL*Plus reports that we are connected to an idle instance:

Difference Between an ORACLE Instance and a Database - ly - ly's Blog

Our "instance" now includes only one Oracle server process, as shown in bold in the output below part. No shared memory has been allocated at this point, and no other processes are present.

The difference between an

Oracle instance and a database - ly - ly's blog

The ORACLE

instance and a database - ly - ly's blog

To have a file, we need to have a parameter file (a simple flat file, which will be explained in detail later), or a storage parameter file. Now create the parameter file and put in the minimum information needed to start the database instance (usually specify more parameters like database block size, control file location, etc.).

Difference

Between

ORACLE Instance and Database - ly - ly's Blog

The difference between an Oracle instance and a database - ly - ly's blog here adds the nomount option to the startup command, because we don't want to actually "mount" the database yet (see the SQL*Plus documentation for all options for startup and shutdown).

Note

Before running the startup command on Windows, you also need to execute a service creation statement using the oradim.exe utility.

Now there are so-called "instances". The background processes required to run the database are available, such as process monitor (PMON), log writer (LGWR), etc. These processes will be described in detail in Chapter 5.

The difference between an Oracle instance and a database - ly - ly's

blog After using the ipcs command, it will report for the first time that shared memory and semaphores are used, which are two important inter-process communication devices on UNIX:

Difference between an Oracle instance and a database - ly - ly's blog

Note that we don't have a "database" yet! At this point, there is only the name of the database (in the created parameter file), not the actual database. If you try to "load" the database, it will fail because the database doesn't exist. Now let's create the database. Some people say that creating an Oracle database is a tedious process, is that true? Let's take a look:

The difference between an ORACLE instance and a database - ly - ly's Blog

Creating a database here is as simple as that. But in practice, you might want to use a slightly more complicated CREATE DATABASE command, because you might need to tell Oracle where to put the log files, data files, control files, etc. However, we now have a fully operational database. It may also be necessary to run the $ORACLE_HOME/rdbms/admin/catalog.sql script and other catalog scripts to build the data dictionary we use every day (some of the views we use, such as ALL_OBJECTS, are not yet in this database), but regardless How to say, the database already exists. You can simply query some Oracle V$ views (specifically V$DATAFILE, V$LOGFILE, and V$CONTROLFILE) to list the files that make up this database:

Difference between an ORACLE instance and a database - ly - ly's blog

Oracle uses default settings, Put everything together and create the database as a persistent set of files. If you close the database and try to open it again, you will find that the database cannot be opened:

Difference between an ORACLE

instance and a database

and open a database. To reopen this (or other) database, the instance must be dropped and a new one created.

To reiterate:

1. An instance is a set of background processes and shared memory.

2. A database is a collection of data stored on disk.

3. Instance "lifetime" can only load and open one database.

4. The database can be mounted and opened by one or more instances (using RAC).

As mentioned earlier, in most cases, there is a one-to-one relationship between the instance and the database. Perhaps because of this, it is easy to confuse the two. From the experience of most people, the database is the instance, and the instance is the database.

However, in many test environments this is not the case. On my disk, there can be 5 different databases. There is only one Oracle instance running on the test host at any point in time, but the database it accesses can vary from day to day (or even hourly) depending on my needs. As long as there are different configuration files, I can load and open either database. In this case I only have one "instance" at any time, but multiple databases, only one of which can be accessed at any point in time.

So, you should know by now that if someone talks about instances, he's referring to Oracle's processes and memory. When referring to a database, we mean the physical file that holds the data. A database can be accessed from multiple instances, but only one database can be accessed by an instance at a time.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326940509&siteId=291194637