Oracle Basic Concepts

Source: Internet
Author: User

1. Databases and instances

What is a database, in fact, is very simple, the database is a medium for storing data. For example, the commonly used file is one, in oracle10g, the data storage has several kinds. The first is the file format, which is to create a batch of files on your disk and then store the information in those files. The second is the disk array form, what does this mean, this means that the database is not stored as a file, but one or more disks formatted into a format of Oracle, equal to the entire disk is stored in the Oracle database, not for other purposes. This has the advantage of high storage performance, since no other file format is used, but the entire disk becomes the most adaptable file system format for Oracle. Of course there may be other forms, such as the Internet or something. However, our most commonly used is the file format, in the file format, the database refers to those data files, control files and redo files and so on a series of files.

And what is instance, instance actually refers to a series of processes in the operating system and the memory blocks allocated for these processes. In Oracle, we can create a new Oracle instance, this time, although there are processes and the SGA, and a series of memory is fast, but this time did not read the database files in. So just an example, you can manually or automatically through the command to load the database file into our database instance, this time the database can let us really start access operation.

Therefore, the application of the database if you want to implement, database and database instance is indispensable, if only the database of those files, then, can only represent the data in this file, but we can not directly operate. And if only the database instance, then we can operate, but also do not know what data to manipulate, operation generated data can not be saved and so on. So, when an Oracle instance really load an Oracle database, it can be used by us.

One thing to note here is that when the Oracle instance starts, it can only load the database once, and if you want to disconnect the database from Instance and then re-hang it in a database Instance, you first need to end the database Instance process. Then re-establish a process for this instance, and load another database. Otherwise, you must remove the ORA-16169 error, saying that the database has been opened. Because a database instance can only load and open a instance in its lifetime.

Database Server = database + instance

Database = Redo File + control file + data file + Temp file

Oracle instance = Memory used by process + process (SGA)

The relationship between the Oracle instance and the database 1. Temporary and permanent 2. Instances can start the startup Nomount independently without a data file, usually with no meaning 3. An instance can only be loaded (ALTER DATABASE mount) and open (ALTER DATABASE open) in a database for the duration of its lifetime4. A database can be loaded and opened simultaneously by many instances (that is, RAC), and the role of instances in the RAC environment can be fully reflected 2. db_name instance_name Oracle_sid

Db_name is used to differentiate the internal identity of a database by using the database name when installing a database, creating a new database, creating a control file, modifying the database structure, and using Rman backup.

exists in (but is not limited to) the following places:

(1) stored in a binary mode in the control file.

(2) Pfile/spfile: db_name

(3) The database physical Structure file directory

D:\oracle\oradata\db_name\*.*

D:\oracle\admin\db_name\*.*

Query method: select name from V$database;

Instance_name is used to contact the operating system. The instance name must be used in the operating system to obtain interaction with the database. For example, to connect to a database server, you must know its database instance name and know that the database name is useless. After the database is installed/created, the instance name is allowed to be modified.

exists in (but is not limited to) the following places:

(1) Windows nt/2000 Registry (ORACLE_SID)

(2) Pfile/spfile: instance_name

(3) database parameter file name: Init.ora

Query method: Select instance_name from V$instance;

Relationship to database name: typically one by one corresponds, except in RAC. In terms of name, Instance_name=oracle_sid. For the description of the database instance name, sometimes instance_name is used, and sometimes oracle_sid is used, both of which are DB instance names. But instance_name is an Oracle database parameter, and ORACLE_SID is an operating system environment variable.

Oracle_sid is used to interact with the operating system. In other words, to get the instance name in the operating system, you must use ORACLE_SID. For example, when multiple databases are created on the same server, there are multiple corresponding instances that can be specified by setting oracle_sid in the operating system to specify the database to log in to:

$oracle _SID=ORCL

$export Oracle_sid

C:\>set ORACLE_SID=ORCL

exists in (but is not limited to) the following places:

(1) Windows nt/2000 Registry (ORACLE_SID)

(2) database parameter file name: Init.ora

The instance name, in addition to contacting the operating system, is also used for network connections, that is, connections to clients or other servers. Configuring a network connection is configuring the network connection string.

3. SID, Service name, net service name

