Oracle database on linux or windows

Oracle database on linux or windows

Oracle Database XE Quick Start

If you are experienced at installing software then use the steps provided below.
For more information and full step-by-step instructions please review the installation guides for Linux or Windows.

Installing Oracle Database XE

Oracle Linux

  • Download oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm
  • Run “yum -y localinstall oracle-database-xe*”
  • Run “/etc/init.d/oracle-xe-21c configure”

Red Hat compatible Linux distribution

  • Download oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
  • Download oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm
  • Run “yum -y localinstall oracle-database-xe*”
  • Run “/etc/init.d/oracle-xe-21c configure”

Windows

  • Log into Windows with a user that is a direct member of the Administrators group.
  • If the ORACLE_HOME or TNS_ADMIN environment variable has been set, unset it first.
  • Download OracleXE213_Win64.zip
  • Extract zip file to a local temporary directory and run setup.exe.
  • When prompted by the installer, provide the install location, the database password, and begin the installation.
  • When the installation is complete, note the provided connection strings on the final screen.

Docker

  • Docker images can be downloaded at https://container-registry.oracle.com
  • Linux Docker images can also be built using the Dockerfiles provided under https://github.com/oracle/docker-images

VirtualBox

A Linux VirtualBox VM can be built using the Vagrant scripts provided under https://github.com/oracle/vagrant-boxes. You can also install into a Windows VirtualBox VM providing the version of Windows is supported. See the Oracle Database XE Windows Installation Guide.

Connecting to Oracle Database XE

SQL

  • — Connect string format: [username]/[password]@//[hostname]:[port]/[DB service name] [AS SYSDBA]
  • — To connect to the Container Database (CDB) use:
  • sqlplus sys/[Password]@//localhost:1521/XE as sysdba
  • — To connect to the first Pluggable Database (PDB) use:
  • sqlplus sys/[Password]@//localhost:1521/XEPDB1 as sysdba

