Start oracle database oracle linux

Start oracle database oracle linux

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
Читайте также:  Using at linux command line

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));
    >

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)
  • >
  • >

Источник

Start oracle database oracle linux

You can start and stop the database manually, set it to automatically after the system shuts down and starts, or using Enterprise Manager.

Shutting Down and Starting Up Using SQL*Plus

You can shut down and start the database using SQL*Plus.

To shutdown the database, login to the oracle user with its environment variables set for access to the XE database, and issue the following SQL*Plus command:

$ sqlplus / as sysdba SQL> SHUTDOWN IMMEDIATE

To start the database, issue the commands:

SQL> STARTUP SQL> ALTER PLUGGABLE DATABASE ALL OPEN;

Automating Shutdown and Startup

Oracle recommends that you configure the system to automatically start Oracle Database when the system starts, and to automatically shut it down when the system shuts down. Automating database shutdown guards against incorrect database shutdown.

To automate the startup and shutdown of the listener and database, execute the following commands as root :

# systemctl daemon-reload # systemctl enable oracle-xe-21c
# systemctl daemon-reload # systemctl enable oracle-xe-21c

Shutting Down and Starting Up Using the Configuration Services Script

The XE configuration script shows an incorrect listener status message. When the database listener is stopped or down, the script might show the following listener status message :

/etc/init.d/oracle-xe-21c status Status of the Oracle XE 21c service: LISTENER status: NOT CONFIGURED XE Database status: STOPPED

This is an incorrect listener status message. It does not mean that the script in incorrectly configured.

Run the following commands as root using sudo .

Run the following command to start the listener and database:

# systemctl start oracle-xe-21c

Run the following command to stop the database and the listener:

# systemctl stop oracle-xe-21c

Run the following command to stop and start the listener and database:

# systemctl restart oracle-xe-21c

Run the following command to start the listener and database:

# systemctl start oracle-xe-21c

Run the following command to stop the database and the listener:

# systemctl stop oracle-xe-21c

Run the following command to stop and start the listener and database:

# systemctl restart oracle-xe-21c

Related Topics

Источник

Start oracle database oracle linux

You can start and stop the database manually, set it to automatically after the system shuts down and starts, or using Enterprise Manager.

Shutting Down and Starting Up Using the Configuration Services Script

Execute these commands as root using sudo .

You can start and stop the database using the /etc/init.d/oracle-xe-18c script.

Run the following command to start the listener and database:

# /etc/init.d/oracle-xe-18c start

Run the following command to stop the database and the listener:

Run the following command to stop and start the listener and database:

# /etc/init.d/oracle-xe-18c restart

Run the following command to start the listener and database:

# systemctl start oracle-xe-18c

Run the following command to stop the database and the listener:

# systemctl stop oracle-xe-18c

Run the following command to stop and start the listener and database:

# systemctl restart oracle-xe-18c

Shutting Down and Starting Up Using SQL*Plus

You can shut down and start the database using SQL*Plus.

To shutdown the database, login to the oracle user with its environment variables set for access to the XE database, and issue the following SQL*Plus command:

$ sqlplus / as sysdba SQL> SHUTDOWN IMMEDIATE

To start the database, issue the commands:

SQL> STARTUP SQL> ALTER PLUGGABLE DATABASE ALL OPEN;
  • Oracle Database 2 Day DBA for general information about managing a database
  • Oracle Multitenant Administration Guide for more information about shutting down and starting a PDB

Automating Shutdown and Startup

Oracle recommends that you configure the system to automatically start Oracle Database when the system starts, and to automatically shut it down when the system shuts down. Automating database shutdown guards against incorrect database shutdown.

To automate the startup and shutdown of the listener and database, execute the following commands as root :

For Oracle Linux 6, run these commands:

# /sbin/chkconfig oracle-xe-18c on # /sbin/service oracle-xe-18c start
# systemctl daemon-reload # systemctl enable oracle-xe-18c

Источник

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