- Set ORACLE_SID, for example, NDLNE
export ORACLE_SID=NDLNE - 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=trueNotice:
-
db_name shoule be same with ORACLE_SID;
-
If using OMF(Oracle Managed Files), DB_CREATE_FILE_DEST will be a mandatory parameter;
-
'enable_pluggable_database=true ' is mandatory.
-
Other parameters are optional.
-
- 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:
-
ALl the folders involved into above script must be created in advance, otherwise the process will be failed.
-
'enable pluggable database' must be state explictly
-
- Reset PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/perl/bin: $ORACLE_HOME/jdk/bin:$PATH - Rename util.pm
vi /u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/catcdb.plReplace line#35: use utilqw(trim, splitToArray); with use Utilqw(trim, splitToArray);
- 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 - 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 -
Verify all scripts execution are valid
sqlplus / as sysdba select object_name, object_type from dba_objects where status = 'INVALID' ; - Done
After Install:
- After install CDB successfully, you still need to config tnsnames.ora in order to have capablity to connect with Oracle CDB: NDLNE
If your configuration on tnsnames.ora is correct, and your oracle listener are running, you should be able to exec tnsping successfully.# 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) ) )[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) - 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 ;
本文详细介绍如何设置Oracle环境变量,创建参数文件init.ora,使用这些参数来创建CDB(Container Database),并进行必要的验证步骤及后续配置。

1924

被折叠的 条评论
为什么被折叠?