The SID uniquely identifies an Oracle instance, and Oracle_sid launches the instance, and then we get an Oracle instance that has a name: instance_name。Sid==>>oracle_sid==>>instance_name These three are identical and are exactly the same。 At the same time this instance provides services to the outside, so there is another service_name.

And Sid_name appears in the Lisnter.ora file:

1Sid_list_listener =2(Sid_list =3(Sid_desc =4(Sid_name = pl***Tproc)5(Oracle_home =/u01/app/oracle/product/10.2.0/db_1)6(Program =Extproc)7     )8(Sid_desc =9(Sid_name =Jiagulun)Ten(Oracle_home =/u01/app/oracle/product/10.2.0/db_1) One(Global_dbname =Jiagulun) A     ) -   ) -  theLISTENER = -(Description_list = -(DESCRIPTION = -(ADDRESS = (PROTOCOL = TCP) (HOST = redhat4) (PORT =1521)) +(ADDRESS = (PROTOCOL = IPC) (KEY =EXTPROC0)) -     ) +)

The value of Sid_name in Listener.ora must be the same as the value of the SID. With the Sid_name and global_dbname two parameters in the Listener.ora and the service_name in the client's Tnsnames.ora, these three parameters work together to enable isolation between the Oracle client and the server.

1 //Tnsnames.ora2 3Jiagulun =4(DESCRIPTION =5(Address_list =6(ADDRESS = (PROTOCOL = TCP) (HOST =192.168.0.100) (PORT =1521))7     )8(Connect_data =9(service_name =Jiagulun)Ten     ) One   ) A  -Extproc_connection_data = -(DESCRIPTION = the(Address_list = -(ADDRESS = (PROTOCOL = IPC) (KEY =EXTPROC0)) -     ) -(Connect_data = +(SID = pl***Tproc) -(PRESENTATION =RO) +     ) A)
The client goes to this address to access the listener based on the service_name and addresses in Tnsname.ora (address = (PROTOCOL = TCP) (HOST = 192.168.0.100) (PORT = 1521). Then the Listenerdetermine if a global_dbname and service_name are equal according to the global_name in the file Lisnter.ora file。 If they are equal, the connection to the server-side instance of the client-to-SID identity is established. (There is one exception: Tnsnames.ora can be substituted for service_name with the parameter SID, which compares the SID in Tnsnames.ora and Sid_name in Lisnter.ora, However, the use of SIDS is not recommended at the beginning of oracle9i. Because the SID cannot isolate the client and the server) the address in the Tnsnames.ora (address = (PROTOCOL = TCP) (HOST = 192.168.0.100) (PORT = 1521) is the listener-listener. The listener process has been listening on this address, waiting for the client to connect. Summarize1)The isolation of the client and the server is achieved through the global_dbname in the Lisnter.ora, Global_dbname is a bridge between the client and the service side: Tnsnames.ora in a>client-side Service_ The global_dbname in name and server side Lisnter.ora are equal; Sid_name in Lisnter.ora of B>server end is equal to the SID of the system; 2)Sid==>>sid_name==>>oracle_sid==>>instance_name four are consistent, equal; 3) multiple different Global_ can be configured in the Lisnter.ora Name is used by different client service_name to enable different clients to use different service_name to access the same SID instance, configured as follows:
1 //Lisnter.ora2 3(Sid_desc =4(Sid_name =Jiagulun)5(Oracle_home =/u01/app/oracle/product/10.2.0/db_1)6(Global_dbname =Jiagulun)7     )8(Sid_desc =9(Sid_name =Jiagulun)Ten(Oracle_home =/u01/app/oracle/product/10.2.0/db_1) One(Global_dbname =JGL) A     ) -  -  the //Tnsnames.ora -  -Jiagulun = -(DESCRIPTION = +(Address_list = -(ADDRESS = (PROTOCOL = TCP) (HOST =192.168.0.100) (PORT =1521)) +     ) A(Connect_data = at(service_name =Jiagulun) -     ) -   ) -  -JGL = -(DESCRIPTION = in(Address_list = -(ADDRESS = (PROTOCOL = TCP) (HOST =192.168.0.100) (PORT =1521)) to      ) +(Connect_data = -(service_name =JGL) the      ) *)

Oracle Basic Concepts

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.