Install oracle 11g R2 for standalone edition in linux

Source: Internet
Author: User

1. Create groups and users

In linux, open the terminal and log on as the root user. Enter the following command:

Groupadd dba // Add the dba group useradd-g dba-m oracle // Add the username as oracle and add the user to the dba group passwd oracle // set the password for the oracle user, the password I set is oracle.
2. Create necessary installation directories and set variables

(1) Use the root user to create the following path:

# Mkdir-p/home/oracle // Basic installation directory of oracle (ORACLE_BASE) # mkdir-p/home/oracle/product/11.2.0/db_1 // ORACLE_HOME directory # mkdir-p/home/oracle/oradata // installation directory of the oracle instance # mkdir-p/home /oracle/oraInventory //
Note: The-p parameter is used to establish a directory in cascade mode. If the parent directory does not exist, the directory is created in sequence.
(2) modify the directory owner

# Chown-R oracle: dba/home/oracle // change the/home/oracle directory and all its subdirectories to oracle users, which are owned by the dba group.-R indicates cascade operations, contains all its subdirectories.

(3) Modify operation Permissions

# Chmod-R 775/home/oracle // modify the/home/oracle directory and all its subdirectories to 775 (rwx [u, user] rwx [g, group] r-x [o, other])

U indicates "user", that is, the owner of a file or directory. G indicates "group users", that is, all users with the same group ID as the file owner. O indicates "Other (others) Users ". A Indicates "all (all) Users ". It is the default value of the system.

(4) add Environment Variables

1) After the root user logs on, switch to the oracle user:

su oracle
2) create a configuration file:

-Bash-4.1 $ vim/home/oracle/. bash_profile // or use the vi command

3) Add the following Configuration:

Export ORACLE_BASE =/home/oracle export ORACLE_HOME =/home/oracle/product/11.2.0/db_1export ORACLE_SID = orcl // sidexport ORACLE_OWENER of the database = oracleexport PATH = $ PATH: $ ORACLE_HOME/bin: $ HOME/binexport PATH = $ ORACLE_HOME/bin: $ PATHCLASSPATH = $ ORACLE_HOME/JRE: $ ORACLE_HOME/jlib: $ ORACLE_HOME/rdbms/jlibCLASSPATH = $ CLASSPATH: $ ORACLE_HOME/network/jlibexport CLASSPATH
Note: (1. ORACLE_SID is the environment variable of the operating system. It is used to correspond to the database instance name. The operating system needs to obtain the Instance name (instance_name, which is a database parameter) the system environment variable oracle_sid must be operated. oracle_sid and instance_name must be the same; otherwise, an error is reported (on unix platforms, it is "ORACLE not available", and on winnt platforms, it is "TNS: protocol adapter error ").

(2) database instance name (instance_name): Used for the connection with the operating system. The database instance name must be used for the interaction between the operating system and the database; the database instance name is stored in the parameter file.

Query the current database instance Name:

Method 1: select instance_name from v $ instance; Method 2: show parameter instance

(3) Database Name (db_name): Mark the internal management data of oracle.

Role: the database name is the internal management mark of the database, data names are required when you install databases, create new databases, Create Database Control Files, modify database structures, and use database backup and recovery tools to back up databases.

Query Database Name:

Method 1: select name from v $ database Method 2: SQL> show parameter db_name

(4) database domain name (db_domain): Add a domain name after the database name to make the database name unique throughout the network environment, mainly used for remote data replication in the oralce distributed environment

Role: 1. In an oracle distributed environment, data is remotely transmitted between two databases through a data link. 2. In the same network environment, the two databases have the same name.

Query Domain Name:

Method 1: select value from v $ parameter where name = 'db _ domain 'method 2. SQL> show parameter db_domain

(5) Database Service name service_names: database name + database domain name, meaning the same as the global database name.

Query the database service name:

Method 1: select value from v $ parameter where name = 'service _ names 'method 2. SQL> show parameter service_names
(6) Global Database Name global_db_name: database name + database domain name.

Simple command description about vi: After you enter vim/home/oracle/. bash_profile to create a configuration file, you must press I (enter insert mode) to add and modify the file.

After modification, Press ESC and press shift +: And enter wq to save and exit.

In addition, if you directly copy the preceding variables from a windows system file to a linux configuration file, run the vi command to open the file and check whether there are any special characters at the end of each line. If yes, delete it, otherwise, the environment variable does not take effect.

4) make the environment variables take effect:

Run the following command or restart the server:

-bash-4.1$ source $HOME/.bash_profile

Iii. Install oracle 11g R2

Labels ):

unzip linux.x64_11gR2_database_1of2.zipunzip linux.x64_11gR2_database_2of2.zip

The database directory is generated in the current directory. After decompression, the directory is cd/home/OracleInstaller/database.

Modify the operation permission of the directory to prevent problems:
#chmod –R -777 /home/OracleInstall

2. Enter the installation package directory as an oracle user and execute the installation command:
-bash-4.1$ su oracle-bash-4.1$ cd /home/OracleInstaller/database-bash-4.1$ ./runInstaller

