【DB寶4】只需2步即可擁有Oracle19c的ASM+DB環境
【DB寶4】只需2步即可擁有Oracle19c的ASM+DB環境
一、從Docker Hub下載小麥苗上傳的映象
小麥苗的Docker Hub的地址: https://hub.docker.com/u/lhrbest
-- 下載映象命令:
docker pull lhrbest/oracle19casm_lhr:1.0
映象有點大,下載時間取決於自己的網路環境,建議晚上放後臺下載:
-- 放後臺下載映象命令:
nohup docker pull lhrbest/oracle19casm_lhr:1.0 &
下載完成後:
[root@docker35 ~]# docker images | grep oracle19casm_lhr
lhrbest/oracle19casm_lhr 1.0 d695caf63520 17 hours ago 46.6GB
二、建立容器
--建立容器
docker run -itd -h lhr2019ocpasm --name oracle19casmlhr -p 1521:1521 -p 5500:5500 -p 5501:5501 --privileged=true lhrbest/oracle19casm_lhr:1.0 /usr/sbin/init
--進入容器
docker exec -it oracle19casmlhr bash
三、盡情使用吧
注意事項:
① 該映象使用二進位制包的方式安裝Oracle 19c企業版的ASM和db,包括一個CDB,名稱為lhr19cdb,一個非cdb,名稱為lhr19sdb,所有密碼均為lhr
② ASM磁碟指令碼:/etc/initASMDISK.sh
3.1 資料庫使用示例:
[root@docker35 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b9c33f914de6 lhrbest/oracle19casm_lhr:1.0 "/usr/sbin/init" 17 hours ago Up 17 hours 0.0.0.0:1521->1521/tcp, 22/tcp, 5501-5501/tcp, 0.0.0.0:5500->5500/tcp oracle19casmlhr
[root@docker35 ~]# docker exec -it oracle19casmlhr bash
[root@lhr2019ocpasm /]# oracleasm listdisks
ASM1
ASM2
ASM3
ASM4
ASM5
ASM6
ASM7
[root@lhr2019ocpasm /]# crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE lhr2019ocpasm STABLE
ora.FRA.dg
ONLINE ONLINE lhr2019ocpasm STABLE
ora.LISTENER.lsnr
ONLINE ONLINE lhr2019ocpasm STABLE
ora.asm
ONLINE ONLINE lhr2019ocpasm Started,STABLE
ora.ons
OFFLINE OFFLINE lhr2019ocpasm STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE lhr2019ocpasm STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE lhr2019ocpasm STABLE
ora.lhr19cdb.db
1 ONLINE ONLINE lhr2019ocpasm Open,HOME=/u01/app/o
racle/product/19.3.0
/dbhome_1,STABLE
ora.lhr19sdb.db
1 ONLINE ONLINE lhr2019ocpasm Open,HOME=/u01/app/o
racle/product/19.3.0
/dbhome_1,STABLE
--------------------------------------------------------------------------------
[root@lhr2019ocpasm /]# su - oracle
Last login: Sun Jun 28 16:36:43 CST 2020 on pts/0
[oracle@lhr2019ocpasm ~]$ sas
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jun 29 10:13:11 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SYS@lhr19cdb> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
SYS@lhr19cdb> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@lhr2019ocpasm dbs]$ . oraenv
ORACLE_SID = [lhr19cdb] ? lhr19sdb
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@lhr2019ocpasm dbs]$ sas
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jun 29 10:18:45 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SYS@lhr19sdb> show pdbs
SYS@lhr19sdb> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@lhr2019ocpasm dbs]$ ps -ef|grep pmon
grid 1173 1 0 Jun28 ? 00:00:05 asm_pmon_+ASM
oracle 1642 1 0 Jun28 ? 00:00:07 ora_pmon_lhr19cdb
oracle 23410 0 0 10:17 ? 00:00:00 ora_pmon_lhr19sdb
oracle 23882 23073 0 10:18 pts/2 00:00:00 grep --color=auto pmon
[oracle@lhr2019ocpasm dbs]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-JUN-2020 10:19:02
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 28-JUN-2020 17:29:47
Uptime 0 days 16 hr. 49 min. 14 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/19.3.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/lhr2019ocpasm/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lhr2019ocpasm)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=lhr2019ocpasm)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/19.3.0/dbhome_1/admin/lhr19cdb/xdb_wallet))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=lhr2019ocpasm)(PORT=5501))(Security=(my_wallet_directory=/u01/app/oracle/admin/lhr19sdb/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_FRA" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "86b637b62fdf7a65e053f706e80a27ca" has 1 instance(s).
Instance "lhr19cdb", status READY, has 1 handler(s) for this service...
Service "lhr19cdb" has 1 instance(s).
Instance "lhr19cdb", status READY, has 1 handler(s) for this service...
Service "lhr19cdbXDB" has 1 instance(s).
Instance "lhr19cdb", status READY, has 1 handler(s) for this service...
Service "lhr19sdb" has 1 instance(s).
Instance "lhr19sdb", status READY, has 1 handler(s) for this service...
Service "lhrsdbXDB" has 1 instance(s).
Instance "lhr19sdb", status READY, has 1 handler(s) for this service...
The command completed successfully
從監聽中可以看到,資料庫lhr19cdb的EM埠為5500,資料庫lhr19sdb的EM埠為5501
3.2 在外部訪問容器內資料庫
Microsoft Windows [版本 10.0.17134.765]
(c) 2018 Microsoft Corporation。保留所有權利。
C:\Users\lhrxxt>sqlplus sys/lhr@192.168.1.35:1521/lhr19cdb as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Mon Jun 29 10:22:29 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
SYS@192.168.1.35:1521/lhr19cdb> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
SYS@192.168.1.35:1521/lhr19cdb> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
C:\Users\lhrxxt>sqlplus sys/lhr@192.168.1.35:1521/lhr19sdb as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Mon Jun 29 10:22:40 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
SYS@192.168.1.35:1521/lhr19sdb>
3.3 訪問容器內的EM
訪問地址:
https://192.168.1.35:5500/em
https://192.168.1.35:5501/em
3.4 使用ssh連線到容器內
C:\Users\lhrxxt>ssh root@192.168.1.35 -p222
The authenticity of host '[192.168.1.35]:222 ([192.168.1.35]:222)' can't be established.
ECDSA key fingerprint is SHA256:F5eg+8MD/fIIF5xnbNr1P0ddok7orVtFb+jji5xq33I.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.1.35]:222' (ECDSA) to the list of known hosts.
root@192.168.1.35's password:
Last login: Wed Jun 24 11:07:12 2020
[root@lhr2019ocpasm ~]#
[root@lhr2019ocpasm ~]#
[root@lhr2019ocpasm ~]#
[root@lhr2019ocpasm ~]# crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE lhr2019ocpasm STABLE
ora.FRA.dg
ONLINE ONLINE lhr2019ocpasm STABLE
ora.LISTENER.lsnr
ONLINE ONLINE lhr2019ocpasm STABLE
ora.asm
ONLINE ONLINE lhr2019ocpasm Started,STABLE
ora.ons
OFFLINE OFFLINE lhr2019ocpasm STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE lhr2019ocpasm STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE lhr2019ocpasm STABLE
ora.lhr19cdb.db
1 ONLINE OFFLINE lhr2019ocpasm Instance Shutdown,ST
ARTING
ora.lhr19sdb.db
1 ONLINE ONLINE lhr2019ocpasm Open,HOME=/u01/app/o
racle/product/19.3.0
/dbhome_1,STABLE
--------------------------------------------------------------------------------
About Me
● 本文作者:小麥苗,部分內容整理自網路,若有侵權請聯絡小麥苗刪除
● 本文在個人微 信公眾號( DB寶)上有同步更新
● QQ群號: 230161599 、618766405,微信群私聊
● 個人QQ號(646634621),微 訊號(db_bao),註明新增緣由
● 於 2020年7月 在西安完成
● 最新修改時間:2020年7月
● 版權所有,歡迎分享本文,轉載請保留出處
●小麥苗的微店: https://weidian.com/s/793741433?wfr=c&ifr=shopdetail
●小麥苗出版的資料庫類叢書: http://blog.itpub.net/26736162/viewspace-2142121/
●小麥苗OCP、OCM、高可用、DBA學習班: http://blog.itpub.net/26736162/viewspace-2148098/
●資料庫筆試面試題庫及解答: http://blog.itpub.net/26736162/viewspace-2134706/
使用微信客戶端掃描下面的二維碼來關注小麥苗的微信公眾號( DB寶)及QQ群(DBA寶典)、新增小麥苗微信, 學習最實用的資料庫技術。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2703950/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【DB寶12】在Docker中只需2步即可擁有Oracle 12cR2(12.2.0.1)企業版環境DockerOracle
- 【DB寶48】JumpServer:多雲環境下更好用的堡壘機Server
- DB2 Linux環境安裝DB2Linux
- nginx 寶塔 環境部署Nginx
- DB2環境變數管理方法集TODB2變數
- webpack4生產環境和開發環境的對比Web開發環境
- emacs開發環境配置(4)——rust開發環境Mac開發環境Rust
- AngularJS 4(一)【搭建環境】AngularJS
- 報名參課 | 解鎖 Serverless+AI 新模式,擁有專屬AIGC環境ServerAI模式GC
- 【DB寶60】PG12高可用之1主2從流複製環境搭建及切換測試
- SpringMVC 實現支付寶支付功能(沙箱環境)SpringMVC
- 19c環境bbed安裝及db_name檢視
- 寶塔皮膚系統和環境的相容性?
- springboot mybatis列舉配置(每次只需新增一個列舉類即可)Spring BootMyBatis
- 有贊環境解決方案
- Pytorch複製現有環境PyTorch
- 4. 環境引數規範
- react-native 環境搭建(1/4)React
- 詳解vue-cli4環境變數與分環境打包方法Vue變數
- 只需一行Python程式碼即可玩20幾款小遊戲Python遊戲
- VALL-EX下載介紹:只需3秒錄音,即可克隆你的聲音
- Windows環境下的Nginx環境搭建WindowsNginx
- spring boot學習4 多環境配置Spring Boot
- 除錯環境 寶塔 mysql root 遠端登入除錯MySql
- 紅寶書總結-執行環境、作用域鏈
- (一)Linux環境的學習環境的搭建Linux
- Webpack4 學習筆記八 開發環境和生產環境配置Web筆記開發環境
- 只需要一份Yaml檔案,即可實現UI自動化YAMLUI
- 一個只需要一行程式碼即可調出的 Progress,高度定製行程
- 如何正確的制定目標?(只需4步)
- Webpack 4.x搭建react開發環境WebReact開發環境
- webpack4 多頁面,多環境配置Web
- [原始碼解析] TensorFlow 分散式環境(4) --- WorkerCache原始碼分散式
- Linux寶塔皮膚安裝Windows環境搭建企業LinuxWindows
- 在UE4中建立受《羞辱》啟發的環境
- 配置開發環境、生成環境、測試環境開發環境
- 易優CMS寶塔環境教你去掉URL中index.php的方法IndexPHP
- 什麼是環境變數?python設定環境變數有什麼用?變數Python