oracle 11g ocp notes (2) -- install and create a database

1. Understand database management tools
   1.2 OUI (Oracle Universal Installer)
    ·OUI product inventory (inventory) location
          Windows: %SystemRoot\Program files\Oracle\Inventory
                      HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\inst_loc
      Liunx: /etc/oraInst.loc
      Solaris /var /opt/oracle/oraInst.loc

          AIX: ?????
    · On Linux or Unix, the user running the installer for the first time needs to have permission to write to the appropriate directory. Usually only the root user can write to /etc or /var. For security reasons, running OUI as root is not allowed, OUI will generate a script (orainstRoot.sh script) that is run by the root user who created the oraInst.loc file. On Windows, the user running the OUI needs to have permissions that allow registry creation.
    The prerequisite test
      OUI checks certain requirements on the server computer before running.
      Linux: /install/oraparam.ini
      Windows: \install\oraparam.ini
    
    DBCA(Database Configuration Assistant)
    DBUA(Database Upgrade Assistant)
    SQL*Plus
    SQL Developer
    OEM (Oracle Enterprise Manager)
    Oracle Net Manager, Oracle Net Configuration Assistant
    EXP/IMP
    Datapump
    SQL*Loader
    RMAN
    Oracle Secure Backup

2 Planning oracle installation

2.1 Supported Operating Systems

    Linux
    on Intel and AMD Microsoft Windows on Intel and AMD
    Solaris on SPARC
    AIX on POWER
    HPUX on PA-RISC

 

2.2 Hardware and operating system resources:

      1GB  RAM

    1.5G swap space

    400M temp space

    1.5-3.5 oracle home directory

    2.4GB of FRA

    1GHZ CPU

 

    Also need to pay attention to kernel parameters, unwanted packages, patches, etc.
2.3. Optimal Flexible Architecture
    OFA (Optimal Flexible Architecture) serves as a file system directory structure that simplifies the maintenance of multiple Oracle product versions.
    The core of OFA is two environment variables: ORACLE_BASE and ORACLE_HOME.
    The ORACLE_BASE directory is a directory on the server where the installation All Oracle software (all products, all editions).
    · ORACLE_HOME Each version of each product has its own ORACLE_HOME (under ORCLE_BASE). This structure ensures that multiple databases are created and upgraded with the files in place at the end.
    Typical values ​​of ORACLE_BASE and ORACLE_HOME
    Linux system:
      /u01/app/oracle
      /u01/app/oracle/product/11.2.0/db_1
    Windows system:
      D:\oracle\app
      D:\oracle\app\product\11.2.0 \db_1
    OFA location of the database itself $ORACLE_BASE/oradata/orcl #Database name orcl
    Other environment variables:
      PATH
      LD_LIBRARY_PATH
    DISPLAY
    · ORACLE_SID
      $ export ORACLE_BASE=/u01/app/oracle
      $ export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
      $ export PATH=$ORACLE_HOME/bin;$PATH
      $ export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
      $ export DISPLAY=jwacer.bplc.co.za:0.0
      $ export ORACLE_SID=orcl



3. Use oui to install the database
    to install the database software, you need to log in to the server as the operating system user, this user must have permission to read the installation package and have permission to write The directory where ORACLE_BASE is located.
    Run the following program to start the OUI to install the database software:
    setup.exe (Windows)
    runinstaller.sh (Linux)
    The prerequisite checks are performed during the installation. You can ignore the checks, but this is generally not recommended.
    runinstaller -ignoreSysPrereqs
    may be installed on Linux You need to install some dependency packages, modify the kernel configuration, and set global variables. For the detailed installation process, please refer to the installation manual:


    silent mode installation is possible, which is necessary for no graphical interface. However, a response file needs to be specified.
    runInstaller -silent -reponsefile responsefilename


    can create a response file manually or record it during an interactive installation.
    runInstaller -record -destinationfile responsefilename


    Before performing a silent installation, a product manifest pointer file must be created (on Linux: /etc/ oraInst.loc).
    Oracle11g does not need to execute the recording command, directly execute runInstaller, start the graphical interface, and save the response file before the final installation.

 

