Xiaopei's DokuWiki

These are the good times in your life,
so put on a smile and it'll be alright

User Tools

Site Tools


it:oracle

Oracle

  • 8i, i for Internet
  • 10g, g for grid computing
  • 12c, c for cloud

XE 11g 和普通版的区别

这个镜像超棒 wnameless/docker-oracle-xe-11g: Dockerfile of Oracle Database Express Edition 11g Release 2

  1. 没有 SEGMENT CREATION DEFERRED 功能

常见错误

创建用户

--1:创建临时表空间
CREATE TEMPORARY tablespace yunyu_sws_temp  
tempfile 'yunyu_sws_temp.dbf' 
SIZE 50m  
autoextend ON  
NEXT 50m maxsize 2048m  
extent management LOCAL;
/
--2:创建数据表空间
CREATE tablespace yunyu_sws  
logging  
datafile 'yunyu_sws.dbf' 
SIZE 50m  
autoextend ON  
NEXT 50m maxsize 2048m  
extent management LOCAL;
/
 
--第3步:创建用户并指定表空间
CREATE USER yunyu_sws IDENTIFIED BY yunyu_sws
DEFAULT tablespace yunyu_sws
TEMPORARY tablespace yunyu_sws_temp;  
/
 
--4.赋权  
GRANT CONNECT,resource TO yunyu_sws;  
/
GRANT CREATE any SEQUENCE TO yunyu_sws;  
/
GRANT CREATE any TABLE TO yunyu_sws;  
/
GRANT DELETE any TABLE TO yunyu_sws;  
/
GRANT INSERT any TABLE TO yunyu_sws;
 
GRANT SELECT any TABLE TO yunyu_sws;  
/
GRANT unlimited tablespace TO yunyu_sws;  
/
GRANT EXECUTE any PROCEDURE TO yunyu_sws;  
/
GRANT UPDATE any TABLE TO yunyu_sws;  
/
GRANT CREATE any VIEW TO yunyu_sws;  
/

php

`be-ng/main` 中使用 laravel-oci8 来支持 oracle:https://github.com/yajra/laravel-oci8/

具体步骤如下:

  1. 下载并安装 oracle instant client:http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
        oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
        oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
        oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
  2. 如果是 ubuntu,需要安装 alien,并用 alien 安装,见:https://help.ubuntu.com/community/Oracle%20Instant%20Client
  3. 在 cli 和 fpm 的 php.ini 中增加配置:extension=oci8.so

server

# 默认用户 ?...
$ sqlplus "/ as sysdba"

client

安装

按此文档: Oracle Instant Client - Community Ubuntu Documentation 要注意 “Basic”, “SQL*Plus” and the “SDK” 都要安装

连接

测试连接可用 $ sqlplus username/password@dbhost:1521/SID , sqlplus 更详细的用法见 sqlplus连接远程数据库 - zhou__zhou - 博客园

当密码中包含 @ 字符时, 使用 sqlplus 会有问题, 详见 A nasty password-related gotcha in sqlplus | Fuzzy.cz

另外 oracle 的连接在使用端口转发(tcptunnel 或 ssh)时会有问题, 见 Using oracle db through ssh tunnel. Error "ORA-12541: TNS:no listener" - Stack Overflow

it/oracle.txt · Last modified: 2017/02/28 17:39 by admin