用SQL命令手工创建CDB
1.设置环境变量
$ export ORACLE_SID=ora12c
$ export ORACLE_HOME=/home/oracle/product/12.1.0/db1
$ export PATH=$ORACLE_HOME/bin:$PATH
2.创建文本参数文件
$ vi initora12c.ora
db_name='ora12c'
enable_pluggable_database=true
audit_trail='db'
control_files='/home/oracle/oradata/ora12c/control01.ctl','/home/oracle/oradata/ora12c/control02.ctl'
db_block_size=8192
db_domain=''
memory_target=796917760
memory_max_target=796917760
open_cursors=300
processes=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
3.创建数据库脚本
$ vi crtcdb.sql
CREATE DATABASE CDB
MAXLOGFILES 16
MAXLOGMEMBERS 4
MAXDATAFILES 1024
MAXINSTANCES 1
MAXLOGHISTORY 1024
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
DATAFILE
'/home/oracle/oradata/ora12c/system01.dbf' SIZE 500M
EXTENT MANAGEMENT LOCAL
UNDO TABLESPACE undotbs1 DATAFILE
'/home/oracle/oradata/ora12c/undotbs01.dbf' SIZE 800M
SYSAUX DATAFILE
'/home/oracle/oradata/ora12c/sysaux01.dbf' SIZE 500M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE
'/home/oracle/oradata/ora12c/temp01.dbf' SIZE 500M
DEFAULT TABLESPACE USERS DATAFILE
'/home/oracle/oradata/ora12c/users01.dbf' SIZE 50M
LOGFILE GROUP 1
('/home/oracle/oradata/ora12c/redo01a.rdo') SIZE 50M,
GROUP 2
('/home/oracle/oradata/ora12c/redo02a.rdo') SIZE 50M
USER sys IDENTIFIED BY test
USER system IDENTIFIED BY test
USER_DATA TABLESPACE userdt DATAFILE
'/home/oracle/oradata/ora12c/userdt01.dbf' SIZE 500M
ENABLE PLUGGABLE DATABASE
SEED FILE_NAME_CONVERT = ('/home/oracle/oradata/ora12c','/home/oracle/oradata/ora12c/pdbseed');
4.创建相应目录
$ mkdir -p /home/oracle/oradata/ora12c/pdbseed
5.创建数据库
$ sqlplus / as sysdba
SQL> @crtcdb.sql
6.运行内置脚本
$ sqlplus / as sysdba
SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql
@$ORACLE_HOME/rdbms/admin/catproc.sql
SQL> conn system/test
@$ORACLE_HOME/sqlplus/admin/pupbld.sql