How to install run Oracle on your Linux machine

zhaozj2021-02-08  287

How to install run Oracle on your Linux machine

Publisher: NetBullLinuxByte Note: This site has the latest version of Oracle! Summary: Oracle announced the portation of Oracle 8 and Oracle Application Server to Linux at the end of last year. This is a clear marker: the whole world should recognize that Linux is already a serious operating system, enough to assume enterprise-class applications. Uche Ogbuji explains how to install, configure, and initially use Oracle 8 for Linux below. How to install an Oracle on your Linux machine After a practical guide after many rumors and hints, Oracle released the Oracle 8 database and Oracle Application Server on LINUX on October 7, 1998. This is the most dazzling scene in Linux recent history. Whether you have a huge reputation of Oracle, the company's great reputation in large-scale data applications makes this product to become a clear marker: the whole world should realize that Linux is already a serious operating system, enough Assumption of enterprise-class applications. But for anyone who really cares Linux, various propaganda offensive is just a cloud, only the code is critical. (ONLY CODE MATTERS). In fact, Oracle 8i, that is, 8.1.5 for Linux has been developed, but the JServer module has problems, so Oracle has not been released.) Starting action to install Oracle on RedHat can be quite easy But if you are completely followed by Oracle's documents, you may not be so easy. The fastest shortcut is the homepage of Tom Bisset: http://jordan.fortwayne.com/oracle. If you look at Tom's homepage, you will notice that he misses the JDBC installation. If you are ready to use JDBC (for cross-platform Oracle applications), you can add this option when you ask you to select the component (Components) when you install the screen. Of course, you should first install JDK. I personally use BlackDown JDK 1.1.7. (Translation: Red Hat) Then need to set the ClassPath environment variable of Oracle users, the best way is to add one sentence in the Oracle user directory .Bash_profile or .profile: ClassPath = / usr / lib / jdk / lib / class. Zip; Export ClassPath, if you only need to do the web applet, choose "JDK 1.1 JDBC Thin Driver" when you need to make a complete Java app, choose JDK 1.1 JDBC OCI Driver ". Also note: When the installer allows you to enter each password, if the password does not meet the specification, it will not warned. When I installed the first time, I added ".", This is allowed in Unix, Oracle is another code. The program tells me if the password is issued until the installation is over. At that time, I was a installation from my head. Another problem with the installer is to try to copy files in the directory that has not been established. It is necessary to install MKDIR -P /U01/App/Oracle/server.805/install before installation. This is all over. After the installation is successful, you must log in as root and run root.sh.

I made the following changes to root.sh: • Changed from / usr / lbin from / usr / lbin · Increase environment variable log = / tmp / oracle-root.sh.log, such script run results I will record ROOT.SH, I want to run as a server, I must set Two_Task variables first; however, it is actually necessary to set up this variable if ROOT.SH is run from the machine installed in Oracle. Python and Oracle I have configured python (a powerful, fast-oriented scripting language) to test Oracle's programming interfaces and network interfaces. In Python, you want to even Oracle, you need DCORACLE modules for Digital Creation (author of the Zope Application Server). You only need to download the software and do it according to indication. If you are DCORACLE 1.1.0, use the setup-8.0.4 configuration, remove -lsocket, -lnsl, -lgen, -ld, -laio, and -lposix4 from the Oracle_libs variable, which are Solaris is dedicated. Note that the Python settings installed in RedHat 5.2 and 6.0, the config directory and the include directory are omitted, and the modules of the third party cannot be compiled. You must compile python yourself or download a suitable RPM. Looking for Python's RPM, the best place to go is Oliver Andrich's Python & Linux home page. Just rpm -e --Nodeps Python, then rpm -i python, python-dev, and other RPM. After installing Python, I run the following basic query and access Oracle. [uche @Maratesta uche] $ Python Python 1.5.1 (# 1, SEP 3 1998, 22:51:17) [GCC 2.7.2.3] on Linux-I386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> Import Dcoracle >>> #Connect to DB. Scott / Tiger Are The Test Database UserName / Password >>> DBC = DCORACLE.CONNECT ("Scott / Tiger @ Sforza") #Sforza Is The Local Oracle Server >>> c = dbc.cursor () >>> C.EXECUTE ("Select * from Emp where Emp.Deptno = 10") >>> Rows = C.Fetchall () >>> Print Rows [(7782, Clark, Manager, 7839, DBIDATE (1981 -06-09 00:00:00), 2450.0, None, 10), (7839, KING, PRESIDENT, NONE, DBIDATE (1981-11-17 00:00:00), 5000.0, None, 10), (7934 , Miller, Clerk, 7782, DBIDATE (1982-01-23 00:00:00), 1300.0, None, 10)] Development Workstation Configuration I compiled the Python and other programming interfaces on a machine other than the database server.