4 Create a database using dbca

      Create a database using dbca

    Understanding the instantiation parameters init.ora

               Learn about the create database command.

               Learn about creating databases using scripts.

 

 

 

 

 

 

1. Steps to create a database:
    (1) Create a parameter file (optional) and a password file.
    (2) Build an instance in memory using the created parameter file.
    (3) Execute the CREATE DATABASE command, and the execution result will generate at least one control file, two online redo log files, two data files for the SYSTEM and SYSAUX tablespaces, and a data dictionary.
    (4) Run the SQL script to generate the data dictionary view and supplementary PL/SQL package.
    (5) Run the SQL script to generate Enterprise Manager Database Control and any options (such as java) required by the database.


    On Windows systems, there is an extra step because Oracle runs as a Windows service. Oracle helps create this service by providing the program oradim.exe.    


2. Use the dbca (Database Configuration Assistant) graphical interface tool to create
    the location of the database dbca program:
    $ORACLE_HOME/bin/dbca
    On the Windows platform, dbca must be operated on the computer that needs to create the database.
    On the Unix/Linux platform, dbca must run on the computer where the database needs to be created, but it can be directed to other computers for display and operation through the x windows system, and the DISPLAY environment variable needs to be set:
    export DISPLAY=192.168.1.21:0.0


    Starting dbca generally requires setting the session environment variables: ORACLE_BASE, ORACLE_HOME, PATH, LD_LIBRARY_PATH.
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
    export PATH=$ORACLE_HOME/bin:$PATH
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH


    Configure the listener: If the database to be created will use Enterprise Manager Database Control, you need to configure the listener before running dbca.
    Use netca (Net Configuration Assistant) to configure the listener, the location of the netca program:
    $ ORACLE_HOME/bin/netca


    Use dbca to create a database:
    $ dbca
    can save the creation script, the generated script location:
    $ ORACLE_BASE/admin/DB_NAME/scripts
    After finishing em URL (different versions may be different):
    https://localhost:1158/em


3. Scripts created by dbca and other files
    1. Instance parameter file init.ora
    /u01/app/oracle/admin/<db_name>/scripts/init.ora
    Important parameters:
    DB_NAME: can only contain letters and numbers, start with a letter, and the length cannot exceed 8 characters.
    DB_BLOCK_SIZE: data block size, default 8K, the database cannot be changed after it is created.
    ·CONTROL_FILES: Specify the location of the control file.


    2.Shell script file
    The content contained in the shell script:
    ·Create multiple directories in $ORACLE_BASE, set environment variables, etc.
    ·The windows platform also uses oradim.exe to create services.
    ·Run sql script < db_name>.sql, including content:
      Create an external password file: %ORACLE_HOME/dbs/orapw<db_name>
      Then run a series of scripts such as the SQL script CreateDB.sql to create the database.     3.CREATE


    DATABASE command
    CreateDB.sql script content:
External password file authentication connects to the instance, echo and spool commands are written to the creation log.
    STARTUP NOMOUNT component instance
    CREATE DATABASE creates a database, including:
      SYSTEM, SYSAUX, TEMP, UNDO tablespace file, character set, three logs Filegroups, one member per group, passwords for the SYS and SYSTEM users.


    4. Post-creation scripts
    CreateDBfiles.sql: Not very important, create small tablespace USERS.
    CreateDBCatalog.sql: Critical, it runs a set of scripts in the $ORACLE_HOME/rdbms/admin directory to build views on the data dictionary , to create a PL/SQL package.
    emRepository.sql: (depending on options) create the objects required for Enterprise Manager Database Control.
    postDBCreation.sql: Generate the server parameter file based on the init.ora file, unlock the DBSNMP and SYSMAN accounts used by EM, and run emca to configure Database Control.

 

Reference URL: https://blog.csdn.net/gyming/article/details/41593843

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325038075&siteId=291194637