Oracle12c: How to create CDB in manually

Posted yexianyi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle12c: How to create CDB in manually相关的知识,希望对你有一定的参考价值。

  1. Set ORACLE_SID, for example, NDLNE
    export ORACLE_SID=NDLNE
  2. Create PFILE
    vi /u01/app/oracle/admin/NDLNE/pfile/init.ora
    
    db_name='NDLNE'
    memory_target=1G
    memory_max_target=1G
    DB_CREATE_FILE_DEST='/u01/app/oracle/oradata'
    control_files='/u01/app/oracle/oradata/NDLNE/controlfile/control01.ctl','/u01/app/oracle/oradata/NDLNE/controlfile/control02.ctl'
    enable_pluggable_database=true
    

    Notice:

    1. db_name shoule be same with ORACLE_SID;

    2. If using OMF(Oracle Managed Files), DB_CREATE_FILE_DEST will be a mandatory parameter;

    3. 'enable_pluggable_database=true ' is mandatory.

    4. Other parameters are optional.

  3. Create CDB
    sqlplus / as sysdba ;
    
    startup pfile='/u01/app/oracle/admin/NDLNE/pfile/init.ora' nomount ;
    
    CREATE DATABASE NDLNE
    USER SYS IDENTIFIED BY Passw0rd!
    USER SYSTEM IDENTIFIED BY Passw0rd!
    EXTENT MANAGEMENT LOCAL
    DEFAULT TABLESPACE users
    DEFAULT TEMPORARY TABLESPACE temp
    UNDO TABLESPACE undotbs1
    enable pluggable database
    seed
    FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/NDLNE/',
                             '/u01/app/oracle/oradata/NDLNE/pdbseed/')
    SYSTEM DATAFILES SIZE 125M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
    SYSAUX DATAFILES SIZE 100M;

    Notice:

    1. ALl the folders involved into above script must be created in advance, otherwise the process will be failed.

    2. 'enable pluggable database' must be state explictly

  4. Reset PATH
    export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/perl/bin: $ORACLE_HOME/jdk/bin:$PATH
  5. Rename util.pm
    vi /u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/catcdb.pl

    Replace line#35: use utilqw(trim, splitToArray); with use Utilqw(trim, splitToArray);

  6. Create Data Dictionary Views (Do this step if Oracle <12.2)
    sqlplus / as sysdba
    
    @$ORACLE_HOME/rdbms/admin/catalog.sql
    @$ORACLE_HOME/rdbms/admin/catproc.sql
  7. Install CDB components (Do this step if Oracle >= 12.2)
    sqlplus / as sysdba
    
    @?/rdbms/admin/catcdb.sql
    
    SQL> host perl -I &&rdbms_admin &&rdbms_admin_catcdb --logDirectory &&1 --logFilename &&2
    
    Enter value for 1: /u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin
    
    Enter value for 2: /u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/catcdb.pl
    
    ​
  8. Verify all scripts execution are valid

    sqlplus / as sysdba
    
    select object_name, object_type from dba_objects where status = 'INVALID' ;
  9. Done

After Install:

  1. After install CDB successfully, you still need to config tnsnames.ora in order to have capablity to connect with Oracle CDB: NDLNE 
    # tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.
    
    NDLNE =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = centos8.linuxvmimages.local)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = NDLNE)
        )
      )
    
     If your configuration on tnsnames.ora is correct, and your oracle listener are running, you should be able to exec tnsping successfully.
    [oracle@centos8 sqldeveloper]$ tnsping NDLNE
    
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = centos8.linuxvmimages.local)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = NDLNE)))
    OK (0 msec)
    

     

  2. But for log on NDLNE CDB with sqlplus, you need to mount database firstly.
    sqlplus / as sysdba ;
    
    startup pfile='/u01/app/oracle/admin/NDLNE/pfile/init.ora' nomount ;
    
    create spfile from pfile='/u01/app/oracle/admin/NDLNE/pfile/init.ora' ;
    
    alter database mount ;
    
    conn sys/Passw0rd!@NDLNE as sysdba ;

     

 

 

以上是关于Oracle12c: How to create CDB in manually的主要内容,如果未能解决你的问题,请参考以下文章

Oracle12c: How to create CDB in manually

Oracle12c: How to create CDB in manually

How to deploy Oracle 12c Release 2 Grid and RAC Database on RHEL 7.x

Oracle Net 12c: How to enable Clients using SID to connect to PDB? (Doc ID 1644355.1)

Oracle 12c how to purge the FGA audit records before a certain date

Learn How To Create Trigger In Oracle Forms