[Oracle]Oracle鏡像安裝及使用教程


Oracle鏡像安裝及使用教程

一、環境:

系統:Ubuntu 18.04

 

二、Oracle鏡像安裝及使用

  • 下載oracle鏡像

  docker pull registry.cn-hangzhou.aliyuncs.com/qida/oracle-xe-11g

 

  • 查看鏡像

   docker images

 

  • 創建並啟動容器

 docker run -d -p 1521:1521 --name oracle11 registry.cn-hangzhou.aliyuncs.com/qida/oracle-xe-11g

 

  • 查看當前運行的容器

  docker ps

 

  • 進入已經啟動的oracle的容器

  docker exec -it oracle11 /bin/bash

 

  • 進入sqlplus

sqlplus /nolog;

 

  • 使用sysdba角色登錄sqlplus

conn sys/oracle as sysdba;

 

 

  • 查看當前實例下的數據庫

select instance_name from v$instance;

 

  • 查看有多少個數據表

select count(*) from user_tables;

 

  • 創建表空間

create tablespace cyberpeace datafile '/u01/app/oracle/oradata/XE/cyberpeace.dbf' size 100m autoextend on next 10m;

 

  • 創建用戶並指定表空間

create user cyberpeace identified by 123456 default tablespace cyberpeace;

 

  •  授予用戶dba權限

grant dba to cyberpeace;

 

  • 設置自增序列
create sequence img_id
minvalue 1
nomax value
increment by 1
start with 1
nocache;

create or replace trigger img_tg_insertId
before insert on IMAGE for each row
begin
  select img_id.Nextval into:new.id from dual;
end;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM