Oracle DB instance, database understanding

Source: Internet
Author: User
Tags sqlplus

Transfer from http://www.cnblogs.com/advocate/archive/2010/08/20/1804066.html

Deepen your understanding

The database is a photographic film.

Example is photo paper

A film can be used to punch multiple photographic papers, but a photo paper is a maximum of one film.

An explanation from Tom
Database: A collection of physical operating system files or disks. When using Oracle 10g Automatic storage Management (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.

Instance (instance): A set of Oracle background processes/threads and a shared memory area that is shared by threads/processes running on the same computer. Volatile, non-persistent content (some of which can be flushed out to disk) can be maintained here. A DB instance can exist even without disk storage. Perhaps the example is not the most useful thing in the world, but you can think of it as the most useful thing, which helps to draw a line between examples and databases.

These two words can sometimes be used interchangeably, but the concepts are completely different. The relationship between the instance and the database is that the database can be loaded and opened by multiple instances, and the instance can mount and open a database at any point in time. In fact, an instance can load and open a database at most in its lifetime, accurately!

Add:
In general, one of our databases corresponds to one instance, but in the case of cluster RAC, when a database file is shared, a database can be used concurrently by multiple instances.

When we write data or read data to a database, we can only do it through an instance.

At the same time, an instance can only open one database, that is, one instance can only operate or manage a database; Usually, at the same moment, a database can only be opened by one instance, except for RAC cases.

When you install Oracle, you typically install an instance of the database pair (which can be many pairs of course), and their names are the same (that is, the instance and database names are the same), their names can of course be different, regardless of the difference, their connection is through the xxx/pfile/ The Init.ora initialization file is contacted. Because XXX is the name of the instance, and the db_name in Xxx.ora, the name of the corresponding database is recorded.

The following shows the process of starting a XXX instance, hooking up a database, opening a database, shutting down a database, unloading a database, shutting down an instance.

1, in order to perform the above operation, the monitoring of Oracle must be started first, so that we have the opportunity to connect to the Oracle server side. Can be done by the following command: Lsnrctl start;

2, Oracle startup, under Windows usually start Oracle in the service, generally start the relevant instance at the same time, but you can also set the start Oracle, do not start any specified instance, so that Oracle boot speed is quite fast.

3, set the relevant examples we need to start. In the console window, enter set ORACLE_SID=XXX (use Export command in UNIX environment)

4, use/nolog way, enter Sqlplus. In the console window, enter Sqlplus/nolog, and then enter the Sqlplus environment.

5, Input command connect sys as SYSDBA Enter, prompt for password, direct carriage return, the role of SYSDBA to connect to the idle instance of Oracle.

6, the input command startup Nomount Enter, then launched the XXX instance, set by set oracle_sid=xxx.

7, enter the command ALTER DATABASE Mount carriage return, then attach the corresponding databases to the XXX instance.

8, the input command ALTER DATABASE open ENTER, the corresponding database is opened.

9. Enter the command shutdown, close the database, unload the database, and close the instance.

Oracle DB instance, database understanding

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.