You can enter the welcome page for oracle 11g database installation.

Note: (1) if you use a non-root user (or remote) for installation, you must log on to the root user and execute the xhost + command in the command line to successfully bring up the graphic interface.

# Xhost + // press the Enter key. If the following information is displayed, the setting is successful.

Access control disabled, clients can connect from any host // indicates that Access control is disabled and can be accessed from any host.

(2) During installation, if the Chinese installation package contains garbled characters, you must set the following parameters:
-bash-4.1$ export LANG=zh_CN.gbk

If the installation package in English is garbled, set:
-bash-4.1$ export LANG=en_US-bash-4.1$ export LC_ALL=en_US

(3) If the pre-installation verification prompt is: must be configured to display at least 256 colors Failed, set the command as follows:
-Bash-4.1 $ export DISPLAY =: 0.0 // This is the case for installing on the local machine. If it is on another terminal, change it to export DISPLAY = ip: 0.0, this is because 127.0.0.1 of the local machine is omitted.


3. Execute the graphical interface installation steps:

Step 1: do not check the check box, do not fill in the email, directly go to the next step, ignore the pop-up warning box (no email warning is provided)



The pop-up warning is as follows:


Step 2: select the installation type (create and configure a database, install only the database software, or update an existing database. Here, select the second option), as shown below:

Step 3: choose whether to install the standalone database instance or the cluster database. Here, select a single machine, the first


Step 4: select the installation language, select simple Chinese, select in the selection box on the left, add it to the right column, select, and click Next


Step 5: choose whether to install the Enterprise Edition, Standard Edition, or Standard Edition 1.


Step 6: select the basic path of ORACLE and the installation location of the database software. The environment variable must correspond to the environment variable configured at the beginning. That is, you must set the environment variable first. Otherwise, an error is reported.


Here, the warning box is displayed, warning that the base path of oracle is installed under home. Click yes to continue the installation.


Step 7: specify a directory (at the first installation) for the oracle Installation File named oraInventory, which occupies about K space:


Step 8: select the created dba group and continue


Step 9: perform the verification before installation:


The verification result is as follows: Select Ignore All to Ignore the non-satisfied conditions and continue:


Click continue in the previous step to enter the installation page, which takes about 20 minutes.


After the installation is complete, the system prompts you to use the root permission to execute two shell scripts. In this example, in/home/oracle/app/oracle/product/11.2.0/dbhome_1/root. sh and/home/oracle/app/oraInventory/orainstRoot. sh

Start a new terminal and enter the following command:

Su root // enter the password cd/home/oracle/app/oracle/product/11.2.0/db_1sh root. shcd/home/oracle/app/oraInventorysh orainstRoot. sh


4. Monitor installation

Run the following command to go To the graphical interface for installation:

su oracle-bash-4.1$ cd /home/oracle/product/11.2.0/db_1/bin-bash-4.1$ ./netca

For example, select Listener Configuration.



Select Add listener:


Enter the listener name. Default Value:


Select the Protocol. TCP is the default protocol.


Enter the listening port. The default value is 1521:

 


Select no to add another listener:


Listener Configuration completed:


Click FINISH to complete the listener installation.

In addition, in some cases you may need to configure the local network service name for the local oracle database, see http://www.cnblogs.com/zhangyongli2011/archive/2012/04/04/2431953.html


V. database instance installation:

Run the following command to go To the GUI for installation:

su oraclecd /home/oracle/product/11.2/db_1/bin$ ./dbca


Initial interface:


Click next:



Step 1: Create a database and select the first item


Step 2: select the first one for normal transaction processing.


Step 3: Enter the Database Name and database SID. Here the database name is orcl, and sid is used to configure the environment variable sunlight before (note that the figure is slightly different)


Step 4: Configure Automatic daily backup as needed.


Step 5: Set the data user password


Prompt password is simple, ignore, continue:


Step 6: configure the location of the stored data file:


Step 7: whether to specify the flash back area and whether to set the archive. This example is not set.


Step 8 ::


Step 9: keep the memory percentage at around 40%. Select Automatic Memory Management,


Select ZHS16GBK in the character set Column


Step 10: Next Step


Control File Location:


Data File Location:


Step 11: Select "create database" and "save as a database template". The following figure shows whether to generate a database creation script.


Database creation details: OK


Finally, after the installation is complete, you will be prompted to back up the/home/.../db_1/sunlight35_orcl_sysman_config/emket. ora file and back up it to/home/oracle.

You can also choose password management to disable or undisable other oracle users and set a password.


Test and create dba users and view User tablespaces:

Use sqlplus check: If the command line does not prompt this command, you need source/home/oracle/. bash_profile

$ sqlplus sys/vehicle@orcl as sysdba;

Create ITS users and grant dba permissions.

create user ITS identified by vehicle;grant dba to ITS; 

View the tablespace of the new user ITS

$ sqlplus ITS/vehicle@orclsql> select username, default_tablespace from user_users;

Over!

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.