Java

  • OracleDataSource ods = new OracleDataSource();
  • ods.setURL(«jdbc:oracle:thin:@//localhost:1521/XEPDB1»); // jdbc:oracle:thin@//[hostname]:[port]/[DB service name]
  • ods.setUser(«[Username]»);
  • ods.setPassword(«[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));
    >
Читайте также:  Linux запрет обновления пакета

Python

  • import cx_Oracle
  • # Connect string format: [username]/[password]@//[hostname]:[port]/[DB service name]
  • conn = cx_Oracle.connect(«[Username]/[Password]@//localhost:1521/XEPDB1»)
  • cur = conn.cursor()
  • cur.execute(«SELECT ‘Hello World!’ FROM dual»)
  • res = cur.fetchall()
  • print(res)

Node.js

  • var oracledb = require(‘oracledb’);
  • async function run()
  • let connection = await oracledb.getConnection(
  • user : «[Username]»,
  • password : «[Password]»,
  • connectString : «localhost:1521/XEPDB1» // [hostname]:[port]/[DB service name]
  • >);
  • let result = await connection.execute( «SELECT ‘Hello World!’ FROM dual»);
  • console.log(result.rows[0]);
  • >
  • run();

C# / .NET

  • // Connection string format: User Source=[hostname]:[port]/[DB service name];
  • OracleConnection con = new OracleConnection(«User 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 service name]
  • $c = oci_pconnect(«[Username]», «[Password]», «//localhost:1521/XEPDB1»);
  • $s = oci_parse($c, «SELECT ‘Hello World!’ FROM dual»);
  • oci_execute($s);
  • oci_fetch_all($s, $res);
  • echo «
    \n"
  • var_dump($res);
  • echo "

    \n»;

Ruby

  • require ‘oci8’
  • // «[username]/[password]@//[hostname]:[port]/[DB service name]»
  • con = OCI8.new(«[Username]/[Password]@//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 (
  • «fmt»
  • «log»
  • «database/sql»
  • _ «github.com/godror/godror»
  • )
  • func main() <
  • // connectString format: [hostname]:[port]/[DB service name]
  • dsn := `user=»[Username]»
  • password=»[Password]»
  • connectString=»localhost:1521/XEPDB1″`
  • db, err := sql.Open(«godror», dsn)
  • if err != nil
  • panic(err)
  • >
  • defer db.Close()
  • rows, err := db.Query(«SELECT ‘Hello World!’ FROM dual»)
  • if err != nil
  • panic(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)
  • >
  • >

Источник

Oracle database on linux or windows

  • Log into Windows with a user that is a member of the Administrators group.
  • If the ORACLE_HOME environment variable has been set, then unset it.
  • Download OracleXE184_Win64.zip
  • Extract zip file to a local temporary directory and run setup.exe.
  • When prompted by the installer, provide the install location, the database password, and begin the installation.
  • When the installation is complete, note the provided connection strings on the final screen.

Docker

A Linux Docker image can be built using the Dockerfiles provided under https://github.com/oracle/docker-images

VirtualBox

A Linux VirtualBox VM can be built using the Vagrant scripts provided under https://github.com/oracle/vagrant-boxes. You can also install into a Windows VirtualBox VM providing the version of Windows is supported. See the Oracle Database XE Windows Installation Guide.

Connecting to Oracle Database XE

SQL

  • — Connect string format: [username]/[password]@//[hostname]:[port]/[DB service name] [AS SYSDBA]
  • — To connect to the Container Database (CDB) use:
  • sqlplus sys/GetStartedWithXE@//localhost:1521/XE as sysdba
  • — To connect to the first Pluggable Database (PDB) use:
  • sqlplus sys/GetStartedWithXE@//localhost:1521/XEPDB1 as sysdba

Java

  • OracleDataSource ods = new OracleDataSource();
  • ods.setURL(«jdbc:oracle:thin:@//localhost:1521/XEPDB1»); // jdbc:oracle:thin@//[hostname]:[port]/[DB service name]
  • ods.setUser(«system»); // [username]
  • ods.setPassword(«GetStartedWithXE»); // [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 service name]
  • conn = cx_Oracle.connect(«system/GetStartedWithXE@//localhost:1521/XEPDB1»)
  • cur = conn.cursor()
  • cur.execute(«SELECT ‘Hello World!’ FROM dual»)
  • res = cur.fetchall()
  • print(res)

Node.js

  • var oracledb = require(‘oracledb’);
  • async function run()
  • let connection = await oracledb.getConnection(
  • user : «system», // [username]
  • password : «GetStartedWithXE», // [password]
  • connectString : «localhost:1521/XEPDB1» // [hostname]:[port]/[DB service name]
  • >);
  • let result = await connection.execute( «SELECT ‘Hello World!’ FROM dual»);
  • console.log(result.rows[0]);
  • >
  • run();

C# / .NET

  • // Connection string format: User Source=[hostname]:[port]/[DB service name];
  • OracleConnection con = new OracleConnection(«User 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 service name]
  • $c = oci_pconnect(«system», «GetStartedWithXE», «//localhost:1521/XEPDB1»);
  • $s = oci_parse($c, «SELECT ‘Hello World!’ FROM dual»);
  • oci_execute($s);
  • oci_fetch_all($s, $res);
  • echo «
    \n"
  • var_dump($res);
  • echo "

    \n»;

Ruby

  • require ‘oci8’
  • // «[username]/[password]@//[hostname]:[port]/[DB service name]»
  • con = OCI8.new(«system/GetStartedWithXE@//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 service name]
  • db, err := sql.Open(«goracle», «system/GetStartedWithXE@//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)
  • >
  • >

Источник

Oracle database on linux or windows

E Oracle Database Differences on Windows and UNIX

Learn about the differences between Oracle Database on Windows and UNIX. For Oracle Database developers and database administrators moving from a UNIX platform to Windows, this information can be helpful in understanding Windows features that are relevant to Oracle Database.

  • Automatic Startup and Shutdown
    On UNIX, several files and scripts in different directories are used to start an instance automatically.
  • Background Processing and Batch Jobs
    UNIX provides sophisticated control mechanisms for background processing and batch jobs.
  • Diagnostic and Tuning Utilities
    On UNIX, utilities such as sar and vmstat are used to monitor Oracle Database background and shadow processes.
  • Direct Writes to Disk
    On both UNIX and Windows platforms, bypassing the file system buffer cache ensures data is written to disk.
  • Dynamic Link Libraries (DLLs)
    Shared libraries on UNIX are similar to shared DLLs on Windows.
  • Hot Backups
    A (manual) hot backup is equivalent to backing up a tablespace that is in an offline backup mode.
  • Initialization Parameters: Multiple Database Writers
    On UNIX, you can specify many database writer process with initialization parameter DB_WRITERS .
  • Installation Accounts and Groups
    UNIX uses the concept of a DBA group. The root account cannot be used to install Oracle Database.
  • Oracle Database Installation
    The following manual setup tasks, all required on UNIX, are not required on Windows:
  • Memory Resources
    The resources provided by the UNIX default kernels are often inadequate for a medium or large instance of Oracle Database.
  • Microsoft Transaction Server
    Windows coordinates distributed transactions through the Microsoft Distributed Transaction Coordinator (DTC), one of the components of Microsoft Transaction Server.
  • Multiple Oracle Homes and OFA
    The goal of OFA is to place all Oracle Database software under one ORACLE_HOME directory and to spread database files across different physical drives as databases increase in size.
  • Oracle Home User and Oracle User
    On Linux and UNIX systems, you must create and use a software owner user account ( oracle ), and this user must belong to the Oracle Inventory group ( oinstall ) and also must be a member of the appropriate OSDBA, OSOPER, OSBACKUPDBA, OSDGDBA, and OSKMDBA groups.
  • Raw Partitions
    Data files for tablespaces may be stored on a file system or on raw partitions.
  • Windows Services
    Windows services are similar to UNIX daemons.

Источник

Оцените статью
Adblock
detector