Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching, Zero-Downtime Upgrade, GoldenGate

Oracle Exadata ,Oracle ODA, Oracle ZDLRA


当前位置: 首页 » 技术文章 » Oracle

Oracle Database Express Edition 18c发布了

在2018年10月19日,Oracle 发布了Oracle Database Express Edition (XE)18c的第一个版本, 版本号为18.4.0.0.0。目前只支持在Linux上部署。其他平台的比如Windows版、Docker版、VirtualBox版还没有释出。这个版本是没有Oracle服务,没有补丁支持。也不能提交SR,如果有问题可以到https://community.oracle.com/community/database/developer-tools/oracle_database_express_edition_xe社区提问。


在Oracle Database 18c XE上资源的限制
    3 Pluggable Databases
    2 CPUs for foreground processes
    2GB of RAM (SGA and PGA combined)
    12GB of user data on disk (irrespective of compression factor)

在Oracle Linux上安装方法
    Download oracle-database-xe-18c-1.0-1.x86_64.rpm
    Run “yum -y localinstall oracle-database*18c*”
    Run “/etc/init.d/oracle-xe-18c configure”
在Red Hat compatible Linux distribution上安装方
    Download oracle-database-xe-18c-1.0-1.x86_64.rpm
    Run “curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm”
    Run “yum -y localinstall oracle-database*18c*”
    Run “/etc/init.d/oracle-xe-18c configure”
下面是不同语言连接数据库的方式
SQL
    -- Connect string format: [username]/[password]@//[hostname]:[port]/[DB name] [AS SYSDBA]
    -- To connect to the Container Database (CDB) use:
    sqlplus sys/GetStarted18c@//localhost:1521/XE as sysdba
     
    -- To connect to the first Pluggable Database (PDB) use:
    sqlplus sys/GetStarted18c@//localhost:1521/XEPDB1 as sysdba
Java
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("jdbc:oracle:thin:@//localhost:1521/XEPDB1"); // jdbc:oracle:thin@//[hostname]:[port]/[DB name]
    ods.setUser("system"); // [username]
    ods.setPassword("GetStarted18c"); // [password]
    Connection conn = ods.getConnection();
     
    PreparedStatement stmt = conn.prepareStatement("SELECT 'Hello World!' FROM dual");
    ResultSet rslt = stmt.executeQuery();
    while (rslt.next()) {
      System.out.println(rslt.getString(1));
    }
Python
    import cx_Oracle
     
    # Connect string format: [username]/[password]@//[hostname]:[port]/[DB name]
    conn = cx_Oracle.connect("system/GetStarted18c@//localhost:1521/XEPDB1")
    cur = conn.cursor()
    cur.execute("SELECT 'Hello World!' FROM dual")
    res = cur.fetchall()
    print(res)
Node.js
    var oracledb = require('oracledb');
     
    oracledb.getConnection(
     {
      user : "system", // [username]
      password : "GetStarted18c", // [password]
      connectString : "//localhost:1521/XEPDB1" //[hostname]:[port]/[DB name]
     },
     function(err, connection) {
      if (err) {
       console.error(err.message);
       return;
      }
      connection.execute(
       "SELECT 'Hello World!' FROM dual",
       function(err, result) {
        if (err) {
         console.error(err.message);
         doRelease(connection);
         return;
        }
        console.log(result.rows);
        doRelease(connection);
      });
    });
     
    function doRelease(connection) {
     connection.close(
      function(err) {
       if (err) {
        console.error(err.message);
       }
     });
    }
C#.NET
    / Connection string format: User Id=[username];Password=[password];Data Source=[hostname]:[port]/[DB name];
    OracleConnection con = new OracleConnection("User Id=system;Password=GetStarted18c;Data
    Source=localhost:1521/XEPDB1;");
    con.Open();
    OracleCommand cmd = con.CreateCommand();
    cmd.CommandText = "SELECT \'Hello World!\' FROM dual";
     
    OracleDataReader reader = cmd.ExecuteReader();
    reader.Read();
    Console.WriteLine(reader.GetString(0));
PHP
    // [username], [password], //[hostname]:[port]/[DB name]
    $c = oci_pconnect("system", "GetStarted18c", "//localhost:1521/XEPDB1");
    $s = oci_parse($c, "SELECT 'Hello World!' FROM dual");
    oci_execute($s);
    oci_fetch_all($s, $res);
    echo "<pre>\n"
    var_dump($res);
    echo "</pre>\n";
Ruby
    require 'oci8'
    // "[username]/[password]@//[hostname]:[port]/[DB name]"
    con = OCI8.new("system/GetStarted18c@//localhost:1521/XEPDB1")
    statement = "SELECT 'Hello World!' FROM dual"
    cursor = con.parse(statement)
    cursor.exec
    cursor.fetch do |row|
      print row
    end
Go
    package main
    import (
      "database/sql"
      "fmt"
      "log"
      _ "gopkg.in/goracle.v2"
    )
     
    func main() {
     
      // Connect string format: [username]/[password]@//[hostname]:[port]/[DB name]
      db, err := sql.Open("goracle", "system/GetStarted18c@//localhost:1521/XEPDB1")
      if err != nil {
        log.Fatal(err)
      }
      defer db.Close()
     
      rows, err := db.Query("SELECT 'Hello World!' FROM dual")
      if err != nil {
        log.Fatal(err)
      }
      defer rows.Close()
     
      var strVal string
      for rows.Next() {
        err := rows.Scan(&strVal)
        if err != nil {
          log.Fatal(err)
        }
        fmt.Println(strVal)
      }
      err = rows.Err()
      if err != nil {
        log.Fatal(err)
      }
     
    }


Reference
https://www.oracle.com/database/technologies/appdev/xe.html

https://www.oracle.com/database/technologies/appdev/xe/quickstart.html
https://www.oracle.com/database/technologies/appdev/xe/faq.html
https://docs.oracle.com/en/database/oracle/oracle-database/18/xeinl/installation-guide.html

https://www.oracle.com/technetwork/licenses/db18c-express-license-5137264.html


关键词:xe 18c oracle 

相关文章

Oracle Database 23ai初体验
Oracle GoldenGate 23ai for Oracle和PG发布了
Oracle 23ai发布了
Oracle宣布推出全球分布式自治数据库
Oracle 23c新特性---开发人员
Oracle 23c free FAQ
Oracle 23c free and OCI Base Service
Oracle 21c
基于PDB的Active Data Guard(Oracle 21.7+)
在Oracle数据库中使用REST
OGG from MySQL to Oracle
Oracle数据库容灾之两地三中心实践
Top