Initially, it seems that I have to install all Pro * C / C packages of Oracle. But I have to run the Oracle installer to that step, so I don't want to do that. So I found the smallest header file (include), object file (Object) and library file (library): $ oracle_home / lib / * $ oracle_home / rdbms / h * $ Oracle_Home / RDBMS / LIB / * There is oracle_home for / usr / local / oracle. Note that these files have not allowed you to embed the SQL statement directly in the C program, only after the full installation of Pro * C / C is available. If you want to use Java, you have to add $ oracle_home / jdbc / lib / *; pay attention to add this directory to the ClassPath variable. JDBC is connected to test JDBC connections, I made a small program, showing all employee names in the test library in a listbox. The following program 1 is a Java Applet called JDBC, and the program 2 is an HTML hyperbocity that calls the Java program.

If your JDBC is already installed, copy the program 1 to jdbctest.java, copy the program 2 to jdbctest.html, then: javac jdbctest.java appletViewer jdbctest.html You can see the result: Program 1: / * Applet That Reads in Several Rows from A Remote Oracle Database and Presents Themin A ListBox. * / Import Java.sql. *; Import Java.awt. *; Import Java.Applet. *; PUBLIC class JDBCTest extends Applet {// Single-select ListBox private List employee_list = new List (5, false) public void init () {setLayout (new BorderLayout ()); try {// Set up the Oracle JDBC driver DriverManager.registerDriver ( new oracle.jdbc.driver.OracleDriver ()); // Connect to an Oracle database on machine sforza, using username // "scott" and password "tiger" Connection DB_conn = DriverManager.getConnection ( "jdbc: oracle: thin: @ Sforza: 1521: ORCL "," Scott "," Tiger "); // Connection DB_CONN = DriverManager.getConnection (" JDBC: Oracle: Thin: Scott / Tiger @ Sforza: 1521: OrCl "); // Create a JDBC Statement Object Statement Statement_obj = db_con.createstatement (); // Execute a Query to Get T he employee names from the test DB ResultSet results = statement_obj.executeQuery ( "select ENAME from EMP"); // Populate the list box with all the employee names while (results.next ()) {employee_list.add (results.getString ( 1);}} Catch (SQLEXCEPTION E) {throw new runtimeException ("SQL Exception" E.getMessage ());} add (employee_list);}} program 2: Oracle JDBC Driver Testheight = "150"> Your

Browser Doesnt Support Java.

Last Modified: Sat Mar 6 22:19:26 MST 1999

Most of the program 1 is a JDBC call that is unrelated to the specific database. You can also access PostgreSQL, the main and Oracle-related parts: Connection DB_CONN = DriverManager.getConnection ("JDBC: Oracle: th: @sforza: 1521: ORCL "," Scott "," Tiger "); Note the format of the URI in Oracle Thin JDBC Driver: JDBC: Oracle: Thin: @:

:

If you want to include the username and password in the URI:

JDBC: Oracle: Thin: username / password @

:

:

The same URI has a longer format:

"JDBC: Oracle: Thin: @ (description = (address = (Host =

_Ip>) (Protocol

= TCP) (port =

)) (connect_data = (sID =

))) "

Note that ORCL is the default SID (System Identifier, System Identifier) ​​of the system installation.

If you use other SIDs during installation,

That SID is also used in the URI. $ Oracle_home / network / admin / tnsnames.ora package

Include the port and SID settings of the Oracle server.

