cannt connect to db!_Oracle 数据库12c安装示例db-sample-schemas(pdb下安装)

参考官方文档:https://docs.oracle.com/en/database/oracle/oracle-database/12.2/comsc/installing-sample-schemas.html#GUID-4D4984DD-A5F7-4080-A6F8-6306DA88E9FC

github下载地址:https://github.com/oracle/db-sample-schemas

1cd79ae32029e0163ee7f3d5ad0196c7.png

从上面的官方文档中我们可以看到从Oracle12.2版本开始,示例Schemas的脚本被放到了GitHub上,在DBCA安装时只会安装hr示例Schema。

oracle 12c在结构上做出了调整,引入了CDB和PDB的概念。官方文档没有强调必需要在PDB下安装示例。

用sys默认登录的是CDB

在oracle用户下,我pdb的名称是proc。sys system用户的密码都设置为oracle

[oracle@orcl ~]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Tue Dec 3 15:16:35 2019 Copyright (c) 1982, 2016, Oracle. All rights reserved.  Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> show pdbs  CON_ID CON_NAME OPEN MODE RESTRICTED---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PROC READ WRITE NO

查看下端口状态

c14e2b5b7da23975cb72af81cb06b3c0.png

`使用system用户验证下登录

sqlplus system/oracle@127.0.0.1:1521/proc
45001582a652b9933d16e3fd521330b7.png

在oracle用户下载示例,假设你已经安装git软件,文件约30MB左右,如果下载太慢,可以pc下载后再上传

cd $HOMEgit clone https://github.com/oracle/db-sample-schemas.git#git clone -b v12.2.0.1 https://github.com/oracle/db-sample-schemas.git

修改:

cd $HOME/db-sample-schemasperl -p -i.bak -e 's#__SUB__CWD__#'$(pwd)'#g' *.sql */*.sql */*.dat source /usr/local/bin/oraenv

一次性安装所有示例Schema

The mksample script expects 11 parameters. Provide the password for SYSTEM and SYS, and for schemas HR, OE, PM, IX, and SH. Specify a temporary and a default tablespace, and make sure to end the name of the log file directory with a trailing slash.

mksample脚本会重置HR, OE, PM, IX, and SH用户和表,不要在生产数据库上做这样的操作。

953d2c71afb68e9076b19f7e6967f7da.png

installation script 示例

sqlplus system/systempw@connect_string@mksample systempw syspw hrpw oepw pmpw ixpw shpw bipw users temp /your/path/to/log/ connect_string 

根据你实际的设置来修改:

sqlplus system/oracle@localhost:1521/proc@mksample oracle oracle hrpw oepw pmpw ixpw shpw bipw users temp $ORACLE_HOME//demo/schema/log/ localhost:1521/proc

大概要几分钟安装完成。

验证:

$ sqlplus hr/hrpw@127.0.0.1:1521/proc SQL*Plus: Release 12.2.0.1.0 Production on Tue Dec 3 16:00:04 2019 Copyright (c) 1982, 2016, Oracle. All rights reserved. Last Successful login time: Tue Dec 03 2019 15:59:29 +08:00 Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit ProductionSQL> select * from regions;  REGION_ID REGION_NAME---------- ------------------------- 1 Europe 2 Americas 3 Asia 4 Middle East and Africa 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值