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 ;

     

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yexianyi

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值