[oracle@jrjydb ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on 星期四 3月 26 13:27:59 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
已连接到空闲例程。
SQL> startup open read only;
ORACLE 例程已经启动。
Total System Global Area 2.5770E+10 bytes
Fixed Size 19527768 bytes
Variable Size 2952790016 bytes
Database Buffers 2.2750E+10 bytes
Redo Buffers 47579136 bytes
数据库装载完毕。
数据库已经打开。
SQL>
SQL> select name,open_mode,cdb from v$database;
NAME OPEN_MODE CDB
--------- -------------------- ---
JRJYDB READ ONLY NO
SQL> begin
2 DBMS_PDB.DESCRIBE(pdb_descr_file => '/home/oracle/EID.xml');
3 end;
4 /
PL/SQL 过程已成功完成。
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> exit
从 Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0 断开
[oracle@jrjydb ~]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 26-3月 -2020 13:30:26
Copyright (c) 1991, 2019, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=jrjydb)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for Linux: Version 19.0.0.0.0 - Production
启动日期 08-3月 -2020 16:47:43
正常运行时间 17 天 20 小时 42 分 43 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 /u01/app/oracle/product/19.5.0/network/admin/listener.ora
监听程序日志文件 /u01/app/oracle/diag/tnslsnr/jrjydb/listener/alert/log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=jrjydb)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
监听程序不支持服务
命令执行成功
[oracle@jrjydb ~]$
[oracle@jrjydb dbca]$ dbca -silent -createDatabase -responseFile /u01/app/oracle/product/19.5.0/assistants/dbca/dbca.rsp
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
52% complete
56% complete
60% complete
Completing Database Creation
66% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/cdborcl.
Database Information:
Global Database Name:cdborcl
System Identifier(SID):cdborcl
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdborcl/cdborcl.log" for further details.
[oracle@jrjydb dbca]$
[oracle@jrjydb dbca]$
[oracle@jrjydb dbca]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 26-3月 -2020 13:24:30
Copyright (c) 1991, 2019, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=jrjydb)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for Linux: Version 19.0.0.0.0 - Production
启动日期 08-3月 -2020 16:47:43
正常运行时间 17 天 20 小时 36 分 47 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 /u01/app/oracle/product/19.5.0/network/admin/listener.ora
监听程序日志文件 /u01/app/oracle/diag/tnslsnr/jrjydb/listener/alert/log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=jrjydb)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=jrjydb)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/cdborcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
服务摘要..
服务 "86b637b62fdf7a65e053f706e80a27ca" 包含 1 个实例。
实例 "cdborcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "cdborcl" 包含 1 个实例。
实例 "cdborcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "cdborclXDB" 包含 1 个实例。
实例 "cdborcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
[oracle@jrjydb dbca]$ export ORACLE_SID=cdborcl
[oracle@jrjydb dbca]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on 星期四 3月 26 13:26:44 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
连接到:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>CREATE PLUGGABLE DATABASE JRJYDB USING '/home/oracle/EID.xml' copy FILE_NAME_CONVERT= ('/u01/app/oracle/oradata/JRJYDB', '/u01/app/oracle/oradata/CDBORCL/jrjydb/');
Pluggable database created.
SQL>
查看数据文件迁移情况
[oracle@jrjydb ~]$ cd $ORACLE_BASE/oradata/
[oracle@jrjydb oradata]$ ls
CDBORCL JRJYDB
[oracle@jrjydb oradata]$ ls -l JRJYDB/
total 3009684
-rw-r----- 1 oracle oinstall 10600448 Mar 26 13:29 control01.ctl
-rw-r----- 1 oracle oinstall 10600448 Mar 26 13:29 control02.ctl
-rw-r----- 1 oracle oinstall 209715712 Mar 26 13:05 redo01.log
-rw-r----- 1 oracle oinstall 209715712 Mar 25 09:00 redo02.log
-rw-r----- 1 oracle oinstall 209715712 Mar 26 04:00 redo03.log
-rw-r----- 1 oracle oinstall 1080041472 Mar 26 13:28 sysaux01.dbf
-rw-r----- 1 oracle oinstall 975183872 Mar 26 13:28 system01.dbf
-rw-r----- 1 oracle oinstall 33562624 Mar 25 22:00 temp01.dbf
-rw-r----- 1 oracle oinstall 361766912 Mar 26 13:28 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 Mar 26 13:28 users01.dbf
[oracle@jrjydb oradata]$ ls -l CDBORCL/jrjydb/
total 2365540
-rw-r----- 1 oracle oinstall 1080041472 Mar 26 13:52 sysaux01.dbf
-rw-r----- 1 oracle oinstall 975183872 Mar 26 13:52 system01.dbf
-rw-r----- 1 oracle oinstall 33562624 Mar 26 13:44 temp01.dbf
-rw-r----- 1 oracle oinstall 361766912 Mar 26 13:52 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 Mar 26 13:47 users01.dbf
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 JRJYDB MOUNTED
SQL> alter session set container=jrjydb;
SQL> @?/rdbms/admin/noncdb_to_pdb.sql
等待一段时间等脚本执行完成
13:58:01 SQL> set statementcache 0
13:58:01 SQL> set suffix "sql"
13:58:01 SQL> set tab OFF
13:58:01 SQL> set termout ON
13:58:01 SQL> set time OFF
SQL> set timing OFF
SQL> set trimout ON
SQL> set trimspool ON
SQL> set underline "-"
SQL> set verify OFF
SQL> set wrap ON
SQL> set xmloptimizationcheck OFF
SQL>
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 JRJYDB MOUNTED
#脚本执行完成之后,启动pdb
SQL> alter pluggable database JRJYDB open;
插接式数据库已变更。
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 JRJYDB READ WRITE NO
SQL>
5、修改环境变量
修改~/.bash_profile文件将ORACLE_SID修改成cdborcl。然后执行source ~/.bash_profile应用
6、验证数据