This is the configuration file for TNS Listener, Oracle Network Connection Process. If you cannot connect the database over the network, you should first check if the port number and SID are correct, whether the TNS Listner is normal (the translation: lsnrctl status, or tnsping). JDBC is not the only means of developing SQL database applications, and ANSI standard SQLJ allows direct embedding SQL statements directly in the Java program. Oracle for Linux 8.0.5 does not bundle SQLJ, but can be obtained as another independent product. SQLJ is 100% Java, and there is no problem in Linux, in fact, SQLJ is using JDBC in the underlying, so it can be interconnected with any SQL database, not limited to Oracle.

I hope that these examples above can help your programming. Unfortunately, the programming document of Oracle for Linux is quite small, or it is hidden very deep :) Maybe before the database is committed, you have to first take one or two books first.

PL / SQL

Process language extension (PL / SQL) for SQL may be the most famous characteristics of Oracle. This powerful professional database management language allows you to control the declarative SQL. Generally, the stored procedure stored with the command line SQLPlus, the graphical developer / 2000 (currently not currently available on Linux) or other tools, allowing you to have a large number of Oracle (Oracle Application Server, Python) , Perl, JDBC or C) Access.

Program 3:

Create or Replace Package Stored_Sample AS

Function get_annual_salary (EMP_NUMBER in Number) Return Number;

End stored_sample;

/

Create or Replace Package Body Stored_Sample AS

Function GET_ANNUAL_SALARY (EMP_NUMBER in Number) Return Numberis

Annual_salary Number;

Monthly_SAlary Number;

Begin

SELECT SAL INTO MONTHLY_SALARY from Emp where Empno = EMP_NUMBER;

Annual_salary: = monthly_salary * 24;

Return (Annual_salary);

End get_annual_salary;

End stored_sample;

/

The above program 3 is a small demonstration of the storage process, which accepts an employee number and returns the annual salary of the employee. Related functions GET_ANNUAL_SALARY package in PL / SQL package Sample_Package.

If you copy the program 3 to the file Sample.SQL, you can run it via SQLPLUS as follows:

[Oracle @ Sforza Demo] $ SQLPLUS

SQL * Plus: Release 8.0.5.0.0 - Production on Sun Mar 7 13:36:32

1999

(c) CopyRight 1998 Oracle Corporation. All Rights Reserved.

ENTER User-name: Scott

ENTER Password:

Connected to:

Oracle8 Release 8.0.5.5.0.0 - PRODUCTION

PL / SQL Release 8.0.5.0.0 - Production

SQL> @Sample

Package created.

Package body created.

SQL> SET ServerOutput on

SQL> EXEC

DBMS_OUTPUT.PUT_LINE (Stored_Sample.Get_annual_salary (7782))

58800

PL / SQL Procedure SuccessFully Completed.

SQL>

This PL / SQL package can also be used by other programming interfaces. Python / dcoracle,

See the procedures member of the Connection object

See java.sql.callablestatement in JDBC.

Oracle has a wide range of built-in functions. In fact, most of the functions that have been completed with external code can be completed efficiently by PL / SQL. If you need any more usual features, please refer to the PL / SQL manual to see if the function you need is already implemented. If you are ready to do a lot of Oracle programming, you often flip through the PL / SQL manual to familiarize all kinds of functions.

Manage Oracle for Linux

If you are already accustomed to run a relatively non-complex database, you have completed some daily operations in Oracle, such as establishing a new database or performance tuning. It is quite complicated. There are some key configuration files to be maintained, such as init.ora, config.ora, and tnsnames.ora. There are general ways to specify some key parameters, such as the current SID. It can be declared in the above files, or in an environment variable, or through the Oracle tool running parameters. This kind of flexibility is worthy of appreciation, but unfortunately, it is time to get the setting is also very hurtful.

Like Linux, if the security mechanism provided by Oracle is not properly managed. Time is familiar with various access rules and settings, as well as the roles of a variety of special Oracle user accounts, or worth it.

Oracle's performance tun is a very large, very specialized topic. Tuning is properly improved. Oracle runs and CPUs, memory, and exemptions are quite complex, these factors must be considered. In addition, the PL / SQL package, the stored procedure, the temporary table space, the table structure itself, all of which are increasingly complex with use, ensuring the structure of the database, no garbage, absolutely more complicated from cron running Vacuum periodically. Oracle DBA (Database Adminstrator, Database Administrator) is a famous subcommittee in computer professionals. This is not surprising. Oracle's powerful features and flexibility, while also mean all kinds of small secrets, tips, small traps, this feature is less than anyone - including Linux. You may have discovered, Oreilly Zoo (translation: All Oreilly and Associate published books) are a good place for animals. If you need to do a lot of work on Oracle, find the OREILLY Oracle album of the yellow cover. There, you will find more information sources than Oracle Byzing Tria.

Oracle for Linux vs. Oracle for NT

Oracle on NT (Demo: Oracle Sales exceeds SQL Server, is the NT Larger Database) provides a graphical interface for many management functions. Similar functions can only be accessed through SQLPlus on UNIX / Linux. Such a graphical interface is designed to be similar to the other parts of the NT control panel. Linux DBA must be familiar with SQLPLUS. NT problem is that many administrative tasks require users to complete in the main control station (before the machine screen), if you want to remotely require expensive third-party software (or Oracle Enterprise Manager?). Oracle management on UNIX can be performed from any authorized far, the effect is the same as the machine main control.

Oracle on NT uses multiple processes in a process, while Oracle on UNIX / Linux uses multiple separate, independent memory spaces (translation: Multithreaded Server, MTS, equivalent to The listed multi-threaded version mentioned in the previous article.) The implementation of the NT avoids inter-process communication, small performance advantages, but the implementation of UNIX provides much more reliability and data integrity, because one The Oracle process is not possible to pollute the address space of another Oracle process. (Translation: On NT and VMS, creating a new process is much more expensive than creating a new thread, and there is a slow switch between NT processes, and Microsoft recommends that programmers will use multithreaded. On UNIX, Building a new process is more efficient. On Linux, establish a new process and new kernel threads, Kernel Thread uses the same basic system call, the efficiency is quite high.)

On the 32-bit hardware system, Linux's EXT2 file system restriction is 2G, NT is 4G. This does not affect Oracle users because table space TableSpace can extend to multiple files, but there is still a small efficiency issue. Of course, 64-bit Linux (Alpha, Ultra-SPARC, PA-RISC) will eliminate these limits, the same 64-bit Solaris (Solaris 7). (Translation: There are actually some problems here, and I will find out to explain to all the officials. Some good tools / conclude

Oracle also released the Linux version of Oracle Application Server (OAS). In-depth discussion of OAs is outside this article, but it is indeed a powerful tool that connects the backend Oracle database to create an Internet or intranet application. OAS provides Java development capabilities, you can string from HTTP and IIOP to OCI network interface, with friendly interfaces to design web forms and reports, and other convenient tools.

Oracle is so popular, naturally has a corresponding batch of open source software (Open Source) tools. The OWS Killer is a web interface tool that can replace the OAS, integrate with the Apache Web server, Apache's JSERV Java ServeT module, providing access to Oracle databases. (Translation: OWS, Oracle Web Server is the name of the Oracle Application Server earlier). You can find more tools in Matts House to manage Oracle's stored procedures, provide fast reporting capabilities.

Mastering Oracle is not a thing of the hand, but it is not necessary to hope. Indeed, there are many more easily managed databases, but you will find if you need advanced SQL, or PL / SQL functionality, or TRIGGER, or various extensions, or advanced transaction management, or must coexist with the Oracle system. Linux is an excellent Oracle platform. You have explored this far in Linux's world and must also deal with Oracle challenges.

Resource link:

file = 199810090500.17129.html & mode = corp & td = 01 & product = 00 & tm = 10 & fd = 01 & fm = 08 & status = Search & ty = 1998 & limit = 100 & fy = 1998 class = red target = _blank> Oracle for Linux official press release

Detailed guidance of Oracle 8.0.5 and OAS 3 on RedHat:

(Step-by-step install notes for oracle 8.0.5 and application server on red hat)

Download Oracle 8 and Oracle Application Server

Oliver Andrichs Python & Linux Page

Do = listmsgs & conf = early.linux class = red target = _blank> Oracle on Linux - Forum on Oracle TechNet

BlackDown.org - Linux JDK

Pythond's Oracle module

Oracle SQLJ - SQL in Java

OWS Killer

Matts House Run Oracle for Linux on FreeBSD

source:

Tianjin Linux Hotline

转载请注明原文地址:https://www.9cbs.com/read-1022.html

New Post(0)